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
|
||||
|
||||
select_floppy:
|
||||
push dx
|
||||
call seek_zero
|
||||
call read
|
||||
; load disk geometry
|
||||
@ -76,17 +77,30 @@ select_floppy:
|
||||
; we dont rely on the 'total sectors' given in the BPB
|
||||
; instead, we assume maximum cylinder
|
||||
; 1023 is the maximum encodable for int 13h
|
||||
mov di, 1023
|
||||
mul di
|
||||
mov [part_size], ax
|
||||
mov [part_size+2], dx
|
||||
; set partition offset to zero
|
||||
lea di, [part_offset]
|
||||
xor ax, ax
|
||||
mov [part_offset], ax
|
||||
mov [part_offset+2], ax
|
||||
; partition offset = 0
|
||||
stosw
|
||||
stosw
|
||||
; partition size = 0x00010000 = 32MB
|
||||
stosw
|
||||
inc ax
|
||||
stosw
|
||||
|
||||
pop dx
|
||||
ret
|
||||
|
||||
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 read
|
||||
mov bx, disk_buffer+0x1BE
|
||||
@ -94,6 +108,12 @@ select_hdd:
|
||||
lea di, [part_offset]
|
||||
mov cx, 4
|
||||
rep movsw
|
||||
; read bpb
|
||||
mov dx, [part_offset+2]
|
||||
mov ax, [part_offset]
|
||||
call seek
|
||||
call read
|
||||
pop dx
|
||||
ret
|
||||
|
||||
; Set absolute sector number
|
||||
|
Loading…
Reference in New Issue
Block a user