-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-browse.s
executable file
·98 lines (91 loc) · 1.98 KB
/
page-browse.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
******************************************************************************************
*
* Browse Address Buffer Page
*
******************************************************************************************
*
* 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 AddressFieldPrologue,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
lda #1 ; A:Y = $100 or 256 lines
ldy #0
clc ; we need scrolling
rts
BrowseDisplay ; Called with Acc = line
; Calculate buffer address
sta DATA+1
sty DATA
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 TrackNavigationKeys