VirtualBox

Ticket #19402: kernel.asm

File kernel.asm, 1.3 KB (added by Mariana89, 5 years ago)

The source code of the kernel

Line 
1VGA_MEMORY equ 0xB8000
2
3BLACK equ 0x0
4BLUE equ 0x1
5GREEN equ 0x2
6CYAN equ 0x3
7RED equ 0x4
8MAGENTA equ 0x5
9BROWN equ 0x6
10LIGHT_GREY equ 0x7
11DARK_GREY equ 0x8
12LIGHT_BLUE equ 0x9
13LIGHT_GREEN equ 0xA
14LIGHT_CYAN equ 0xB
15LIGHT_RED equ 0xC
16LIGHT_MAGENTA equ 0xD
17LIGHT_BROWN equ 0xE
18WHITE equ 0xF
19
20org 0x7C00
21bits 16
22
23mov ax, VGA_MEMORY >> 4
24mov es, ax
25mov ax, 0x07E0
26mov ss, ax
27mov esp, 0xFFF0
28mov ax, 0
29mov ds, ax
30
31; Disable the annoying cursor
32mov ah, 0x01
33mov ch, 001_11111b
34int 0x10
35
36reset_disk_hdd:
37 mov ah, 0x00 ; reset function
38 int 0x13 ; disk int
39 jc reset_disk_hdd
40
41mov ax, 00h
42mov ds, ax
43mov si, disk_address_packet
44
45read_disk_hdd:
46 mov ah, 42h ; read function
47 int 0x13 ; disk int
48 jc read_disk_hdd
49
50mov ax, VGA_MEMORY >> 4
51mov es, ax
52mov ax, [0x7E00]
53mov [es:0x00], ax
54
55jmp $
56
57disk_address_packet:
58db 10h ; size of DAP (set this to 10h)
59db 00h ; unused, should be zero
60dw 43h ; number of sectors to be read
61dd 0x0000_7E00 ; segment:offset pointer to the memory buffer to which sectors will be transferred
62dq 01h ; absolute number of the start of the sectors to be read
63
64times 510-($-$$) db 0
65
66dw 0xAA55
67dw (RED << 4 | GREEN) << 8 | 'P'

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy