Implement loading BPB from media
This commit is contained in:
parent
23ddd6b41a
commit
27e4dec580
@ -139,12 +139,36 @@ setint: push es
|
||||
bpb: times bpb_len db 0
|
||||
drvnum: db 0
|
||||
align 4
|
||||
drvpos: dd 0
|
||||
drvoff: dd 0 ; partition offset
|
||||
drvpos: dd 0 ; absolute physical sector number
|
||||
buffer: times 512 db 0
|
||||
|
||||
; Select active drive
|
||||
; IN dl drive number A=0, B=1, C=2, ...
|
||||
select: mov [drvnum], dl
|
||||
push es
|
||||
xor ax, ax
|
||||
push cs
|
||||
pop es
|
||||
stosw
|
||||
stosw
|
||||
stosw
|
||||
stosw
|
||||
pop es
|
||||
call read
|
||||
call ldbpb
|
||||
ret
|
||||
|
||||
; load bpb from buffer to bpb
|
||||
ldbpb: push ds
|
||||
push es
|
||||
mov ax, cs
|
||||
mov si, buffer+0x0B
|
||||
mov di, bpb
|
||||
mov cx, bpb_len
|
||||
rep movsb
|
||||
pop es
|
||||
pop ds
|
||||
ret
|
||||
|
||||
; Set sector number
|
||||
@ -207,17 +231,11 @@ init: cli
|
||||
mov ss, ax
|
||||
xor sp, sp
|
||||
|
||||
xor dh, dh
|
||||
call dnconv
|
||||
int 3
|
||||
call select
|
||||
|
||||
xor ax, ax
|
||||
xor dx, dx
|
||||
call seek
|
||||
|
||||
call read
|
||||
|
||||
mov ax, [buffer+0x1FE]
|
||||
int 3
|
||||
mov ax, [cs:bpb+bpb_ss]
|
||||
int 3
|
||||
|
||||
main: push cs
|
||||
|
Loading…
Reference in New Issue
Block a user