blob: e45b89a8661649efd7b5dd0f1186ee45a0adb66d (
plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;; Miguel's FoolOS Helper Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;disk_load_16
;
[bits 16]
DISK_LOAD:
db "D",0
;disk_load routune (load dh sectors from drive dl to es:bx)
;lba mode has 52 sectors hardcoded!
disk_load_16:
pusha
; check if LBA is supported
pusha
mov ah,0x41
mov bx,0x55aa
int 0x13
jnc disk_load_lba
popa
; load using CHS
mov ah,0x02 ;BIOS read sector func
mov al,dh ;read dh sectors (amount)
mov ch,0x00 ;cyl 0
mov dh,0x00 ;head 0
mov cl,0x02 ;start at sector 2
;
int 0x13 ;bios interrupt
popa
ret
; load using LBA
disk_load_lba:
popa
xor ah,ah
mov ah,0x42
lea si,[lba_adr]
int 0x13
jc skip_print
mov bx, DISK_LOAD
call print_string
skip_print:
popa
ret
lba_adr:
dw 0x10 ; size of packet ( 16 byte)
dw 52 ; number of sectors to read
dw 0x1000 ; target addr.
dw 0 ;
dd 1 ; first sector to read
dd 0 ;
|