-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisk.asm
More file actions
36 lines (28 loc) · 901 Bytes
/
Copy pathdisk.asm
File metadata and controls
36 lines (28 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Function to read from the disk
;load DHsectors to ES:BX from drive DL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diskLoad:
push dx
mov ah,0x02 ; BIOS read sector function
mov al,dh ; Read DH sectors
mov ch,0x00 ; Select cylinder 0
mov dh,0x00
mov cl,0x02 ; Start reading from second sector - ie after boot sector
int 0x13 ; BIOS interrupt
jc disk_error_BIOS
pop dx
cmp dh,al ; if AL (sectors read) != DH (sectors ecpected)
jne disk_error_SECT
ret
disk_error_BIOS:
mov si, DISK_ERROR_BIOS
call printString
jmp $
disk_error_SECT:
mov si, DISK_ERROR_SECT
call printString
jmp $
; Variables
DISK_ERROR_BIOS: db "Disk BIOS error!", 0xa, 0xd, 0
DISK_ERROR_SECT: db "Disk sector error!", 0xa, 0xd, 0