Implement reading of BPB from FAT partition
This commit is contained in:
parent
8d28dc9f85
commit
a472c396e7
@ -65,6 +65,7 @@ select: mov byte [disk_current], 0xFF
|
|||||||
jmp select_hdd
|
jmp select_hdd
|
||||||
|
|
||||||
select_floppy:
|
select_floppy:
|
||||||
|
push dx
|
||||||
call seek_zero
|
call seek_zero
|
||||||
call read
|
call read
|
||||||
; load disk geometry
|
; load disk geometry
|
||||||
@ -76,17 +77,30 @@ select_floppy:
|
|||||||
; we dont rely on the 'total sectors' given in the BPB
|
; we dont rely on the 'total sectors' given in the BPB
|
||||||
; instead, we assume maximum cylinder
|
; instead, we assume maximum cylinder
|
||||||
; 1023 is the maximum encodable for int 13h
|
; 1023 is the maximum encodable for int 13h
|
||||||
mov di, 1023
|
lea di, [part_offset]
|
||||||
mul di
|
|
||||||
mov [part_size], ax
|
|
||||||
mov [part_size+2], dx
|
|
||||||
; set partition offset to zero
|
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
mov [part_offset], ax
|
; partition offset = 0
|
||||||
mov [part_offset+2], ax
|
stosw
|
||||||
|
stosw
|
||||||
|
; partition size = 0x00010000 = 32MB
|
||||||
|
stosw
|
||||||
|
inc ax
|
||||||
|
stosw
|
||||||
|
|
||||||
|
pop dx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
select_hdd:
|
select_hdd:
|
||||||
|
push dx
|
||||||
|
; load CHS geometry for drive
|
||||||
|
mov ah, 0x8
|
||||||
|
int 0x13
|
||||||
|
xor ah, ah
|
||||||
|
mov al, cl
|
||||||
|
mov [disk_spt], ax
|
||||||
|
mul byte dh
|
||||||
|
mov [disk_spc], ax
|
||||||
|
; load offset and size of first partition
|
||||||
call seek_zero
|
call seek_zero
|
||||||
call read
|
call read
|
||||||
mov bx, disk_buffer+0x1BE
|
mov bx, disk_buffer+0x1BE
|
||||||
@ -94,6 +108,12 @@ select_hdd:
|
|||||||
lea di, [part_offset]
|
lea di, [part_offset]
|
||||||
mov cx, 4
|
mov cx, 4
|
||||||
rep movsw
|
rep movsw
|
||||||
|
; read bpb
|
||||||
|
mov dx, [part_offset+2]
|
||||||
|
mov ax, [part_offset]
|
||||||
|
call seek
|
||||||
|
call read
|
||||||
|
pop dx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; Set absolute sector number
|
; Set absolute sector number
|
||||||
|
Loading…
Reference in New Issue
Block a user