Add support for floppy types with other geometry than 18/2/80
This commit is contained in:
parent
de04b5ca01
commit
f10fa026cf
5
Makefile
5
Makefile
@ -68,9 +68,12 @@ clean:
|
||||
rm -f *.com *.bs *.0 *.lst *.img *.bin *.rom
|
||||
rm -rf utils
|
||||
|
||||
qemu-floppy: fd1440.img $(ROMS)
|
||||
qemu-floppy3: fd1440.img $(ROMS)
|
||||
$(QEMU) $(QEMU_ARGS) -boot a -fda fd1440.img
|
||||
|
||||
qemu-floppy5: fd360.img $(ROMS)
|
||||
$(QEMU) $(QEMU_ARGS) -boot a -fda fd360.img
|
||||
|
||||
qemu-hdd: hdimage.img $(ROMS)
|
||||
$(QEMU) $(QEMU_ARGS) -boot c -hda hdimage.img
|
||||
|
||||
|
@ -46,6 +46,9 @@ logdrv: ; dont do anything if drive already selected
|
||||
mov [dsknum], dl
|
||||
; save info for bios
|
||||
mov [biosnum], dl
|
||||
; set default geometry (1.44 MB floppy)
|
||||
mov word [bpb+BPBNOS], 2
|
||||
mov word [bpb+BPBSPT], 18
|
||||
; load boot sector
|
||||
xor ax, ax
|
||||
xor dx, dx
|
||||
@ -61,12 +64,18 @@ logdrv: ; dont do anything if drive already selected
|
||||
mov [bpb+BPBHS+2], ax
|
||||
.ret: ret
|
||||
|
||||
calchs: mov bx, (18*2)
|
||||
calchs: ; put sectors per cylinder into bx
|
||||
mov ax, [bpb+BPBSPT]
|
||||
mul word [bpb+BPBNOS]
|
||||
mov bx, ax
|
||||
; but linear sector num into dx:ax
|
||||
mov ax, [dskseek]
|
||||
mov dx, [dskseek+2]
|
||||
; dx:ax = linear count, bx = sectors / cylinder
|
||||
div bx
|
||||
xchg ax, dx
|
||||
; dx = cylinder, ax = head * spt + sector
|
||||
mov bl, 18
|
||||
mov bl, [bpb+BPBSPT]
|
||||
div byte bl
|
||||
; dx = cylinder, al = head, ah = sector
|
||||
xchg dl, dh
|
||||
@ -134,9 +143,6 @@ dirty: or byte [dskflag], 1 ; dirty
|
||||
; flush buffer if dirty
|
||||
flush: test byte [dskflag], 1
|
||||
jz .ret
|
||||
; load sector number
|
||||
mov ax, [dskseek]
|
||||
mov dx, [dskseek+2]
|
||||
; do the write
|
||||
; TODO: error handling & retries
|
||||
call calchs
|
||||
|
Loading…
Reference in New Issue
Block a user