slimmer RWTS mode

This commit is contained in:
Peter Ferrie 2018-12-14 20:53:50 -08:00
parent 7f7d664737
commit ec57592a57

View File

@ -58,8 +58,8 @@ ver_02 = 1
rwts_mode = 0 ;set to 1 to enable emulation of DOS RWTS when running from hard disk rwts_mode = 0 ;set to 1 to enable emulation of DOS RWTS when running from hard disk
;uses a one-time open of a tree file, no other file access allowed ;uses a one-time open of a tree file, no other file access allowed
;use unique volume numbers to distinguish between images in the same file ;use unique volume numbers to distinguish between images in the same file
;requires override_adr, enable_seek, allow_trees, always_trees ;requires override_adr, allow_trees, always_trees
;not compatible with enable_floppy, aligned_read, allow_subdir, might_exist, bounds_check ;not compatible with enable_floppy, allow_subdir, might_exist, bounds_check
load_high = 0 ;set to 1 to load to top of RAM (either main or banked, enables a himem check) load_high = 0 ;set to 1 to load to top of RAM (either main or banked, enables a himem check)
load_aux = 0 ;load to aux memory load_aux = 0 ;load to aux memory
load_banked = 1 ;set to 1 to load into banked RAM instead of main RAM (can be combined with load_aux for aux banked) load_banked = 1 ;set to 1 to load into banked RAM instead of main RAM (can be combined with load_aux for aux banked)
@ -1843,29 +1843,29 @@ unrelochdd
sty namlo sty namlo
!if ver_02 = 1 { !if ver_02 = 1 {
lda #0 lda #0
sta reqcmd ;seek
sta sizehi sta sizehi
} else { ;ver_02 } else { ;ver_02
stz reqcmd ;seek
stz sizehi stz sizehi
} ;ver_02 } ;ver_02
ldy #$0c ;command ldy #$0c ;command
!if enable_write = 1 {
lda (namlo),y lda (namlo),y
cmp #2 ;write (or format if greater) cmp #2 ;write (or format if greater)
php php
bcc skipinit ;read bcc skipinit ;read
beq skipinit ;write beq skipinit ;write
ldy #5 ;sector ldy #5 ;sector
!if ver_02 = 1 { !if ver_02 = 1 {
txa txa
} else { ;ver_02 } else { ;ver_02
lda #0 lda #0
} ;ver_02 } ;ver_02
sta (namlo),y sta (namlo),y
dey ;track dey ;track
sta (namlo),y sta (namlo),y
skipinit skipinit
!if allow_multi = 1 { } ;enable_write
!if allow_multi = 1 {
ldy #3 ;volume ldy #3 ;volume
lda (namlo),y lda (namlo),y
bne + bne +
@ -1873,14 +1873,14 @@ skipinit
+ cmp lastvol + cmp lastvol
sta lastvol sta lastvol
bne + bne +
ror adrhi ;bit 7 set if same volume ror unit ;bit 7 set if same volume
+ ldy #$0e ;returned volume + ldy #$0e ;returned volume
sta (namlo),y sta (namlo),y
ldx #vollist_e-vollist_b ldx #vollist_e-vollist_b
- dex - dex
cmp vollist_b,x cmp vollist_b,x
bne - bne -
} ;allow_multi } ;allow_multi
ldy #4 ;track ldy #4 ;track
lda (namlo),y lda (namlo),y
asl asl
@ -1892,7 +1892,7 @@ skipinit
iny ;sector iny ;sector
ora (namlo),y ora (namlo),y
ldy sizehi ldy sizehi
!if allow_multi = 1 { !if allow_multi = 1 {
- dex - dex
bmi ++ bmi ++
clc clc
@ -1903,7 +1903,7 @@ skipinit
iny iny
bne - bne -
++ ++
} ;allow_multi } ;allow_multi
tax tax
tya tya
lsr lsr
@ -1912,7 +1912,24 @@ skipinit
txa txa
ror ror
php php
bit unit
bpl newtree
cpy lasttree
beq newblock
;volume or tree changed, so tree changed
newtree tax
beq newblock ;block zero will automatically read tree
pha
lda #0
jsr seek1 jsr seek1
pla
;block changed, read it
newblock jsr seek1
plp plp
bcc + bcc +
inc adrhi inc adrhi
@ -1922,17 +1939,24 @@ skipinit
dey ;adrlo dey ;adrlo
lda (namlo),y lda (namlo),y
sta bloklo sta bloklo
ldx #0
ldy #0 ldy #0
!if enable_write = 1 {
ldx #0
plp plp
bcs runinit bcs runinit
} ;enable_write
- lda (adrlo),y
sta (bloklo),y
iny
bne -
!if swap_zp = 0 { !if swap_zp = 0 {
bcc hddcopycache clc
rts
} else { ;swap_zp } else { ;swap_zp
jsr hddcopycache
beq swap_zpg beq swap_zpg
} ;swap_zp } ;swap_zp
!if enable_write = 1 {
runinit bne format runinit bne format
- lda (bloklo),y - lda (bloklo),y
sta (adrlo),y sta (adrlo),y
@ -1961,19 +1985,18 @@ writesec sta namlo
lda adrhi lda adrhi
and #$fe and #$fe
sta adrhi sta adrhi
- lda #cmdwrite lda #cmdwrite
sta reqcmd sta reqcmd
inc lastblk ;force mismatch inc lastblk ;force mismatch
jsr hddrdwrloopx - jsr hddrdwrloopx
dec adrhi inc blkidx
dec adrhi bne +
dec namlo inc treeidx
+ dec namlo
bne - bne -
dec namhi dec namhi
bpl - bpl -
!if no_interrupts = 0 { } ;enable_write
clc
} ;no_interrupts
!if swap_zp = 1 { !if swap_zp = 1 {
swap_zpg swap_zpg
@ -1991,20 +2014,17 @@ swap_zpg
tay tay
pla pla
} ;swap_zp } ;swap_zp
rts
hddcopycache !if enable_write = 1 {
- lda (adrlo),y !if no_interrupts = 0 {
sta (bloklo),y clc
iny } ;no_interrupts
bne -
rts rts
blanksec !text "SAN INC." blanksec !text "SAN INC."
} ;enable_write
seek1 sta blkidx seek1 sta blkidx
lda #1
sta sizehi
} else { ;rwts_mode } else { ;rwts_mode
!if (enable_readseq + allow_subdir) > 0 { !if (enable_readseq + allow_subdir) > 0 {
hddrdwrpart jmp hddrdwrfile hddrdwrpart jmp hddrdwrfile
@ -2473,14 +2493,14 @@ hddrdwrloop
!if ver_02 = 1 { !if ver_02 = 1 {
ldx #0 ldx #0
stx adrlo stx adrlo
!if ((enable_write + enable_seek) and (rwts_mode - 1)) > 0 { !if (enable_write + enable_seek) > 0 {
inx ;ldx #cmdread inx ;ldx #cmdread
} ;(enable_write or enable_seek) and not rwts_mode } ;enable_write or enable_seek
} else { ;ver_02 = 0 } else { ;ver_02 = 0
stz adrlo stz adrlo
!if ((enable_write + enable_seek) and (rwts_mode - 1)) > 0 { !if (enable_write + enable_seek) > 0 {
ldx #cmdread ldx #cmdread
} ;(enable_write or enable_seek) and not rwts_mode } ;enable_write or enable_seek
} ;ver_02 } ;ver_02
+ +
} ;aligned_read and rwts_mode } ;aligned_read and rwts_mode
@ -2517,12 +2537,6 @@ hddrdwrloop
} else { ;rwts_mode = 1 } else { ;rwts_mode = 1
;or in this case, read whenever tree index changes ;or in this case, read whenever tree index changes
!if ver_02 = 1 {
lda #0
sta adrlo
} else { ;ver_02 = 0
stz adrlo
} ;ver_02
ldy treeidx ldy treeidx
cpy lasttree cpy lasttree
beq skiptree beq skiptree
@ -2530,8 +2544,6 @@ hddrdwrloop
ldx blkidx ldx blkidx
inx inx
stx lastblk stx lastblk
lda #>hdddirbuf
sta adrhi
} ;rwts_mode } ;rwts_mode
;fetch tree data block and read it ;fetch tree data block and read it
@ -2539,7 +2551,7 @@ hddrdwrloop
!if fast_trees = 0 { !if fast_trees = 0 {
ldx treeblklo ldx treeblklo
lda treeblkhi lda treeblkhi
jsr hddseekrd jsr hddreaddirsel
ldy treeidx ldy treeidx
!if rwts_mode = 0 { !if rwts_mode = 0 {
inc treeidx inc treeidx
@ -2573,7 +2585,11 @@ noteof1
php php
} ;aligned_read and rwts_mode } ;aligned_read and rwts_mode
!if fast_trees = 0 {
jsr hddseekrd jsr hddseekrd
} else { ;fast_trees = 1
jsr hddreaddirsel
} ;fast_trees
skiptree skiptree
!if rwts_mode = 0 { !if rwts_mode = 0 {
@ -2610,8 +2626,10 @@ skiptree
} ;enable_write } ;enable_write
} ;aligned_read } ;aligned_read
} else { ;rwts_mode = 1 } else { ;rwts_mode = 1
!if fast_trees = 1 {
lda #>hddencbuf lda #>hddencbuf
sta adrhi sta adrhi
} ;fast_trees
ldy blkidx ldy blkidx
;read whenever block index changes ;read whenever block index changes
@ -2640,7 +2658,16 @@ skiptree
fixy2 tya fixy2 tya
noteof2 noteof2
} ;detect_treof } ;detect_treof
!if allow_sparse = 1 { !if allow_sparse = 0 {
!if rwts_mode = 1 {
!if enable_write = 0 {
jmp hddseekrd
} else { ;enable_write = 1
ldy reqcmd
jmp hddseekrdwr
} ;enable_write
} ;rwts_mode
} else { ;allow_sparse
pha pha
ora hdddirbuf, y ora hdddirbuf, y
tay tay
@ -2658,7 +2685,11 @@ noteof2
dey dey
iny ;don't affect carry iny ;don't affect carry
!if swap_scrn = 0 { !if swap_scrn = 0 {
!if enable_write = 0 {
bne hddseekrd
} else { ;enable_write = 1
bne hddseekrdwr bne hddseekrdwr
} ;enable_write
} else { ;swap_scrn = 1 } else { ;swap_scrn = 1
bne hddrdwrswap bne hddrdwrswap
} ;swap_scrn } ;swap_scrn
@ -2725,6 +2756,8 @@ hddissparse
bne - bne -
!if rwts_mode = 0 { !if rwts_mode = 0 {
beq hddresparse beq hddresparse
} else { ;rwts_mode = 1
skipblk rts
} ;rwts_mode } ;rwts_mode
} ;allow_sparse } ;allow_sparse
!if rwts_mode = 0 { !if rwts_mode = 0 {
@ -2790,8 +2823,6 @@ hddcopycache
sta blkoffhi sta blkoffhi
bcc hddrdwrdone ;always bcc hddrdwrdone ;always
} ;aligned_read } ;aligned_read
} else { ;rwts_mode = 1
skipblk rts
} ;rwts_mode } ;rwts_mode
!if swap_scrn = 1 { !if swap_scrn = 1 {
@ -2861,7 +2892,9 @@ hddreaddirsect
unrhddrd = unrelochdd + (* - reloc) unrhddrd = unrelochdd + (* - reloc)
sty adrhi sty adrhi
hddseekrd ldy #cmdread hddseekrd ldy #cmdread
!if enable_write = 1 { !if enable_write = 0 {
sty command
} else { ;enable_write = 1
!if (aligned_read + rwts_mode) > 0 { !if (aligned_read + rwts_mode) > 0 {
hddseekrdwr sty command hddseekrdwr sty command
} else { ;aligned_read = 0 or rwts_mode = 0 } else { ;aligned_read = 0 or rwts_mode = 0
@ -2900,6 +2933,9 @@ unrunit2 = unrelochdd + (* - reloc)
!word readbuff + $200 !word readbuff + $200
!word 2 !word 2
} ;allow_extend } ;allow_extend
!if ((allow_sparse xor 1) and rwts_mode) = 1 {
skipblk rts
} ;not allow_sparse and rwts_mode
!if (rwts_mode + allow_multi) > 1 { !if (rwts_mode + allow_multi) > 1 {
vollist_b vollist_b
@ -3098,7 +3134,7 @@ hdddataend
} ;allow_trees and fast_trees } ;allow_trees and fast_trees
!warn "hdd driver start: ", unrelochdd - init !warn "hdd driver start: ", unrelochdd - init
!if (one_page + enable_floppy) = 0 { !if (one_page + enable_floppy) = 0 {
!if ((hddcodeend - hddopendir) < $100) { !if ((hddcodeend - reloc) < $100) {
!warn "one_page can be enabled, code is small enough" !warn "one_page can be enabled, code is small enough"
} ;hddcodeend } ;hddcodeend
} ;not one_page and not enable_floppy } ;not one_page and not enable_floppy