Adding Browse interface. Max lines limited to 255 which causes unintended wrap around on display.

This commit is contained in:
Rob Greene 2016-01-31 11:07:59 -06:00
parent 744de46a11
commit b21be649e0

View File

@ -300,6 +300,8 @@ SetScreen
da AboutInit, AboutDisplay, AboutKeypress
dfb "F"
da FieldInit, FieldDisplay, FieldKeypress
dfb "B"
da BrowseInit, BrowseDisplay, BrowseKeypress
dfb 0 ; end
*
@ -359,6 +361,7 @@ AboutInit ; Returns with Acc = max lines
asc _INVERSE,_MT_ON,_O_APPLE,_MT_OFF,_NORMAL,"A = This about page.",$00
asc _INVERSE,_MT_ON,_O_APPLE,_MT_OFF,_NORMAL,"F = Address field display. " ; (cont)
asc "(Assuming 'good' address fields on disk.)",$00
asc _INVERSE,_MT_ON,_O_APPLE,_MT_OFF,_NORMAL,"B = Browse track buffer.",$00
asc " ",$00
asc "Source available at https://github.com/a2geek/afscanner",$00
asc " ",$00
@ -388,6 +391,21 @@ AboutInit ; Returns with Acc = max lines
da PROLOGUE+2
dfb $00
asc " ",$00
asc "Browse Track Buffer",$00
asc "===================",$00
asc " ",$00
asc "Browse the raw track buffer. Header fields are hilighted. Note that the ",$00
asc "buffer is $2000 (8192) bytes long and some sectors will be repeated.",$00
asc " ",$00
asc "Headers are currently set to "
dfb 1
da PROLOGUE
dfb " ",1
da PROLOGUE+1
dfb " ",1
da PROLOGUE+2
dfb $00
asc " ",$00
asc "-END-",$00
dfb 0
@ -537,6 +555,98 @@ FieldKeypress ; Called with Acc = key
bcs :setup
bcc :setdst
*
* BROWSE interface
*
BrowseInit ; Returns with Acc = max lines
jsr PRINT
asc _INVERSE,_MT_ON,_U_ARROW,_D_ARROW,_MT_OFF,_NORMAL," Scroll / "
asc _INVERSE,_MT_ON,_O_APPLE,_NORMAL,"-",_INVERSE,_U_ARROW,_D_ARROW,_MT_OFF,_NORMAL," Page / "
asc _MT_ON,_INVERSE,_L_ARROW,_R_ARROW,_NORMAL,_MT_OFF," Track / "
asc "re",_INVERSE,"S",_NORMAL,"can / "
asc _INVERSE,"R",_NORMAL,"ecalibrate / "
asc "goto ",_INVERSE,"T",_NORMAL,"rack"
dfb 0
* Scan for our prologue mark them by turning off the high bit
jsr ReadTrack ; position head and fully populate buffer
jsr SETUPDATA
:scan ldy #0 ; index for comparisons
:loop lda (DATA),y
cmp PROLOGUE,Y
bne :adv
iny
cpy #3
bcc :loop
; We found prologue bytes, strip off high bit
:strip dey
bmi :adv
lda (DATA),y
and #$7f
sta (DATA),y
bne :strip ; should be always
:adv inc DATA
bne :scan
inc DATA+1
dec TEMP
bne :scan
; The number of lines is based on how many bytes we show on screen
; HOWEVER, we are limited to 255 lines, so we actually skip the last 32 bytes
lda #$ff
rts
BrowseDisplay ; Called with Acc = line
; Calculate buffer address
sta DATA
stz DATA+1
ldy #5 ; times 32
:mult32 asl DATA
rol DATA+1
dey
bne :mult32
clc
lda #>DATASTART
adc DATA+1
sta DATA+1
; Display offset
lda #"+"
jsr COUT
lda DATA+1
and #$3f
jsr PRHEX
lda DATA
jsr PRHEX
jsr PRINT
asc "- ",$00
; Display 'disk' bytes, highlighting the field markers (high bit was stripped off in init routine)
ldy #0
:nxtbyt lda (DATA),y
bmi :prhex
pha
lda #_INVERSE
jsr COUT
pla
ora #$80
:prhex jsr PRHEX
lda #_NORMAL
jsr COUT
tya
and #$07
cmp #$07
bne :testy
lda #" "
jsr COUT
:testy iny
cpy #32
bne :nxtbyt
jmp PRCR
BrowseKeypress ; Called with Acc = key
jmp FieldKeypress ; identical to Field ... for now at least
*
* DISK II routines
*