-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage-graphics.s
executable file
·143 lines (136 loc) · 2.5 KB
/
page-graphics.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
******************************************************************************************
*
* HGR Disk Display
*
******************************************************************************************
*
* HGR/Graphics interface
*
; Init displays HGR and the static text on the page
HgrInit
jsr PRINT
asc "re",_INVERSE,"S",_NORMAL,"can / "
asc _INVERSE,"R",_NORMAL,"ecalibrate"
dfb 0
; Lay out a our rudimentary page:
jsr HGR
stz TEMPY
:newlin lda TEMPY
jsr HPOSN
ldy #0
:line lda TEMPY
and #$8
bne :lownyb
:hinyb tya
lsr
lsr
lsr
lsr
bra :draw
:lownyb tya
and #$0f
:draw asl
asl
asl
sta TEMP
lda TEMPY
and #$07
ora TEMP
tax
lda HgrHexFont,x
sta (HBAS),y
iny
cpy #35
bne :line
inc TEMPY
lda TEMPY
cmp #16
blt :newlin
; return values
sec ; no scrolloing
lda #0 ; 0 = number of lines (A:Y)
tay
rts
HgrDisplay
; Store current track to not interfere with other screens
lda DSTTRK
pha
; 144 lines (18 text lines * 8 graphic lines ea)
; buffer = 8192 bytes / 144 lines = 56 bytes ea
; OR NIB suggest 6656 / 144 lines = 46 bytes ea
stz DSTTRK
:nxttrk jsr ReadTrack
lda #16
sta :ycoord
jsr SETUPDATA
stz :count
lda #46
sta :bytes
:loop lda (DATA)
cmp #$FF
bne :skip
inc :count
:skip dec :bytes
bne :skip2
lda :ycoord
jsr HPOSN
ldy CURTRK
ldx #0
lda :count
beq :empty
:bits inx
lsr
bne :bits
:empty lda :plot,x
sta (HBAS),y
inc :ycoord
lda :ycoord
cmp #160
bge :botm
stz :count
lda #46
sta :bytes
:skip2 inc DATA
bne :loop
inc DATA+1
dec TEMP
bne :loop
:botm inc DSTTRK
lda DSTTRK
cmp #35
blt :nxttrk
; Restore current target track for other screens
pla
sta DSTTRK
rts
:ycoord dfb 0
:count dfb 0
:bytes dfb 0
:plot hex 000103070f1f3f7fff
HgrKeypress
cmp #"R"
beq :recal
cmp #"S"
beq :setup
:back jmp KeyboardWait
:recal lda #40
sta CURTRK ; This forces the recalibration
stz DSTTRK
:setup jmp SetupPage ; this redraws page and re-initializes, presumably, on a new disk
HgrHexFont ; Stolen from https://github.com/Michaelangel007/apple2_hgr_font_tutorial
hex 1C22322A26221C00 ; 0
hex 080C080808081C00 ; 1
hex 1C22201804023E00 ; 2
hex 3E20101820221C00 ; 3
hex 101814123E101000 ; 4
hex 3E021E2020221C00 ; 5
hex 3804021E22221C00 ; 6
hex 3E20100804040400 ; 7
hex 1C22221C22221C00 ; 8
hex 1C22223C20100E00 ; 9
hex 081422223E222200 ; A
hex 1E22221E22221E00 ; B
hex 1C22020202221C00 ; C
hex 1E22222222221E00 ; D
hex 3E02021E02023E00 ; E
hex 3E02021E02020200 ; F