-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmessenger.asm
More file actions
280 lines (268 loc) · 12.3 KB
/
messenger.asm
File metadata and controls
280 lines (268 loc) · 12.3 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
; bank 3
;score display is realized as a "message" system
;
;Score is the default message but there can be others
;
; Configuarble Blinking scrolling in from left, right top button!
;
; uses five font
;
; font can be colorized (per line top/bottom
; Calib X,Y
; color table
; text
; effect: Blink, intensity, colorCycle
; mode: multi line (text scrolls in out vertically)
; default text (score)
;
font5Def
dw font5a_line1
db 1
db font5a_line2- font5a_line1
; 12
colorCycleData
db $50, $48, $40, $38, $30
db $28, $30, $38, $40, $48, $50, $48, $40, $38, $30
;
MESSAGE_TEXT_HEIGHT = $f8
MESSAGE_TEXT_WIDTH = $50
; output "here" one line of a string
; return to beginning with one step down
; pointer to string in "Vec_Str_Ptr"
; size in Vec_Text_Height / Vec_Text_Width
; start of font in x (correct line) in font bit map
_PRINT_STRING_LINE macro
STB <VIA_port_b ;Update RAMP, set mux to channel 1
decb
stb <VIA_port_b ;Enable mux
LDD #$8081
STB <VIA_port_b ;Disable RAMP, set mux to channel 0
STA <VIA_port_b ;Enable mux
LDA #MESSAGE_TEXT_WIDTH ;Get text width
STB <VIA_port_b ;Disable RAMP, set mux to channel 0
STA <VIA_port_a ;Send it to the D/A
LDa #$01
LDU Vec_Str_Ptr ;Point to start of text string
STA <VIA_port_b ;Enable RAMP, disable mux
BRA LF4CB_5\?
LF4C7_5\?
LDA A,X ;Get bitmap from chargen table
STA <VIA_shift_reg ;Save in shift register
LF4CB_5\?
LDA ,U+ ;Get next character
BPL LF4C7_5\? ;Go back if not terminator
LDA #$01
STb <VIA_port_b ;disable RAMP, disable mux
NEG <VIA_port_a ;Negate text width to D/A
STA <VIA_port_b ;Enable RAMP, disable mux
CMPX #FONT_END ; Check for last row
BEQ outHere\? ;Branch if last row
LEAX FONT_LENGTH,X ;Point to next chargen row
TFR U,D ;Get string length
SUBD Vec_Str_Ptr
SUBB #$02 ; - 2
ASLB ; * 2
BRN LF4EB_5\? ;Delay a moment
LF4EB_5\?
LDA #$81
NOP
DECB
BNE LF4EB_5\? ;Delay some more in a loop
STA <VIA_port_b ;Disable RAMP, disable mux
LDB #MESSAGE_TEXT_HEIGHT ;Get text height
STB <VIA_port_a ;Store text height in D/A
deca
sta <VIA_port_b ;Enable mux
LDD #$8101
NOP ;Wait a moment
STA <VIA_port_b ;disable RAMP, disable mux
CLR <VIA_port_a ;Clear D/A
STB <VIA_port_b ;Enable RAMP, disable mux
STA <VIA_port_b ;Disable RAMP, disable mux
outHere\?
endm
; string pointer in Vec_Str_Ptr
; in D position
PREPARE_PRINT_STRING_LINE macro
stu Vec_Str_Ptr
LDX #FONT_START_A ;Point to start of chargen bitmaps
MY_MOVE_TO_D_END
LDD #$1883 ;$8x = disable RAMP?
CLR <VIA_port_a ;Clear D/A output
STA <VIA_aux_cntl ;Shift reg mode = 110, T1 PB7 enabled
endm
FINISH_PRINT_STRING_LINE macro
LDA #$98
STA <VIA_aux_cntl ;T1->PB7 enabled
endm
PRINT_STRING_LINE_1 macro
_PRINT_STRING_LINE
endm
PRINT_STRING_LINE macro
LDB #$03 ;$0x = enable RAMP?
_PRINT_STRING_LINE
endm
; all other states are checked "in move"
testNextState1
lda #$5f
_INTENSITY_A_8
; ldd #$7f10
ldd #$7010
MY_MOVE_TO_D_START
ldd messageState ; a = messageState, b = messageTimer
cmpa #MESSAGE_STATE_SCROLL_NORMAL_OUT
bne testNextState2
lda messageTimer
dec messageTimer
lbpl scrollOut
lda #MESSAGE_STATE_SCROLL_MESSAGE_IN
sta messageState
lda #10
sta messageTimer
jmp scrollOut
testNextState2
cmpa #MESSAGE_STATE_SCROLL_MESSAGE_IN
bne testNextState3
ldu messagePointer
lda messageTimer
dec messageTimer
lbpl scrollIn
lda #MESSAGE_STATE_STAY_TIMED
sta messageState
lda #50
sta messageTimer
jmp scrollIn
testNextState3
cmpa #MESSAGE_STATE_SCROLL_MESSAGE_OUT
bne testNextState4
ldu messagePointer
lda messageTimer
dec messageTimer
lbpl scrollOut
lda #MESSAGE_STATE_SCROLL_NORMAL_IN
sta messageState
lda #10
sta messageTimer
jmp scrollOut
testNextState4
cmpa #MESSAGE_STATE_SCROLL_NORMAL_IN
bne testNextState5
lda messageTimer
dec messageTimer
lbpl scrollIn
lda #MESSAGE_STATE_STAY
sta messageState
lda #0
sta messageTimer
jmp scrollIn
;
; ------------------------------------------------------
;
displayScore
ldu #player_score ; score isdefault
lda gameScale ; movement scale
sta VIA_t1_cnt_lo
lda messageState ; check message state
cmpa #MESSAGE_STATE_STAY ; if normal "score" jump to color cycle
beq normalMessageCont
cmpa #MESSAGE_STATE_STAY_TIMED ; a "timed" message is stable
lbne testNextState1 ; not? than check next possible state
ldu messagePointer ; get the current message
dec messageTimer ; checkif timer expired
bne normalMessageCont
lda #MESSAGE_STATE_SCROLL_MESSAGE_OUT ; if expired - scroll this message out!
sta messageState ; save new message state
lda #10 ; in steps of 2 (keeping 2 rounds each)
sta messageTimer ; save timer
; jmp normalMessageCont ; -> also jump to color cycling
testNextState5
normalMessageCont
lda colorCycleCount
ldb Vec_Loop_Count+1
andb #%00000011
bne noColorCycle
inc colorCycleCount
cmpa #9 ;
blo noReset
clra
sta colorCycleCount
noReset
noColorCycle
ldy #colorCycleData
leay a,y
lda ,y+
_INTENSITY_A_8
ldd #$7010
MY_MOVE_TO_D_START
lda #5
sta tmp2_tmp
PREPARE_PRINT_STRING_LINE
anotherLine
_PRINT_STRING_LINE
lda ,y+ ; y pointer to color ta
_INTENSITY_A_8 ; intensity 8 keeps ramp to disabled!
CLR <VIA_port_a ; needed aftr intensity setting!
LDB #$03 ;$0x = enable RAMP?
dec tmp2_tmp
bne anotherLine
FINISH_PRINT_STRING_LINE
jmp calibrationZero7
;scroll position is messageTimer/2
; scroll message is in U
; scrolling is out in the top
; scrolling is in from top
scrollOut
negb
addb #10
scrollIn
intLineTest
LDX #FONT_START_A ;Point to start of chargen bitmaps
stu Vec_Str_Ptr
lsrb
; that many lines we "skip"
; prepare String
cmpb #0
bne test_1
lda #5
bra do_line_start
test_1
cmpb #1
bne test_2
LEAX FONT_LENGTH,X ;Point to next chargen row
lda #4
bra do_line_start
test_2
cmpb #2
bne test_3
LEAX 2*FONT_LENGTH,X ;Point to next chargen row
lda #3
bra do_line_start
test_3
cmpb #3
bne test_4
LEAX 3*FONT_LENGTH,X ;Point to next chargen row
lda #2
bra do_line_start
test_4
cmpb #4
bne test_5
LEAX 4*FONT_LENGTH,X ;Point to next chargen row
lda #1
bra do_line_start
test_5
MY_MOVE_TO_D_END
bra do0Lines
do_line_start
sta tmp2_tmp
MY_MOVE_TO_D_END
LDD #$1883 ;$8x = disable RAMP?
CLR <VIA_port_a ;Clear D/A output
STA <VIA_aux_cntl ;Shift reg mode = 110, T1 PB7 enabled
do_line
_PRINT_STRING_LINE
LDB #$03 ;$0x = enable RAMP?
dec tmp2_tmp
bne do_line
do0Lines
FINISH_PRINT_STRING_LINE
jmp calibrationZero7