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 -f *.com *.bs *.0 *.lst *.img *.bin *.rom
|
||||||
rm -rf utils
|
rm -rf utils
|
||||||
|
|
||||||
qemu-floppy: fd1440.img $(ROMS)
|
qemu-floppy3: fd1440.img $(ROMS)
|
||||||
$(QEMU) $(QEMU_ARGS) -boot a -fda fd1440.img
|
$(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-hdd: hdimage.img $(ROMS)
|
||||||
$(QEMU) $(QEMU_ARGS) -boot c -hda hdimage.img
|
$(QEMU) $(QEMU_ARGS) -boot c -hda hdimage.img
|
||||||
|
|
||||||
|
@ -46,6 +46,9 @@ logdrv: ; dont do anything if drive already selected
|
|||||||
mov [dsknum], dl
|
mov [dsknum], dl
|
||||||
; save info for bios
|
; save info for bios
|
||||||
mov [biosnum], dl
|
mov [biosnum], dl
|
||||||
|
; set default geometry (1.44 MB floppy)
|
||||||
|
mov word [bpb+BPBNOS], 2
|
||||||
|
mov word [bpb+BPBSPT], 18
|
||||||
; load boot sector
|
; load boot sector
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
xor dx, dx
|
xor dx, dx
|
||||||
@ -61,12 +64,18 @@ logdrv: ; dont do anything if drive already selected
|
|||||||
mov [bpb+BPBHS+2], ax
|
mov [bpb+BPBHS+2], ax
|
||||||
.ret: ret
|
.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
|
; dx:ax = linear count, bx = sectors / cylinder
|
||||||
div bx
|
div bx
|
||||||
xchg ax, dx
|
xchg ax, dx
|
||||||
; dx = cylinder, ax = head * spt + sector
|
; dx = cylinder, ax = head * spt + sector
|
||||||
mov bl, 18
|
mov bl, [bpb+BPBSPT]
|
||||||
div byte bl
|
div byte bl
|
||||||
; dx = cylinder, al = head, ah = sector
|
; dx = cylinder, al = head, ah = sector
|
||||||
xchg dl, dh
|
xchg dl, dh
|
||||||
@ -134,9 +143,6 @@ dirty: or byte [dskflag], 1 ; dirty
|
|||||||
; flush buffer if dirty
|
; flush buffer if dirty
|
||||||
flush: test byte [dskflag], 1
|
flush: test byte [dskflag], 1
|
||||||
jz .ret
|
jz .ret
|
||||||
; load sector number
|
|
||||||
mov ax, [dskseek]
|
|
||||||
mov dx, [dskseek+2]
|
|
||||||
; do the write
|
; do the write
|
||||||
; TODO: error handling & retries
|
; TODO: error handling & retries
|
||||||
call calchs
|
call calchs
|
||||||
|
Loading…
Reference in New Issue
Block a user