]> git.dujemihanovic.xyz Git - nameless-os.git/blob - disk.s
Read bytes from boot drive
[nameless-os.git] / disk.s
1 ; ES:BX - where to load
2 ; DH - sector count
3 ; DL - drive number
4
5 read_sectors:
6 xor bl, bl
7 mov di, disk_reading
8 call print
9 push dx
10 mov ah, 02h
11 mov al, dh
12 mov ch, 0
13 mov dh, 0
14 mov cl, 2
15
16 int 13h
17
18 jc read_error
19
20 pop dx
21 cmp dh, al
22 jne read_error
23 ret
24
25 read_error:
26 xor bl, bl
27 mov di, disk_error
28 call print
29 mov dl, ah
30 xor dh, dh
31 call print_word
32 mov dl, al
33 call print_word
34 jmp $
35
36 disk_reading db "Reading from disk...", 0
37 disk_error db "Failed to read from disk! Take a look at this error code:", 0
38
39 ret