Initial checkin of toy OS project.
[os.git] / boot1 / hardware.asm
1 [BITS 16]
2 ;;; Call BIOS to populate equipment bitv in the HARDWARE buffer.
3 GET_EQUIPMENT_LIST:
4         xor ax, ax
5         int 0x11
6         mov [wEquipmentBitvector], ax
7         ret
8
9 ;;; Call BIOS to get the system memory size.
10 GET_MEMORY_SIZE:
11         xor ax, ax
12         mov ah, 0x88
13         int 0x15
14         add ax, 1024
15         mov [wMemorySize], ax
16         ret
17         
18 GET_TIME:
19         xor ax, ax
20         int 0x1a
21         push es
22         push si
23         mov es, cx
24         mov si, dx
25         mov cx, WORD [es:si]
26         mov [wSystemClock], cx
27         pop si
28         pop es
29         ret
30
31 ; Enable the A20 address line, so we can correctly address
32 ; memory above 1MB.
33 ENABLE_A20:     
34         mov     al, 0xD1
35         out     0x64, al
36         nop
37         jmp .here
38 .here:  mov     al, 0xDF
39         out     0x60, al
40         nop
41         jmp .there
42 .there: ret