-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcalibration.asm
More file actions
506 lines (477 loc) · 20.1 KB
/
calibration.asm
File metadata and controls
506 lines (477 loc) · 20.1 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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
;;;;;;; *****************************************
;;;;;;; * BANK 0 *
;;;;;;; *****************************************
;***************************************************************************
;
; must be made prettier
; and better discernable
;
; also to be done position calibration for potential overlay
;
; for now this is a "plaything"
calString1 db "CALIBRATION", $80
questionVectrex
db "IS YOUR VECTREX A", $80
buzzVectrex
db "BUZZ", $80
nobuzzVectrex
db "NO BUZZ", $80
buttonToConfirm
db "BUTTON 4 TO CONFIRM", $80
; a display list in y
buzzOrNoBuzz ;#isfunction
showbuzzOrNoBuzzLoop
clra
sta <VIA_shift_reg
JSR Wait_Recal_noShift ; Vectrex BIOS recalibration
lda #$4f
jsr Intensity_a
_LDD -2 ,$38
std Vec_Text_HW
lda gameScale
sta <VIA_t1_cnt_lo
IRQ_TO_0_SHIFT
ldd #$50bc
ldu #questionVectrex
jsr syncPrintStrd
_ZERO_VECTOR_BEAM
ldd #$3098
ldu #buzzVectrex
jsr syncPrintStrd
_ZERO_VECTOR_BEAM
ldd #$3010
ldu #nobuzzVectrex
jsr syncPrintStrd
_ZERO_VECTOR_BEAM
ldd #$d0b0
ldu #buttonToConfirm
jsr syncPrintStrd
_ZERO_VECTOR_BEAM
lda additionalFlags
anda #1
bne isNoBuzz
isBuzz
; draw lines
REPLACE_1_2_drawBuzzBox_varFromIRQ1_1
ldx #0 ; drawBuzzBox
jsr jsrBank1X
bra buzzdrawDone
isNoBuzz
REPLACE_1_2_drawNoBuzzBox_varFromIRQ1_1
ldx #0 ; drawNoBuzzBox
jsr jsrBank1X
buzzdrawDone
jSR queryJoystick ;Joy_Digital
LDA Vec_Joy_1_X
BEQ noJoyChange
bpl buzGoRight
lda additionalFlags
anda #%11111110
sta additionalFlags
bra noJoyChange
buzGoRight
lda additionalFlags
ora #1
sta additionalFlags
noJoyChange
JSR Read_Btns ; get button status
ldb $C811 ; button pressed - any
andb #1 ; button 4
beq noCalibHelp1
ldy #displayList1
jsr showMESSAGE
ldy #displayList2
jsr showMESSAGE
lbeq showbuzzOrNoBuzzLoop
noCalibHelp1
ldb $C811 ; button pressed - any
andb #8 ; button 4
lbeq showbuzzOrNoBuzzLoop ;
rts
;
; .....................................................
;
initCalibration1 ;#isfunction
jsr buzzOrNoBuzz
; for boss display we must init a shot list
REPLACE_1_2_initPlayerShotList_varFrom1_1
ldx #0 ; initPlayerShotList
jsr jsrBank3_from0_SHIFT
;
REPLACE_1_2_playerShotsDoneBoss01_varFrom0_1
ldd #0 ; playerShotsDoneBoss01
std PLAYERSHOTS_DONE_A
clr calibrationStage
; enable joystick - values destroyed "in game"
lda #1
sta $C81F
lda #3
sta $C820
clra
sta leftSmallGunAnimStart
sta rightSmallGunAnimStart
sta leftBigGunAnimStart
sta rightBigGunAnimStart
sta tmp1
sta eyeLeftAnimCounter
ldd #0
std bossPosY
; loop thru all calibrations
nextCalibration
CLR Vec_Music_Flag ; no music is playing ->0 (is placed in rottist!
JSR Init_Music_Buf ; shadow regs
JSR Do_Sound ; ROM function that does the sound playing, here used to clear all regs
clr calibButton
jsr calibrationLopp ; size
inc calibrationStage
ldx #calibrationSubs
lda calibrationStage
lsla
ldd a,x
bne nextCalibration
lda additionalFlags
ora #BIT_RAN_CALIBRATION
sta additionalFlags
jsr saveBlockOnChange
againB
JSR Read_Btns ; get button status
ldb $C80f ;11 ; button pressed - any
andb #$08 ; button 4 return
bne againB
clr Vec_Loop_Count
REPLACE_1_2_main01_varFrom0_3 ; bank 0 replace
ldx #0 ; main01
jmp jmpBankIRQ2X
;
; .....................................................
;
calib50 ;#isfunction
ldb $C811 ; button pressed - any
andb #1
beq noBossHelp
ldy #displayListBoss
jsr showMESSAGE
jmp calibrationLopp ; and repeat forever
noBossHelp
ldx #calibrationValue50
jsr adjustCalibration
lda #DEFAULT_ENEMY_INTENSITY
jsr Intensity_a
lda #BOSS_SPRITE_SCALE
sta boss1Scale
ldd #$20f6
std bossPosY
lda diverseFlags
ora #BIT_FLAG_IS_BOSSFIGHT_ANY
sta diverseFlags
REPLACE_1_2_displayBoss1L_varFrom0_7 ; bank 0 replace
ldx #0 ; displayBoss1
jsr jsrBank2_fromShift_0
clra
sta <VIA_shift_reg
jmp calibrationLopp ; and repeat forever
;
; .....................................................
;
calibText ;#isfunction
ldb $C811 ; button pressed - any
andb #1
beq noTextHelp
ldy #displayList3
jsr showMESSAGE
ldy #displayList4
jsr showMESSAGE
jmp calibrationLopp ; and repeat forever
noTextHelp
; reference line!
lda #DEFAULT_ENEMY_INTENSITY
jsr Intensity_a
ldd #$5240
jsr MoveToD
ldd #$0080
jsr DrawLined
ldx #calibrationValueString
jsr adjustCalibration
REPLACE_1_2_displayCalibrationText_varFrom0_0 ; bank 0 replace
ldx #0 ;displayCalibrationText
jsr jsrBank2_fromShift_0
jmp calibrationLopp ; and repeat forever
;
; .....................................................
;
calib16 ;#isfunction
ldb $C811 ; button pressed - any
andb #1
beq noTextHelp2
ldy #displayList4
jsr showMESSAGE
jmp calibrationLopp ; and repeat forever
noTextHelp2
lda #DEFAULT_ENEMY_INTENSITY
jsr Intensity_a
ldd #$6640
jsr MoveToD
ldd #$0080
jsr DrawLined
ldx #calibrationValue16
jsr adjustCalibration
REPLACE_1_2_displayHSCalibrationText_varFromIRQ1_3 ; bank 0 replace
ldx #0 ;displayHSCalibrationText
jsr jsrBank1_fromBank0_T1
lda gameScale
sta <VIA_t1_cnt_lo
ldd #$1040
jsr MoveToD
ldd #$0080
jsr DrawLined
_ZERO_VECTOR_BEAM
REPLACE_1_2_printCalibrationOptionText_varFrom0_3 ; bank 0 replace
ldx #0 ; printCalibrationOptionText
jsr jsrBank2_fromShift_0
IRQ_TO_0_T1
jmp calibrationLopp ; and repeat forever
;
; .....................................................
;
calib09 ;#isfunction
ldb $C811 ; button pressed - any
andb #1
beq noNormalHelp
ldy #displayListNormal
jsr showMESSAGE
jmp calibrationLopp ; and repeat forever
noNormalHelp
ldx #calibrationValue7
bsr adjustCalibration
lda #DEFAULT_ENEMY_INTENSITY
_INTENSITY_A
REPLACE_1_2_displaySpriteCalibration_varFrom1_1
ldx #0 ; displaySpriteCalibration
jsr jsrBank3_from0_SHIFT
jmp calibrationLopp ; and repeat forever
;
; .....................................................
;
calibSwarm ;#isfunction
ldb $C811 ; button pressed - any
andb #1
beq noSwarmHelp
ldy #displayListSwarm
jsr showMESSAGE
jmp calibrationLopp ; and repeat forever
noSwarmHelp
lda #DEFAULT_ENEMY_INTENSITY
jsr Intensity_a
ldx #calibrationValue6
bsr adjustCalibration
REPLACE_1_2_displaySwarmCalibration_varFrom1_1
ldx #0 ; displaySwarmCalibration
jsr jsrBank3_from0_SHIFT
jmp calibrationLopp ; and repeat forever
;
; .....................................................
;
adjustCalibration
lda Vec_Loop_Count+1
anda #1
beq joyDoneSwarm
LDA Vec_Joy_1_Y
BEQ joyDoneSwarm
BMI left_moveSwarm
right_moveSwarm:
dec ,x
bra joyDoneSwarm
left_moveSwarm:
inc ,x
bra joyDoneSwarm
joyDoneSwarm
lda $C811
anda #2 ; button 2
beq buttonsDone1_6
inc ,x
bra buttonsDone__16
buttonsDone1_6
lda $C811
anda #4 ; button 3
beq buttonsDone__16
dec ,x
buttonsDone__16
rts
;
; .....................................................
;
calibSize ;#isfunction
ldb $C811 ; button pressed - any
andb #1
beq noSizeHelp
ldy #displayListSize
jsr showMESSAGE
jmp calibrationLopp ; and repeat forever
noSizeHelp
lda #DEFAULT_ENEMY_INTENSITY
jsr Intensity_a
lda Vec_Loop_Count+1
anda #1
beq joyDoneCalibSize
; react to joystick input
LDA Vec_Joy_1_Y
BEQ joyDoneCalibSize
BMI left_moveSize
right_moveSize
inc gameScale
lda gameScale
cmpa #$a0
bls joyDoneCalibSize
lda #$a0
sta gameScale
bra joyDoneCalibSize
left_moveSize
dec gameScale
lda gameScale
cmpa #$60
bhs joyDoneCalibSize
lda #$60
sta gameScale
bra joyDoneCalibSize
joyDoneCalibSize
; display sizings
_ZERO_VECTOR_BEAM
jsr Reset_Pen
lda gameScale
sta <VIA_t1_cnt_lo
lda Vec_0Ref_Enable
pshs a
clr Vec_0Ref_Enable
ldd #$7f7f
jsr MoveToD
ldd #$8000
jsr DrawLined
ldd #$8000
jsr DrawLined
ldd #$80
jsr DrawLined
ldd #$80
jsr DrawLined
ldd #$7f00
jsr DrawLined
ldd #$7f00
jsr DrawLined
ldd #$7f
jsr DrawLined
ldd #$7f
jsr DrawLined
puls a
sta Vec_0Ref_Enable
_ZERO_VECTOR_BEAM
ldd # "00"
std player_score
std player_score+2
std player_score+4
lda #$80
sta player_score+6
lda gameScale
ldx #player_score
jsr Add_Score_a
jsr Strip_Zeros
ldd #$00d0
ldu #player_score
jsr Print_Str_d
bra calibrationLopp ; and repeat forever
;
; .....................................................
;
calibrationSubs
dw calibText ; scale 25
dw calib16
dw calibSize
dw calibSwarm
dw calib50
dw calib09
dw 0
;
; .....................................................
;
calibrationLopp
clra
sta <VIA_shift_reg
JSR Wait_Recal_noShift ; Vectrex BIOS recalibration
lda #$4f
_INTENSITY_A
IRQ_TO_0_SHIFT
lda #-2
sta Vec_Text_Height
lda #$80
sta <VIA_t1_cnt_lo
ldd #$90b8
ldu #calString1
jsr sync_Print_Str_d_fixed_8
_ZERO_VECTOR_BEAM
IRQ_TO_0_SHIFT
jSR queryJoystick ;Joy_Digital
JSR Read_Btns ; get button status
ldb $C811 ; button pressed - any
; if any button pressed - finish
andb #8 ; button 4
beq no_button ;
buttonPressed
lda #1
sta tmp1
bra buttonPressedDone
no_button:
tst tmp1
beq buttonPressedDone
clr tmp1
inc calibButton ; only counts as pressed, when pressed and RELEASED!
rts
buttonPressedDone
ldx #calibrationSubs
lda calibrationStage
lsla
jmp [a,x]
;
; .....................................................
;
MoveToD
STA <VIA_port_a ;Store Y in D/A register
LDA #$CE ;Blank low, zero high?
STA <VIA_cntl ;
CLRA
STA <VIA_port_b ;Enable mux
nop
nop
if IS_VIA_FAULTY_RESISTENT = 1
inca
sta <VIA_port_b ;Disable mux
deca
else
INC <VIA_port_b ;Disable mux
endif
STB <VIA_port_a ;Store X in D/A register
STA <VIA_t1_cnt_hi ;enable timer
MY_MOVE_TO_A_END
rts
;
; .....................................................
;
DrawLined
sta <VIA_port_a ; 4
clra
sta <VIA_port_b ; 4
inca
nop 2
sta <VIA_port_b
deca
stb <VIA_port_a ; 5
ldb #$ee ; light ON, ZERO OFF
sta <VIA_t1_cnt_hi ; 4
stb <VIA_cntl ;
ldd #$40ce
FlagWaitdld:
bita <VIA_int_flags
beq FlagWaitdld
nop 4
stb <VIA_cntl ;
rts
;
; .....................................................
;