shink seek, add banked read option

This commit is contained in:
Peter Ferrie 2016-11-28 16:35:24 -08:00
parent 2608588ea7
commit f593148187

57
fstbt.s
View File

@ -6,6 +6,13 @@
!to "fstbt",plain !to "fstbt",plain
*=$800 *=$800
enable_stack = 0 ;set to 1 to enable reading into stack (mutually exclusive with enable_banked)
enable_banked = 0 ;set to bank number (1 or 2) to enable reading into banked RAM
!if (enable_stack+enable_banked)=2 {
!error can't enable both options
}
!byte 1 !byte 1
tay ;A is last read sector+1 on entry tay ;A is last read sector+1 on entry
@ -37,14 +44,27 @@ incindex
sty $3d ;set sector sty $3d ;set sector
iny ;prepare to be next sector in case of unallocated sector iny ;prepare to be next sector in case of unallocated sector
inc adrindex + 1 ;select next address inc adrindex + 1 ;select next address
!if enable_banked=1 {
lda $C08B
lda $C08B
} else {
!if enable_banked=2 {
lda $C083
lda $C083
}
}
adrindex adrindex
lda adrtable - 1 ;15 entries in first row, 16 entries thereafter lda adrtable - 1 ;15 entries in first row, 16 entries thereafter
beq incsector ;skip empty slots to allow sparse tracks beq incsector ;skip empty slots to allow sparse tracks
sta $27 ;set high part of address sta $27 ;set high part of address
tay tay
iny !if enable_banked=0 {
beq jmpoep ;#$FF means end of data iny ;detect #$FF (end of data)
} else {
dey ;detect #$01 (end of data)
}
beq jmpoep ;end of data
;convert slot to PROM address ;convert slot to PROM address
@ -53,37 +73,36 @@ adrindex
lsr lsr
lsr lsr
lsr lsr
ora #$c0 ora #$C0
pha pha
lda #$5B ;read-1 lda #$5B ;read-1
pha pha
rts ;return to PROM rts ;return to PROM
;requires carry set on entry
;carry is set by cpy above
;and by wait below
seek seek
inc $41 ;next track inc $41 ;next track
asl $40 ;carry clear, phase off
jsr seek1 jsr seek1
clc ;carry clear, phase off
seek1 ;phase on seek1
inc phase + 1 jsr delay ;returns with carry set, phase on
inc $40
phase
ldy #0 ;self-modified
jsr delay
clc ;phase off
ldy phase + 1
dey
delay delay
tya lda $40
and #3 and #3
rol rol
ora $2B ;merge in slot ora $2B ;merge in slot
tay tay
lda $C080, y lda $C080, y
!if enable_banked = 1 {
lda $C089
} else {
!if enable_banked = 2 {
lda $C081
}
}
lda #$30 lda #$30
jmp $FCA8 ;common delay for all phases jmp $FCA8 ;common delay for all phases
@ -93,5 +112,5 @@ jmpoep
adrtable adrtable
;15 slots for track 0 (track 0 sector 0 is not addressable) ;15 slots for track 0 (track 0 sector 0 is not addressable)
;16 slots for all other tracks ;16 slots for all other tracks, fill with addresses, 0 to skip any sector
!byte $FF ;end of list !byte 1 ;end of list, can't load to stack