-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbatalyx.asm
1557 lines (1419 loc) · 45.8 KB
/
batalyx.asm
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
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; This is the reverse-engineered source code for the game 'Batalyx'
; written by Jeff Minter in 1985.
;
; The code in this file was created by disassembling a binary of the game released into
; the public domain by Jeff Minter in 2019.
;
; The original code from which this source is derived is the copyright of Jeff Minter.
;
; The original home of this file is at: https://github.com/mwenge/batalyx
;
; To the extent to which any copyright may apply to the act of disassembling and reconstructing
; the code from its binary, the author disclaims copyright to this source code. In place of
; a legal notice, here is a blessing:
;
; May you do good and not evil.
; May you find forgiveness for yourself and forgive others.
; May you share freely, never taking more than you give.
;
; (Note: I ripped this part from the SQLite licence! :) )
;
; **** ZP FIELDS ****
;
f0C = $0C
f39 = $39
f8D = $8D
fB5 = $B5
fC0 = $C0
fC1 = $C1
fC2 = $C2
fD4 = $D4
fE7 = $E7
;
; **** ZP ABSOLUTE ADRESSES ****
;
RAM_ACCESS_MODE = $01
screenLinesLoPtr = $02
screenLinesHiPtr = $03
currentCharXPos = $04
currentCharYPos = $05
a06 = $06
currentChar = $07
a08 = $08
a09 = $09
currentRasterArrayIndex = $0A
a0B = $0B
a0D = $0D
a0E = $0E
a0F = $0F
a10 = $10
a11 = $11
a12 = $12
a13 = $13
a14 = $14
a15 = $15
a16 = $16
a17 = $17
a18 = $18
a19 = $19
a1A = $1A
a1B = $1B
a1C = $1C
a1D = $1D
a1E = $1E
a1F = $1F
a20 = $20
a23 = $23
a24 = $24
a25 = $25
a26 = $26
a39 = $39
a3A = $3A
a3B = $3B
a3C = $3C
a3D = $3D
a3E = $3E
a3F = $3F
a40 = $40
a7D = $7D
a90 = $90
a99 = $99
a9A = $9A
a9D = $9D
aAD = $AD
aAE = $AE
aAF = $AF
aB7 = $B7
aB8 = $B8
aB9 = $B9
aBA = $BA
aBB = $BB
aBC = $BC
aC1 = $C1
aC2 = $C2
aC3 = $C3
aC4 = $C4
currentPressedKey = $C5
aC6 = $C6
aCC = $CC
aD0 = $D0
aD1 = $D1
aD3 = $D3
aD4 = $D4
aD6 = $D6
aD8 = $D8
aD9 = $D9
tempLoPtr1 = $FB
tempHiPtr1 = $FC
tempLoPtr2 = $FD
tempHiPtr2 = $FE
;
; **** ZP POINTERS ****
;
p00 = $00
p01 = $01
p06 = $06
p11 = $11
p14 = $14
p17 = $17
p19 = $19
p1B = $1B
p1D = $1D
p1F = $1F
p23 = $23
p25 = $25
p3F = $3F
p60 = $60
p61 = $61
p8D = $8D
pAD = $AD
pBB = $BB
pC1 = $C1
pC3 = $C3
pD0 = $D0
pD1 = $D1
pF0 = $F0
pF3 = $F3
;
; **** FIELDS ****
;
f00DB = $00DB
f00FE = $00FE
f00FF = $00FF
;
; **** ABSOLUTE ADRESSES ****
;
a00A2 = $00A2
a00A9 = $00A9
a00D9 = $00D9
;
; **** POINTERS ****
;
p0008 = $0008
p00C1 = $00C1
screenLinesLoPtrArray = $0340
screenLinesHiPtrArray = $0360
.include "constants.asm"
* = $0801
;--------------------------------------------------------------------------------------------------
; SYS 16816 ($41B0)
; This launches the program from address $41B0, i.e. LaunchBatalyx.
;--------------------------------------------------------------------------------------------------
; $9E = SYS
; $31,$36,$38,$31,$36,$00 = 16816 ($41B0 in hex)
.BYTE $0C,$08,$0A,$00,$9E,$31,$36,$38,$31,$36,$00
* = $0810
;--------------------------------------------------------------------------------------------------
; Game 4: Cippy on the Run
; Cippy runs along a grey corridor. Wherever he walks, bands of rainbow light
; appear. The objective is to paint all the walls with colour. There are hostile
; spheres, however. They don't affect Cippy, but they change the colour of the
; wall sections wherever they hit. If Cippy walks on one of the changed sections
; then strange things happen; he may be inverted, or made to jump, or teleported,
; or his grav changed, depending on the colour of the changed panel. Cippy fires
; out a stream of bullets which may be used to blap the spheres. A scanner below
; the screen shows progress. You have to paint in all the grey bits allowing the
; spheres to claim as few bits as possible. Each complete corridor you do, you
; get a quarter of the Completion Icon. Every two phases there are Bonus Runs,
; with no spheres and a psychedelic Cippy. The game mechanic changes slightly on
; higher levels.
;
; Cippy can run by pushing the stick left and right, and jump between surfaces by
; up/down. You can also execute a jump on the surface you're on by pressing fire.
; The bullets flow constantly and you can steer them with your motion. Watch out
; for the black holes with the red bits in.
;
; Design Notes: I had a lot of fun with this one. It was just a case of sitting
; down and coding and seeing what came out. I got to use my beloved grav and
; inertia modules too, and the whole is fairly pretty. Roots are in the Q-bert
; and painting genre I suppose, but quite a long way removed. I particularly like
; the 'furry' noise when you jump, and the psychedelic Cippy in the bonus phase.
; The bullets are all associated with various people on the Compunet system; I
; asked them for a little sprite each to use in the game.
;---------------------------------------------------------------------------------
.include "cippyontherun.asm"
a1DA9 .BYTE $F0,$C6,$FE,$70,$FF,$FF,$F0,$66
.BYTE $BF,$38,$7F,$FF,$F8,$39,$00,$0C
.BYTE $1F,$FF,$FE,$00,$00,$00,$00,$00
.BYTE $00,$00,$3F,$FF,$FC,$32,$FF,$FC
.BYTE $3B,$FF,$FC,$1D,$FF,$FE,$1F,$FF
.BYTE $FE,$1F,$FF,$FE,$3F,$FF,$FC,$31
.BYTE $9F,$9C,$3F,$FF,$FC,$66,$9F,$38
.BYTE $7F,$FF,$F8,$61,$3F,$38,$FF,$FF
.BYTE $F0,$C6,$FE,$70,$FF,$FF,$F0,$CD
.BYTE $7E,$70,$FF,$FF,$F0,$72,$00,$18
.BYTE $7F,$FF,$F8,$00,$00,$00,$00,$18
.BYTE $00,$7D,$30,$00,$79,$03,$00,$0F
.BYTE $01,$80,$EF,$19,$81,$E8,$31,$87
.BYTE $DF,$63,$1F,$9F,$66,$3F,$07,$30
.BYTE $FE,$00,$01,$FC,$00,$07,$F8,$00
.BYTE $09,$F8,$00,$1E,$F0,$00,$35,$60
.BYTE $00,$26,$C0,$00,$35,$80,$00,$0E
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
.BYTE $00,$00,$00,$00,$00,$00,$00,$30
.BYTE $00,$FB,$60,$60,$F7,$C0,$C0,$FF
.BYTE $70,$60,$FF,$18,$30,$C0,$0C,$60
.BYTE $1C,$39,$C0,$F9,$63,$07,$F7,$30
.BYTE $3F,$CF,$00,$FF,$80,$05,$7F,$00
.BYTE $01,$3C,$00,$0A,$98,$00,$15,$30
.BYTE $00,$02,$80,$00,$04,$80,$00,$00
.BYTE $00,$00,$00,$00,$00,$00,$00,$00
.BYTE $00,$00,$00,$00,$00,$00,$00,$7F
.BYTE $FF,$F0,$60,$F3,$18,$60,$F3,$0C
.BYTE $60,$F3,$06,$60,$F3,$06,$60,$FF
.BYTE $06,$60,$00,$06,$60,$00,$06,$60
.BYTE $00,$06,$60,$00,$06,$63,$FF,$C6
.BYTE $63,$6B,$C6,$63,$FF,$C6,$63,$37
.BYTE $C6,$63,$FF,$C6,$63,$45,$C6,$63
.BYTE $FF,$C6,$7F,$FF,$FE,$00,$00,$00
.BYTE $00,$00,$00,$00,$00,$00,$00,$7F
.BYTE $FF,$F0,$67,$D8,$18,$67,$B8,$0C
.BYTE $67,$D8,$06,$67,$B8,$06,$67,$F8
.BYTE $06,$60,$00,$06,$60,$00,$06,$60
.BYTE $00,$06,$60,$00,$06,$63,$FF,$C6
.BYTE $63,$6B,$C6,$63,$FF,$C6,$63,$37
.BYTE $C6,$63,$FF,$C6,$63,$45,$C6,$63
.BYTE $FF,$C6,$7F,$FF,$FE,$00,$00,$00
.BYTE $00,$00,$00,$00,$00,$00,$00,$1C
.BYTE $00,$70,$36,$00,$D8,$06,$00,$C0
.BYTE $03,$01,$80,$03,$01,$80,$01,$83
.BYTE $00,$01,$83,$00,$01,$83,$00,$00
.BYTE $C6,$00,$00,$C6,$00,$00,$C6,$00
.BYTE $00,$FE,$00,$01,$FF,$00,$01,$7D
.BYTE $00,$00,$BA,$00,$00,$FE,$00,$00
.BYTE $FE,$00,$00,$FE,$00,$00,$6C,$00
.BYTE $00,$82,$00,$00,$FE,$00,$BD,$03
.BYTE $FF,$E0,$03,$FF,$E0,$03,$FF,$E0
.BYTE $06,$DB,$70,$07,$6D,$B0,$03,$DB
.BYTE $60,$03,$6D,$E0,$03,$DB,$60,$03
.BYTE $6D,$E0,$03,$DB,$60,$01,$ED,$C0
.BYTE $01,$DB,$C0,$01,$ED,$C0,$01,$DB
.BYTE $C0,$01,$ED,$C0,$01,$DB,$C0,$01
.BYTE $ED,$C0,$01,$FF,$C0,$00,$00,$00
.BYTE $00,$00,$00,$00,$00,$00,$BD,$03
.BYTE $FF,$E0,$03,$00,$60,$03,$60,$60
.BYTE $06,$03,$30,$06,$30,$30,$03,$00
.BYTE $60,$03,$FF,$E0,$03,$FF,$E0,$03
.BYTE $FF,$E0,$03,$DB,$60,$01,$ED,$C0
.BYTE $01,$DB,$C0,$01,$ED,$C0,$01,$DB
.BYTE $C0,$01,$ED,$C0,$01,$DB,$C0,$01
.BYTE $ED,$C0,$01,$FF,$C0,$00,$00,$00
.BYTE $00,$00,$00,$00,$00,$00,$BD,$03
.BYTE $FF,$E0,$03,$00,$60,$03,$60,$60
.BYTE $06,$03,$30,$06,$30,$30,$03,$00
.BYTE $60,$03,$0C,$60,$03,$00,$60,$03
.BYTE $30,$60,$03,$06,$60,$01,$80,$C0
.BYTE $01,$80,$C0,$01,$80,$C0,$01,$FF
.BYTE $C0,$01,$FF,$C0,$01,$FF,$C0,$01
.BYTE $ED,$C0,$01,$FF,$C0,$00,$00,$00
.BYTE $00,$00,$00,$00,$00,$00,$FF,$00
.BYTE $00,$00,$00,$00,$00,$00,$00
.include "charset.asm"
.include "sprites.asm"
.BYTE $0F,$8D,$18,$D4,$4C,$B0
f4007 .BYTE $41
f4008 .BYTE $00
f4009 .BYTE $0F
f400A .BYTE $DD
f400B .BYTE $01
f400C .BYTE $80
f400D .BYTE $81
f400E .BYTE $06
f400F .BYTE $02
f4010 .BYTE $00
f4011 .BYTE $01
f4012 .BYTE $80
f4013 .BYTE $03
f4014 .BYTE $05
f4015 .BYTE $10
f4016 .BYTE $00
f4017 .BYTE $01
f4018 .BYTE $00
f4019 .BYTE $00
f401A .BYTE $00,$0F,$FF,$02,$60,$21,$03,$05
.BYTE $00,$08,$80,$80,$FC,$10,$00,$08
.BYTE $20
f402B .BYTE $06
f402C .BYTE $00,$0F,$FF,$03,$60,$21,$03,$05
.BYTE $00,$08,$80,$80,$FC,$10,$00,$08
.BYTE $20,$06
a403E .BYTE $FF
a403F .BYTE $00
a4040 .BYTE $00
a4041 .BYTE $00
f4042 .BYTE $00
a4043 .BYTE $70
f4044 .BYTE $00
f4045 .BYTE $00,$00,$00,$00,$00,$00,$00,$00
.BYTE $00
f404E .BYTE $FF
f404F .BYTE $00
f4050 .BYTE $00
f4051 .BYTE $00,$01
f4053 .BYTE $70,$00,$00,$00,$00,$00,$00,$00
.BYTE $00,$00,$00
a405E .BYTE $30,$60
a4060 .BYTE $01,$C0,$02,$70
a4064 .BYTE $30
a4065 .BYTE $0C,$04,$04,$00,$01,$01,$00,$00
.BYTE $00,$32,$60,$08,$C1,$03,$70,$28
.BYTE $03,$FD,$02,$02,$00,$00,$00,$00
.BYTE $00,$34,$60,$07,$C2,$04,$70,$20
.BYTE $06,$FD,$02,$02,$00,$00,$00,$00
.BYTE $00,$36,$60,$05,$C3,$05,$70,$18
.BYTE $09,$FD,$02,$02,$00,$00,$00,$00
.BYTE $00,$38,$60,$0E,$C0,$06,$70,$10
.BYTE $0C,$FD,$02,$02,$00,$00,$00,$00
.BYTE $00,$3A,$60,$04,$C2,$07,$70,$08
.BYTE $13,$FD,$02,$02,$00,$00,$00,$00
.BYTE $00
f40BE .BYTE $3E,$4E,$5E,$6E,$7E,$8E,$9E,$AE
f40C6 .BYTE $40,$40,$40,$40,$40,$40,$40,$40
f40CE .BYTE $01,$02,$04,$08,$10,$20,$40,$80
a40D6 .BYTE $08
a40D7 .BYTE $03
a40D8 .BYTE $00
selectedSubGame .BYTE $02
f40DA .BYTE $02,$08,$07
f40DD .BYTE $05,$0E,$04,$06,$00,$00,$06
f40E4 .BYTE $04,$0E,$05,$07,$08,$02
f40EA .BYTE $01,$01,$0F,$0F,$0C,$0C,$0B,$0B
.BYTE $0B,$0B,$0C,$0C,$0F,$0F,$01
f40F9 .BYTE $01
f40FA .BYTE $00
f40FB .BYTE $06,$02,$04,$05,$03,$07,$01,$01
.BYTE $07,$03,$05,$04,$02,$06,$00
rasterJumpTableLoPtr2=*+$01
rasterJumpTableLoPtr3=*+$02
rasterJumpTableLoPtrArray .BYTE $55,$55
.BYTE $22,$22,$22,$22,$46,$46,$46,$46
.BYTE $46,$46
rasterJumpTableHiPtr2=*+$01
rasterJumpTableHiPtr3=*+$02
rasterJumpTableHiPtrArray .BYTE $C0,$C0
.BYTE $C3,$C3,$C3,$C3,$42,$42,$42,$42
.BYTE $42,$42
rasterPositionArray .BYTE $E0,$FF,$C0,$FF,$A0,$C0,$FF
;---------------------------------------------------------------------------------
; JumpToPlaySomeSounds
;---------------------------------------------------------------------------------
JumpToPlaySomeSounds
JMP PlaySomeSounds
;---------------------------------------------------------------------------------
; s412C
;---------------------------------------------------------------------------------
s412C
JMP j4677
;---------------------------------------------------------------------------------
; stroboscopeOnOff
;---------------------------------------------------------------------------------
stroboscopeOnOff
JMP j542B
;---------------------------------------------------------------------------------
; JumpToIncrementAndUpdateRaster
;---------------------------------------------------------------------------------
JumpToIncrementAndUpdateRaster
JMP IncrementAndUpdateRaster
;---------------------------------------------------------------------------------
; s4135
;---------------------------------------------------------------------------------
s4135
JMP j4C40
;---------------------------------------------------------------------------------
; s4138
;---------------------------------------------------------------------------------
s4138
JMP j59ED
;---------------------------------------------------------------------------------
; JumpToCheckSubGameSelection
;---------------------------------------------------------------------------------
JumpToCheckSubGameSelection
JMP CheckSubGameSelection
;---------------------------------------------------------------------------------
; j413E
;---------------------------------------------------------------------------------
j413E
JMP j578A
a4141 .BYTE $00
a4142 .BYTE $01
;---------------------------------------------------------------------------------
; InitializeScreenLinePtrArray
;---------------------------------------------------------------------------------
InitializeScreenLinePtrArray
LDA #>SCREEN_RAM + $0000
STA screenLinesHiPtr
LDA #<SCREEN_RAM + $0000
STA screenLinesLoPtr
LDX #$00
b414D LDA screenLinesLoPtr
STA screenLinesLoPtrArray,X
LDA screenLinesHiPtr
STA screenLinesHiPtrArray,X
LDA screenLinesLoPtr
CLC
ADC #$28
STA screenLinesLoPtr
LDA screenLinesHiPtr
ADC #$00
STA screenLinesHiPtr
INX
CPX #$1A
BNE b414D
RTS
;---------------------------------------------------------------------------------
; ClearScreen
;---------------------------------------------------------------------------------
ClearScreen
LDX #$00
b416C LDA #$20
STA SCREEN_RAM + $0000,X
STA SCREEN_RAM + $0100,X
STA SCREEN_RAM + $0200,X
STA SCREEN_RAM + $0300,X
LDA #$01
STA COLOR_RAM + $02F0,X
DEX
BNE b416C
RTS
;---------------------------------------------------------------------------------
; GetCurrentCharAddress
;---------------------------------------------------------------------------------
GetCurrentCharAddress
LDX currentCharYPos
LDY currentCharXPos
LDA screenLinesLoPtrArray,X
STA screenLinesLoPtr
LDA screenLinesHiPtrArray,X
STA screenLinesHiPtr
RTS
;---------------------------------------------------------------------------------
; GetCurrentChar
;---------------------------------------------------------------------------------
GetCurrentChar
JSR GetCurrentCharAddress
LDA (screenLinesLoPtr),Y
RTS
;---------------------------------------------------------------------------------
; WriteCurrentCharToScreen
;---------------------------------------------------------------------------------
WriteCurrentCharToScreen
JSR GetCurrentCharAddress
LDA currentChar
STA (screenLinesLoPtr),Y
LDA screenLinesHiPtr
PHA
; Update color of character
CLC
ADC #$D4
STA screenLinesHiPtr
LDA a06
STA (screenLinesLoPtr),Y
PLA
STA screenLinesHiPtr
RTS
a41AF .BYTE $27
;---------------------------------------------------------------------------------
; LaunchBatalyx $41B0
;---------------------------------------------------------------------------------
LaunchBatalyx
JSR InitializeScreenLinePtrArray
JSR ClearScreen
JSR DrawSomethingOnSecondLastLine
LDA $D016 ;VIC Control Register 2
AND #$F0
STA $D016 ;VIC Control Register 2
JSR InitializeVariablesInterruptsDrawRainbow
JSR SetUpInterrupts
LDA #$18
STA $D018 ;VIC Memory Control Register
LDA #$00
STA $D020 ;Border Color
STA $D021 ;Background Color 0
STA $D400 ;Voice 1: Frequency Control - Low-Byte
LDA #$04
STA $D407 ;Voice 2: Frequency Control - Low-Byte
LDA #$08
STA $D40E ;Voice 3: Frequency Control - Low-Byte
LDA #$02
STA selectedSubGame
JSR UpdateGameIconsPanel
JMP TitleScreenLoop
;---------------------------------------------------------------------------------
; SetUpInterrupts
;---------------------------------------------------------------------------------
SetUpInterrupts
SEI
LDA #$7F
STA $DC0D ;CIA1: CIA Interrupt Control Register
LDA #<TitleScreenInterruptHandler
STA $0314 ;IRQ
LDA #>TitleScreenInterruptHandler
STA $0315 ;IRQ
LDA #$00
STA currentRasterArrayIndex
JSR UpdateRasterPosition
JSR InitializeRasterJumpTablePtrArray
LDA #$01
STA $D01A ;VIC Interrupt Mask Register (IMR)
RTS
;---------------------------------------------------------------------------------
; UpdateRasterPosition
;---------------------------------------------------------------------------------
UpdateRasterPosition
LDA $D011 ;VIC Control Register 1
AND #$7F
STA $D011 ;VIC Control Register 1
LDX currentRasterArrayIndex
LDA rasterPositionArray,X
CMP #$FF
BNE b4224
LDA #$00
STA currentRasterArrayIndex
LDA rasterPositionArray
b4224 STA $D012 ;Raster Position
LDA #$01
STA $D019 ;VIC Interrupt Request Register (IRR)
RTS
;---------------------------------------------------------------------------------
; TitleScreenInterruptHandler
;---------------------------------------------------------------------------------
TitleScreenInterruptHandler
LDA $D019 ;VIC Interrupt Request Register (IRR)
AND #$01
BNE b4237
JMP $EA31
; Returns
; After a delay calculated from the IRQ switch to the Zarjas poster
; and back again.
b4237 LDX currentRasterArrayIndex
LDA rasterJumpTableLoPtrArray,X
STA a08
LDA rasterJumpTableHiPtrArray,X
STA a09
JMP ($0008)
;Returns
;---------------------------------------------------------------------------------
; IncrementAndUpdateRaster
;---------------------------------------------------------------------------------
IncrementAndUpdateRaster
INC currentRasterArrayIndex
JSR UpdateRasterPosition
PLA
TAY
PLA
TAX
PLA
RTI
;----------------------------------------------------------------
; s4251
;----------------------------------------------------------------
s4251
LDX currentRasterArrayIndex
LDA f40DA,X
STA $D020 ;Border Color
STA $D021 ;Background Color 0
JMP IncrementAndUpdateRaster
; Returns
;---------------------------------------------------------------------------------
; LaunchSubGame
;---------------------------------------------------------------------------------
LaunchSubGame
SEI
LDA #$00
STA currentRasterArrayIndex
JSR UpdateRasterPosition
LDX selectedSubGame
LDA subGameJumpMapLoPtr,X
STA a449E
LDA subGameJumpMapHiPtr,X
STA a449F
JSR UpdateGameIconsPanel
JMP (a449E)
; $AB00 - LaunchHallucinOBomblets
; $6000 - LaunchAMCII
; $4288 - LaunchIridisBase
; $0810 - LaunchCippyOnTheRun
; $A000 - LaunchSyncro
; $7800 - LaunchPsychedelia
subGameJumpMapLoPtr .BYTE $00,$00,$88,$10,$00,$00
subGameJumpMapHiPtr .BYTE $AB,$60,$42,$08,$A0,$78
;---------------------------------------------------------------------------------
; Game 3: the Activation of Iridis Base
;
; You are sitting on the back of this Mutant Camel, see, riding towards Iridis
; Base and attempting to activate it by displaying a carefully-vectored trail of
; phosphenes. Very simple, basically. Watch the Vector Indicator. The 9 pixels
; represent the 8 joystick directions and the FIRE button in the middle. The
; Indicator feeds you a vector, and you must respond with your joystick as fast
; as you can react. Your reaction time is measured and points awarded for being
; quick. Each time you're too slow, you lose a phosphene from the trail. If you
; lose all six you must do the sequence again. You have to do 100-step sequences;
; for each phosphene you bring through to the end of the sequence, you get one
; layer of the pyramid illuminated. When all levels are done you get your
; completion icon and the pyramid lights up.
;
; Learn to recognize some of the pre-set sequences that crop up. Some are pure
; random but some are stored sequences. Watch the trail of spheres; when it gets
; close to you you'll need to press FIRE with your next vector. Actually, the
; game can be played watching only the vector indicator, but you'll find that
; watching the spheres helps you anticipate certain actions.
;
; Design Notes: This is probably the most abstract of all the phases. I was
; originally thinking of doing a shoot-em-up using the spheres as bullets and
; firing them off into the distance, but by chance I was playing with the spheres
; one day and I strung 'em all out like they are, and the trail effect was so
; zarjaz I just wrote the rest of the game around it. It's very pretty, the same
; kind of appeal as those kites with long tails I suppose. Very much a pure
; reaction-time game, but quite effective nonetheless.
;---------------------------------------------------------------------------------
.include "iridisbase.asm"
.include "somedata1.asm"
;---------------------------------------------------------------------------------
; Game 2. AMC II
;
; I'm sure this will need no introduction. Attack the dromedroids with your
; ship's bullets. Repeated hits on the camels weaken and eventually destroy them
; (strength being shown by the colour of each camel on the scanner). Hits on your
; ship by camel's bullets, or by flying into the camels, reduce your shields. You
; can get by a camel's legs if you fly low. The camels march towards the right
; hand side of the scanner. If they reach it they are 'taken up' and an extra
; beast is added to the number remaining.
;
; Your objective is to destroy all the dromedroids within the level, then warp to
; the next level. You get one quarter of the completion icon following a
; successful warp, but only if you cleared all the camels. (You can warp at any
; time, even with loads of camels left). Thus, you must clear 4 different levels
; to get the whole Icon. (To warp, just keep accelerating). If you run out of
; shields, you are chucked down one level. The camel's bullets can be pretty
; devious. Watch out for those ones which stop and start. The higher the level
; you're on the more points you'll get for each camel.
;
; Design Notes: Well, I'd often wanted to update AMC on the 64 but couldn't
; really justify it on its own. Putting it in as a subgame seemed like the
; perfect solution. Still a good blast after all these years...
;---------------------------------------------------------------------------------
.include "amcII.asm"
;---------------------------------------------------------------------------------
; Game 6: Psychedelia
;
; Well I was going to put a PAUSE mode in, but this is much better. When you need
; to, drop into SUB6 and relax. The timer stops and you can stay in the subgame
; until you've got your head together enough to play on. The controls are a
; subset of real PSYCHEDELIA, allowing S=symmetry change and C=cursor speed. You
; can also use F1 and SHIFT-F1 to change fore- and background colours.
;
; Design Notes: Well it's more interesting than freezing the screen.
;---------------------------------------------------------------------------------
.include "psychedelia.asm"
.include "somekindofio.asm"
.include "somedata2.asm"
;---------------------------------------------------------------------------------
; Sprites for Hallucinobomblets
;---------------------------------------------------------------------------------
.include "hallucinobomblet_sprites.asm"
;---------------------------------------------------------------------------------
; Game 5: Syncro II
;
; Here you see spheres bouncing about over a grid of coloured squares. By moving
; the joystick you can select any square you like. (The selected square is
; bracketed by flashing grey). If you press the button and move the stick, the
; selected square can be made to 'rotate'. All squares of the selected colour
; assume such rotation.
;
; The objective is to make all the spheres on the grid stop dead. The spheres'
; velocities are modified by the rotation of any square they pass over. Thus, to
; halt a sphere, you cause it to pass over a square you've set up with a velocity
; exactly opposite to that of the sphere.
;
; Halted spheres stay halted a finite length of time; eventually they drift, so
; don't hang about. Once all spheres are stopped, you get a bonus and go to the
; next level. Completing all 8 levels gives you the whole completion icon. On
; later levels you encounter invisible squares, too. These may be used just like
; normal ones, just that you can't see them!
;
; Design Notes: This is a development of the idea behind SYNCRO, which was
; published in Commodore Horizons last year. They asked me to do another game, so
; I thought I'd do a SYNCRO derivative, and include it in BATALYX as a subgame
; having given it more levels. What I like most about it is the weird music. You
; can play with it for ages, it's a bit like Psychedelia-with-notes.
;---------------------------------------------------------------------------------
fA001 =*+$01
JumpToLaunchSyncro
JMP LaunchSyncro
.include "syncroII.asm"
;---------------------------------------------------------------------------------
; Game 1: Hallucin-O-Bomblets
;
; You control a little robot droid attacking the Hallu... ok let's call 'em aliens then.
; You fire by leaning the stick in the direction you want to fire. Thanks to Newton, your
; ship is thrust in the opposite direction to bullets you fire. Thus you steer your ship
; by carefully firing in the direction you don't want to go whilst simultaneously trying
; to blap the aliens with your bullets.
;
; Design Notes: I'd had the idea of the ship and bullets-as-reaction-mass for
; ages and this seemed like a good opportunity to try it. The control seems weird
; at first but you soon get the hang. Sort of like a weird Asteroids I suppose. I
; thought I could do some nice trad-Minter multi-wave-wacky sprites here too, and
; the bits flying off are simple but effective. Unlimited lives here - as indeed
; throughout the game. I wanted to take some of the frustration out of learning.
; I do like the sonics though, the 'doomff' when you shoot one and the jangling
; crash when you get hit.
;---------------------------------------------------------------------------------
JumpToLaunchHallucinOBomblets
JMP LaunchHallucinOBomblets
.include "hallucinobomblets.asm"
;---------------------------------------------------------------------------------
; TitleScreenLoop
;---------------------------------------------------------------------------------
TitleScreenLoop
JMP TitleScreenLoopImpl
selectedLevel .BYTE $00
TitleScreenLoopImpl
LDA $D011 ;VIC Control Register 1
ORA #$0B
AND #$7B
STA $D011 ;VIC Control Register 1
TS_Loop1
SEI
LDA #$00
STA aC2EA
JSR AnimateScreenDissolve
JSR InitializeRasterJumpTableForTitleScreen
JSR ClearTopOfScreen
CLI
JSR DrawTitleScreen
TS_Loop2
LDA aC2EA
CMP #$02
BNE bC02E
LDX #$F8
TXS
JMP TS_Loop1
bC02E JSR CheckTitleScreenInput
JMP TS_Loop2
;---------------------------------------------------------------------------------
; InitializeRasterJumpTableForTitleScreen
;---------------------------------------------------------------------------------
InitializeRasterJumpTableForTitleScreen
LDX #$00
bC036 LDA titleScreenRasterPosArray,X
STA rasterPositionArray,X
LDA titleScreenRasterJumpTableLoPtrs,X
STA rasterJumpTableLoPtrArray,X
LDA titleScreenRasterJumpTableHiPtrs,X
STA rasterJumpTableHiPtrArray,X
INX
CPX #$02
BNE bC036
JMP UpdateHighestScoreForCurrentLevelIfRequired
titleScreenRasterPosArray .BYTE $E0,$FF,$FF
; Jump table pointing initially to SwitchScreen ($C055)
titleScreenRasterJumpTableLoPtrs .BYTE $55,$55
;----------------------------------------------------------------
; SwitchScreen
;----------------------------------------------------------------
SwitchScreen
JSR $FF9F ;- scan keyboard
JSR SwitchBetweenTitleScreenAndZarjazPoster
JMP JumpToIncrementAndUpdateRaster
;---------------------------------------------------------------------------------
; AnimateScreenDissolve
;---------------------------------------------------------------------------------
AnimateScreenDissolve
SEI
LDA #>SCREEN_RAM + $0000
STA tempHiPtr1
LDA #<SCREEN_RAM + $0000
STA tempLoPtr1
JSR ResetRasterJumpTable
LDA #$00
STA $D015 ;Sprite display Enable
LDA #$00
STA $D020 ;Border Color
STA $D021 ;Background Color 0
STA $D017 ;Sprites Expand 2x Vertical (Y)
STA $D01C ;Sprites Multi-Color Mode Select
STA $D01D ;Sprites Expand 2x Horizontal (X)
LDA #$08
STA $D404 ;Voice 1: Control Register
STA $D40B ;Voice 2: Control Register
STA $D412 ;Voice 3: Control Register
LDA $D016 ;VIC Control Register 2
AND #$E8
ORA #$08
STA $D016 ;VIC Control Register 2
LDY #$00
bC097 JSR PutRandomByteInAccumulator
AND #$07
TAX
LDA #$42
STA (tempLoPtr1),Y
LDA tempHiPtr1
PHA
CLC
ADC #$D4
STA tempHiPtr1
LDA f40FB,X
STA (tempLoPtr1),Y
PLA
STA tempHiPtr1
INC tempLoPtr1
BNE bC0B7
INC tempHiPtr1
bC0B7 LDA tempHiPtr1
CMP #$06
BNE bC097
LDA tempLoPtr1
CMP #$F8
BNE bC097
JMP DrawColorsForAnimatedScreenDissolve
;---------------------------------------------------------------------------------
; PutRandomByteInAccumulator
;---------------------------------------------------------------------------------
PutRandomByteInAccumulator
aC0C7 =*+$01
LDA $EEF8
INC aC0C7
RTS
;---------------------------------------------------------------------------------
; DrawColorsForAnimatedScreenDissolve
;---------------------------------------------------------------------------------
DrawColorsForAnimatedScreenDissolve
LDA #$07
STA aC118
bC0D2 LDA #>COLOR_RAM + $0000
STA tempHiPtr1
LDA #<COLOR_RAM + $0000
STA tempLoPtr1
LDY #$00
bC0DC LDA (tempLoPtr1),Y
AND #$0F
LDX #$00
bC0E2 CMP f40FA,X
BEQ bC0EC
INX
CPX #$08
BNE bC0E2
bC0EC CPX #$00
BEQ bC0F6
DEX
LDA f40FA,X
STA (tempLoPtr1),Y
bC0F6 INC tempLoPtr1
BNE bC0FC
INC tempHiPtr1
bC0FC LDA tempHiPtr1
CMP #$DA
BNE bC0DC
LDA tempLoPtr1
CMP #$F8
BNE bC0DC
LDX #$08
LDY #$00
bC10C DEY
BNE bC10C
DEX
BNE bC10C
DEC aC118
BNE bC0D2
RTS
aC118 .BYTE $00
;---------------------------------------------------------------------------------
; ClearTopOfScreen
;---------------------------------------------------------------------------------
ClearTopOfScreen
LDX #$00
bC11B LDA #$20
STA SCREEN_RAM + $0000,X
STA SCREEN_RAM + $0100,X
STA SCREEN_RAM + $01F8,X
LDA #$0C
STA COLOR_RAM + $0000,X
STA COLOR_RAM + $0100,X
STA COLOR_RAM + $01F8,X
DEX
BNE bC11B
JSR UpdateStroboscopeSpriteColors
LDA #$08
STA aC2E8
RTS
;---------------------------------------------------------------------------------
; DrawTitleScreen
;---------------------------------------------------------------------------------
DrawTitleScreen
LDX #$00
bC13F LDA fC165,X
AND #$3F
STA SCREEN_RAM + $0140,X
LDA fC18D,X
AND #$3F
STA SCREEN_RAM + $0190,X
LDA fC1B5,X
AND #$3F
STA SCREEN_RAM + $01E0,X
INX
CPX #$28
BNE bC13F
JSR UpdateDisplayedLevel
JSR UpdateStroboscopeDisplay
JMP DrawCredits
fC165 .TEXT " PRESS KEYS 1-6 TO ACTIVATE SUBGAMES.. "
fC18D .TEXT " PRESS F1 FOR LEVEL: CURRENT LEVEL 1 "
fC1B5 .TEXT " PRESS F3 FOR STROBOSCOPICS: NOW ON "
;---------------------------------------------------------------------------------
; CheckTitleScreenInput
;---------------------------------------------------------------------------------
CheckTitleScreenInput
LDA currentPressedKey
CMP #$40