-
Notifications
You must be signed in to change notification settings - Fork 0
/
birdsk2.asm
3844 lines (3138 loc) · 116 KB
/
birdsk2.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
\ Build directives
ORIGINAL = TRUE \ Build an exact copy of the original. False overrides the tamper protection / default high score holder
FIX = FALSE \ Needs ORIGINAL = FALSE. Use 'spare' space at $1B11 for the fix
PRESERVE = TRUE \ Not currently used. Preserve original memory locations where possible when ORIGINAL = FALSE
\ Does not apply globally, eg if FIX = TRUE or ENCHTS = TRUE
ENRELO = FALSE \ Enable relocation (not working yet)
ENCHTS = FALSE \ Requires FIX = TRUE. Enable some PoC modifications.
MAX_1A09 = $10 \ Limit how high L1A09 can get.
\ >= $19 will cause glitches.
\ <= $06 will affect game difficulty (no. of simultaneous enemy bombs)
\ $10 seems safe.
TEST = FALSE \ Used for code-relocatability testing
\ ToDo: check references to $28D6/7 (player sprite pointer), $2D7C/D and $78/79 for fixed addressing (L2BB0)
\ L2d68 as well
\ 75/76 (&2D13)
\ 7A/7B (&2E00)
\ 88
\ Check memory writes 261A - 26AF
\ Possible SMC locations to investigate:
\ L17A0
\ L17AC
\ L18F5
\ L18F6
\ L240F - Pigeon sprite pointer - changes for L-R / R-L flyer
\ L246C - Pigeon start position?
\ L252F - Pigeon end position?
\ L266F - Screen memory addresses for cloud plotting
\ L2670 - Screen memory addresses for cloud plotting
\ L2672 - Screen memory addresses for cloud plotting
\ L2673 - Screen memory addresses for cloud plotting
\ L28D6 - Player sprite / hit / skull
\ L28D7 - Player sprite / hit / skull
\ L2C1E - Number of 8x8 sprites to plot? 3F (64 bytes for planes?)
\ L2D03 - variable SBC for something
\ Check what updates L008A
\ Check possible SMC @ L2C1E
\ BirdSk2.bin
L0000 = $0000 \ Zero Page uses - original labels below where discovered
L0008 = $0008
L0009 = $0009
L000A = $000A
L000B = $000B
L005D = $005D \ possible an artefact
L0070 = $0070 \ no
L0071 = $0071 \ bfg
L0072 = $0072 \ pflg
L0073 = $0073 \ bofg
L0074 = $0074 \ mod
L0075 = $0075 \ pls
L0076 = $0076 \ pls+1
L0077 = $0077 \ exp
L0078 = $0078 \ pos
L0079 = $0079 \ pos+1
L007A = $007A \ psta \ Bullet X coordinate?
L007B = $007B
L007C = $007C \ py / ra1 ($.OLDSRCE)
L007D = $007D \ ra1
L007E = $007E \ Only used in .L25B8
L007F = $007F \ Only used in .L25B8
L0080 = $0080 \ sd Score screen memory location low byte sd
L0081 = $0081 \ sd+1 Score screen memory location high byte sd+1
L0082 = $0082 \ sf Sprite pointer low byte (digits, notes, pigeons etc) sf
L0083 = $0083 \ sf+1 Sprite pointer high byte sf+1
L0084 = $0084 \ st \ Something to do with enemy position / plotting
L0085 = $0085 \ st+1 \ Something to do with enemy position / plotting
L0086 = $0086 \ gunp
L0087 = $0087 \ gunp+1
enemySpriteAddrLow = $0088 \ plf \ L0088 \ Enemy sprite address low byte (0 = level 1 aircraft, add $40 per level)
enemySpriteAddrHigh = $0089 \ plf+1 \ L0089 \ Enemy sprite address high byte
L008A = $008A \ bulst Enemy X coordinate?
L008B = $008B \ bulst+1
L008C = $008C \ bost \ Something to do with enemy bomb y-position - bomb stack?
L008D = $008D \ bost+1 \ bomb stack hi
L008E = $008E \ cnt
BYTEvA = $020A \ BYTEvA
BYTEvB = $020B \ BYTEvB
osword_redirection_C = $020C
osword_redirection_D = $020D
WRCHvA = $020E \ WRCH vector A
WRCHvB = $020F \ WRCH vector B
EVNTvA = $0220 \ EVNT vector A
EVNTvB = $0221 \ EVNT vector B
L02FC = $02FC \ picn \ Busy buffer flag
L3527 = $3527 \ Screen memory locations
L3528 = $3528
L3529 = $3529
L352A = $352A
L4180 = $4180
L4900 = $4900
LFE4D = $FE4D \ Interrupt Flag Register
LFE4E = $FE4E \ Interrupt Enable Register
vector_table_low_byte = $FFB7 \ Vector table address low byte
vector_table_high_byte = $FFB8 \ Vector table address high byte
osasci = $FFE3 \ OSASCI
oswrch = $FFEE \ OSWRCH
osword = $FFF1 \ OSWORD
osbyte = $FFF4 \ OSBYTE
org $1200 \ "P%" as per the available disc binary
\\\\\\ 1200 - 13FF probably added by the original cracker to restore vectors used by
\\\\\\ loading music and restore ZPG data prior to launching the game code.
\\\\\\
\\\\\\ This was handled in the tape version by the decryption routine.
\\\\\\
\\\\\\ The reason for the table below and the loop to copy it to ZPG is unknown.
\\\\\\ Possibly scatter-gun approach to making it work as the cracker knew something
\\\\\\ in ZPG was critical for the game to start. Seems to be $5C-$5F must equal 1.
\\\\\\
\\\\\\ Note - if the memory of the decrypted tape version (&1400-&2FFF) is saved, the
\\\\\\ game can be run by *LOADing it at 1400, setting $5C-$5F to 1 and CALLing &1E00
.p0data \ L1200
\ First 160 bytes of code get copied to page 0 by p0copyloop
\ These addresses are normally used by BASIC and Econet
\ Possibly a memory lookup table in the main for zero page addressing
\ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
EQUB $02,$19,$02,$19,$00,$7C,$00,$7C, $72,$E7,$01,$00,$07,$32,$83,$98 \ 00
EQUB $80,$77,$02,$19,$0A,$00,$43,$B4, $19,$00,$07,$00,$00,$19,$00,$00 \ 10
EQUB $00,$FF,$FF,$FF,$00,$00,$00,$40, $FF,$FF,$00,$35,$00,$00,$00,$00 \ 20
EQUB $8F,$00,$00,$00,$00,$00,$28,$00, $07,$EE,$20,$00,$FF,$00,$00,$7F \ 30 $2800 - castle tower
EQUB $FE,$00,$FE,$7E,$00,$00,$00,$00, $00,$00,$40,$08,$05,$FF,$09,$00 \ 40
EQUB $00,$00,$00,$00,$00,$00,$00,$00, $00,$00,$9F,$1D,$01,$01,$01,$01 \ 50
EQUB $79,$14,$72,$D4,$06,$00,$00,$00, $40,$00,$40,$00,$00,$00,$00,$00 \ 60
EQUB $00,$37,$D0,$37,$20,$39,$02,$00 \ 70
EQUW L2E00 \ 70
EQUB $00,$6E,$00,$02,$1B,$AA \ 70 $2E00 - clouds etc
EQUB $00,$34 \ 80
EQUW L1C00 \ 80
EQUB $EF,$80,$98,$7E, $A5,$64 \ 80
EQUW L208D
EQUB $01,$A5,$65,$8D \ 80
EQUB $21,$01,$C9,$07,$F0,$03,$6C,$64, $00,$60,$04,$01,$FF,$FF,$FF,$00 \ 90
\ Then follows 96 bytes of padding
FOR Z, 1, 96
EQUB $00
NEXT
.entry \ L1300
\ Un-official code entry point. Restores vectors used by game-loading tune routines.
SEI \ Disable interrupts
LDA L3527 \ Restore vectors
STA WRCHvA
LDA L3528
STA WRCHvB
LDA L3529
STA EVNTvA
LDA L352A
STA EVNTvB
CLI \ Enable interrupts
LDA #$0D
LDX #$00
JSR osbyte \ Disable output buffer empty event
LDA #$0D
LDX #$06
JSR osbyte \ Disable ESCAPE pressed event
LDA #$0F
LDX #$00
JSR osbyte \ Flush all buffers
SEI \ Disable interrupts
LDA BYTEvA \ Vector stuff...
STA L0008
LDA BYTEvB
STA L0009
LDA vector_table_low_byte
STA L000A
LDA vector_table_high_byte
STA L000B
LDY #$0A
LDA (L000A),Y
STA BYTEvA
INY
LDA (L000A),Y
STA BYTEvB
LDA #$C8
LDX #$03
LDY #$00
JSR osbyte \ Disable escape, clear memory on break
CLI \ Enable interrupts
LDA #$7C
JSR osbyte \ Clear Esc condition
LDA L0008
STA BYTEvA
LDA L0009
STA BYTEvB
LDX #$00
.p0copyloop \ L136C
\ Copy 160 bytes at &1200 to page zero.
LDA p0data,X
STA L0000,X
INX
CPX #$A0
BNE p0copyloop
LDA #$8C
LDX #$0C
JSR osbyte \ Set TAPE filing system and baud rate (X)
JMP game
\ Then follows 128 bytes of padding
FOR Z, 1, 128
EQUB $00
NEXT
.L1400
\ Thanks and credits
EQUS "Thanks David,Ian,Martin,Mum,Dad,Susi C"
.keyCheck \ .opt \ Main keyboard scan during gameplay .L1426
LDX #$EF \ Q key
JSR keyboardScan \ key
BNE checkSkey \ op1 \ Skip if pressed
LDA #LO(L1461) \ (mute MOD 256) \ #$61
STA osword_redirection_C \ &20C \ Mess with vectors to disable sounds
LDA #HI(L1461) \ (mute DIV 256) \ #$14
STA osword_redirection_D \ &20D \ Mess with vectors to disable sounds
.checkSkey \ .op1 \ .L1437
LDX #$AE \ S key
JSR keyboardScan \ key
BNE checkRkey \ op2 \ Skip if pressed
LDA wordv_1 \ soun
STA osword_redirection_C \ &20C \ Restore default vectors to enable sounds
LDA wordv_2 \ soun+1
STA osword_redirection_D \ &20D \ Restore default vectors to enable sounds
.checkRkey \.op2 \ .L144A
LDX #$CC
JSR keyboardScan \ key \ R key
BNE keyCheckComplete \ op5
.debounceRkey \ .op3 \ .L1451 \ De-bounce for R keypress?
LDA #$81
LDY #$01
LDX #$00
JSR osbyte \ Read key with timeout
BCS debounceRkey \ op3 \ No key detected
CPX #$52 \ INKEY value of R
BEQ debounceRkey \ op3
.keyCheckComplete \.op5 \.L1460
RTS
.L1461 \ .mute \ Disable sounds - Address used by .keyCheck (osword_redirection_C/D)
CMP #$07
BEQ keyCheckComplete \ op5
JMP (wordv_1) \ (soun)
.wordv_1 \ soun \ OSWORD redirection vector stored here \L1468
EQUB $EB
.wordv_2 \ OSWORD redirection vector stored here \L1469
EQUB $E7
.L146A \ .nlr \ Move enemy / check left bound
LDA L149B \ tog
BEQ L1490 \ enlr
LDA L0077 \ exp
BPL L1483 \ rt
DEC L007A \ psta
SEC
LDA L0078 \ pos
SBC #$08
STA L0078 \ pos
BCS L1490 \ enlr
DEC L0079 \ pos+1
JMP L1490 \ enlr
.L1483 \ .rt
\ Check right bound
INC L007A \ psta
CLC
LDA L0078 \ pos
ADC #$08
STA L0078 \ pos
BCC L1490 \ enlr
INC L0079 \ pos+1
.L1490 \ .enlr \ Enemy left-right zigzag
LDA #$01 \ 0 = vertical descent
EOR L149B \ tog
STA L149B \ tog
JMP L2BE1 \ (no label)
.L149B \ .tog
EQUB $00 \ enemy zig-zag state?
.L149C \ .fpat
\ Triggered when bullet fired
LDA L14AD \ fp0
BEQ L14A5 \ fp1
DEC L14AD \ fp0
RTS
.L14A5 \ .fp1
\ Player bullet fired
LDA #$12 \ 2nd bullet fire delay?
STA L14AD \ fp0
JMP L297D \ this (or another L297D) may upset the disassembly. Jury's out.
.L14AD \ .fp0
EQUB $00
.gameOver \ .gov \ Display Game Over message \ L14AE
PLA
PLA
LDY #$FF
.gameOverLoop \ .gov1 \ L14B2
INY
LDA #$0A
JSR L208D \ delay
LDA gameOverText,Y \ gov2,Y \ Load chr at gameOverText (L14CA), offset Y
JSR oswrch \ Print it
CMP #$52 \ Loop untl the "R" of "OVER"
BNE gameOverLoop \ gov1
LDA #$96
JSR L208D \ delay
JMP L1E21 \ newgame (original $.S)
.gameOverText \ .gov2
\ GAME OVER message \ L14CA
EQUB $1F,$05,$0F,$11,$01 \ Red text, centred on screen
EQUS "GAME OVER"
.L14D8 \ .stp4 Enemy has reached bottom of the screen
RTS
.L14D9 \ .stp6
LDA timer_L1D55 \ gex
BEQ L14D8 \ stp4
LDA L007A \ psta
EOR #$80
STA L007A \ psta
INC L0077 \ exp \ 'bug' noted in $.S and C.SOURCE
PLA
PLA
JMP L2BE4 \ fo+3 / F%+3
.L14EB \ .exg
LDA #$01
BIT L151A \ exg3
BNE L1502 \ exg1
LDY score_high_byte \ sc+2
CPY #$05 \ Extra life at 5000?
BMI L1519 \ exg2
ORA L151A \ exg3
STA L151A \ exg3
JSR L151B \ exg4
.L1502 \ .exg1
LDA #$02
BIT L151A \ exg3
BNE L1519 \ exg2
LDY score_high_byte \ sc+2
CPY #$10
BMI L1519 \ exg2
ORA L151A \ exg3
STA L151A \ exg3
JMP L151B \ exg4
.L1519 \ .exg2
RTS
.L151A \ .exg3
EQUB $00
.L151B \ .exg4
JSR L2223 \ mini
LDA #$DC
STA L2DFC \ (no label in sources)
LDX #$F8
LDY #$2D
LDA #$07
JSR osword \ Play a sound (extra life)
INC L1D56 \ gex+1
CLC
LDA L1D57 \ gex+2
ADC #$18
STA L1D57 \ gex+2
BCC L153D \ exg5
INC L1D58 \ gex+3
.L153D \ .exg5
RTS
.L153E \ .bon \ Bonus?
LDA level \ fc
AND #$03
BNE L1550 \ bon0
LDA #$0F
JSR L208D \ delay
JSR vduCalls \ stmv
JMP L1556 \ bon11
.L1550 \ .bon0
JSR L20B1 \ cht
JSR playTune \ tune
.L1556 \ .bon11
JSR L159E \ wbmsg
LDY #$4B
.L155B \ .bon1
SED
CLC
LDA score_low_byte \ sc+1
ADC #$02
STA score_low_byte \ sc+1
LDA score_high_byte \ sc+2
ADC #$00
STA score_high_byte \ sc+2
CLD
LDA #$02
JSR L208D \ delay
TYA
PHA
LDX #$E8
LDY #$2D
LDA #$07
JSR osword \ Play a sound (bonus noise)
JSR L2054 \ s7
PLA
TAY
DEY
BNE L155B \ bon1
INC L15B7 \ bsou
LDX #$B7 \ (bsou AND 255) \ TODO: Implement this
LDY #$15 \ (bsou DIV 256) \ TODO: Implement this
LDA #$07
JSR osword \ Play a sound (last pip of bonus noise)
DEC L15B7 \ bsou
LDA #$80
ORA gameFlags \ sc
STA gameFlags \ sc
RTS
.L159E \ .wbmsg
\ Display bonus text
LDY #$00
.L15A0 \ .wb1
LDA bonusText,Y \ bmsg,Y
JSR oswrch
INY
CPY #$0B
BNE L15A0
RTS
.bonusText \ .bmsg \ L15AC
\ BONUS! message
EQUB $11,$06,$1F,$07,$0F \ Cyan text, centred
EQUS "BONUS!"
.L15B7 \ .bsou
\ Something to do with the bonus routine
EQUB $12 \ (just this byte, the rest is padding?)
EQUB $00,$FF,$FF,$00,$00,$00,$00
EQUB $FF
\\\\\\ C.SOURCE PART 2 ENDS HERE //////
\\\\\\ HSRTS STARTS HERE //////
.L15C0 \ .nbk
EQUB $B4,$16,$08,$20,$7F
.L15C5 \ .hs
EQUB $00
.L15C6
EQUB $00
.L15C7 \ .hs+2
EQUB $02
.titleScreen \ .m7 \ L15C8
\ MODE 7 Title Screen
EQUB $16,$07,$17,$00,$0A,$20,$00,$00
EQUB $00,$00,$00,$00
.L15D4 \ .bsk
EQUB $9A,$94,$68,$3F
EQUB $6F,$34,$20,$20,$20,$20,$20,$20
EQUB $20,$20,$FF,$20,$20,$5F,$7E,$2F
EQUB $6D,$20,$78,$20,$20,$20,$20,$20
EQUB $20,$20,$7E,$0D,$9A,$96,$6A,$7D
EQUB $7E,$25,$20,$2F,$20,$30,$20,$20
EQUB $20,$20,$FF,$20,$20,$6A,$7D,$70
EQUB $30,$20,$FF,$2C,$20,$30,$20,$20
EQUB $2F,$20,$FF,$5F,$3E,$0D,$9A,$94
EQUB $6A,$3F,$60,$6F,$34,$FF,$20,$FF
EQUB $2F,$21,$78,$2F,$FF,$20,$20,$20
EQUB $60,$60,$FF,$20,$FF,$20,$20,$FF
EQUB $2F,$21,$FF,$20,$FF,$6F,$30,$20
EQUB $7E,$7B,$34,$0D,$9A,$96,$2A,$7D
EQUB $70,$7E,$25,$6F,$30,$FF,$20,$20
EQUB $6F,$7C,$3F,$20,$20,$2A,$7C,$7E
EQUB $27,$20,$6F,$74,$30,$FF,$20,$20
EQUB $6F,$30,$FF,$20,$2B,$34,$6D,$78
EQUB $24,$1F,$05,$05,$82 \ ?, [, [no cursor], [green]
EQUS "FIREBIRD (c) Andrew Frigaard"
EQUB $0D,$1F,$0B,$08,$8D,$83
EQUS "High Score"
EQUB $1F,$0B,$09,$8D,$83
EQUS "High Score"
.highScoreDots \ .dts \ L16A0
\ High score display
EQUB $1F,$0B,$0B \ Move text cursor
EQUS "............."
EQUB $00
EQUB $1F,$19,$0B \ Move text cursor
.keysText \ .nam \ L16B4
IF ORIGINAL = TRUE
EQUS "andrew " \ original high score holder
ELSE
EQUS "iainfm " \ Credit for my fix :D
ENDIF
EQUB $00
.L16BD \ .ints
EQUB $1F,$0E,$0E \ Move text cursor
EQUB $8D,$83 \ Double-height / yellow
EQUS "Keys" \ Double height line 1
EQUB $1F,$0E,$0F \ Move text cursor
EQUB $8D,$83 \ Double-height / yellow
EQUS "Keys" \ Double height line 2
EQUB $1F,$06,$11 \ Move text cursor
EQUB $86 \ Cyan
EQUS "Z ............ move left"
EQUB $1F,$06,$12 \ Move text cursor
EQUB $86 \ Cyan
EQUS "X ........... move right"
EQUB $1F,$06,$13 \ Move text cursor
EQUB $86 \ Cyan
EQUS "RETURN ........... shoot"
EQUB $1F,$06,$14 \ Move text cursor
EQUB $86 \ Cyan
EQUS "S/Q ....... sound on/off"
EQUB $1F,$06,$15 \ Move text cursor
EQUB $86 \ Cyan
EQUS "R ................. rest"
EQUB $00
.L175C \ .sps
EQUB $1F,$07,$18 \ Move text cursor
EQUB $81,$88 \ Red / flash
EQUS "Press space to play."
EQUB $00,$00,$00
\\\\\\ Start of 2nd PART $.S and C.SOURCE //////
.vduCalls \ .stmv \ L1778
\ Call the VDU commands at vduCallsTable in reverse order
LDY #$0A
.vduLoop \ .stm4 \ L177A
LDA vduCallsTable,Y \ stm10,Y
JSR oswrch
DEY
BPL vduLoop \ stm4
LDA #$80
STA L17A0 \ stm2+1 \ SMC
LDA #$00
STA L17AC \ stm3+1 \ SMC
LDA #$04
STA L0070 \ no
.L1791 \ .stm1
LDA #$1D
JSR oswrch
LDA #$00
JSR oswrch
JSR oswrch
SEC
.L179F \ .stm2
LDA #$00
L17A0 = L179F+1 \ SMC
SBC #$80
STA L17A0 \ stm2+1
PHP
JSR oswrch
PLP
.L17AB \ .stm3
LDA #$00
L17AC = L17AB+1 \ SMC
SBC #$00
STA L17AC \ stm3+1
JSR oswrch
JSR drawStave \ stv
DEC L0070 \ no
BNE L1791 \ stm1
\ .stm5 (&17BC)
LDA level \ fc
STA L1A08 \ tm
LDA #$00
STA level \ fc
LDA #$26 \ Possible memory address - purpose unknown
STA L1A0C \ tm+4
LDA #$88 \ Possible memory address - purpose unknown
STA L1A0B \ tm+3
.L17D1 \ .stm6
CLC
LDA L1A0B \ tm+3
STA L1D59 \ not
LDA L1A0C \ tm+4
ADC #$0A
STA L1A0C \ tm+4
STA L1D5A \ not+1
JSR L20B1 \ cht
STX L2382 \ nl
INC level \ fc
.L17EC \ .stm8
JSR L20DE \ nxno
BNE L17EC \ stm8
JSR L20B1 \ cht
JSR playTune \ tune
LDA #$3C
JSR L208D \ delay
LDA level \ fc
CMP #$04
BNE L17D1 \ stm6
LDA L1A08 \ tm
STA level \ fc
LDA #$1A
JMP oswrch \ Restore default windows and then RTS
.vduCallsTable \ .stm10 \ VDU calls \ L180E - executed top-to-bottom
EQUB $10 \ Clear graphics area
EQUB $03 \
EQUB $FF \
EQUB $04 \
EQUB $0F \
EQUB $02 \
EQUB $0F \
EQUB $00 \
EQUB $F0 \
EQUB $18 \ Define graphics window
EQUB $1A \ Restore default windows
.L1819 \ .gend
LDA #$00
STA L15C5 \ hs
LDA score_high_byte \ sc+2
CMP L15C7 \ hs+2
BCC L183F \ ge1
BNE L1830 \ ge0
LDA score_low_byte \ sc+1
CMP L15C6 \ hs+1
BCC L183F \ ge1
.L1830 \ .ge0
LDA score_low_byte \ sc+1
STA L15C6 \ hs+1
LDA score_high_byte \ sc+2
STA L15C7 \ hs+2
DEC L15C5 \ hs
.L183F \ .ge1
LDA #$16
JSR oswrch
LDA #$07
JSR oswrch
LDX #LO(L15D4) \ (bsk AND 255) \ #$D4 self-modifying code
LDY #HI(L15D4) \ (bsk DIV 256) \ #$15 self-modifying code
JSR L18EB \ wrs
LDA #$1F
JSR oswrch
LDA #$05
JSR oswrch
LDA #$0B
JSR oswrch
LDA L15C7 \ hs+2
JSR L18D7 \ whs
LDA L15C6 \ hs+1
JSR L18D7 \ whs
LDA #$30
JSR oswrch
LDX #LO(highScoreDots) \ (dts AND 255) \ #$A0 self-modifying code
LDY #HI(highScoreDots) \ (dts DIV 256) \ #$16 self-modifying code
JSR L18EB \ wrs
LDX #LO(L16BD) \ (ints AND 255) \ #$BD self-modifying code
LDY #HI(L16BD) \ (ints DIV 256) \ #$16 self-modifying code
JSR L18EB \ wrs
LDA #$1F
JSR oswrch \ Move cursor to x,y
LDA #$1A \ Restore default windows
JSR oswrch
LDA #$0B
JSR oswrch \ Move cursor up one line
LDA L15C5 \ hs
BEQ L18A4 \ ge3
LDA #$15
LDX #$00
JSR osbyte \ Flush keyboard buffer
TXA
LDX #$C0 \ (nbk AND 255) \ TODO: implement this
LDY #$15 \ (nbk DIV 256) \ TODO: implement this
JSR osword \ Read line from input to memory, probably the name for the high score table
JMP L18B1 \ ge7
.L18A4 \ .ge3
LDY #$FF
.L18A6 \ .ge6
INY
LDA keysText,Y \ nam,Y \ read and
JSR osasci \ print high score text etc
CMP #$20
BPL L18A6 \ ge6
.L18B1 \ .ge7
LDY #$02
.L18B3 \ .ge5 \ Title screen loop
LDA titleScreen,Y \ m7,Y
JSR oswrch
INY
CPY #$0D
BNE L18B3 \ ge5
LDA #$64
JSR L208D \ delay
.L18C3 \ .space
LDA #$1A
JSR oswrch
LDX #LO(L175C) \ (sps AND 255) \ #$5C self-modifying code
LDY #HI(L175C) \ (sps DIV 256) \ #$17 self-modifying code
JSR L18EB \ wrs
.L18CF \ .ge4 \ Wait for spacebar to begin game
LDX #$9D \ Space bar
JSR keyboardScan \ key
BNE L18CF \ ge4
RTS
.L18D7 \ .whs
PHA
LSR A
LSR A
LSR A
LSR A
CLC
ADC #$30
JSR osasci
PLA
AND #$0F
CLC
ADC #$30
JMP osasci \ with implied RTS
.L18EB \ .wrs
STX L18F5 \ (wr1+2) \ naughtly self-modifying code
STY L18F6 \ (wr1+3) \ naughtly self-modifying code
LDY #$FF
.L18F3 \ .wr1
INY
.L18F4
LDA highScoreDots,Y \ dts,Y
L18F5 = L18F4+1 \ wr1+2 \ SMC?
L18F6 = L18F4+2 \ wr1+3 \ SMC?
JSR osasci \ Print the dots in the high score 'table'
CMP #$00
BNE L18F3 \ wr1
\\\\\ $.S / C.SOURCE has an RTS here / end of 2nd part //////
\\\\\ $.X starts here /////
PHA \ should
LDA L005D \ be
CMP #$01 \ graphics
BNE L1907 \ ?
PLA \ ?
RTS \ ?
.L1907
JMP L1907 \ ? \ Infinite loop alert
\ Table below seems to be offset by 2 (ie STA &3002 for correct alignment)
\ Sprite locations appear to match $.X
.L190A EQUB $00,$00,$05,$00,$00,$00 \ Yellow dot? Probably junk
.L1910 EQUB $00,$08,$08,$1C,$08,$08,$08,$00 \ Player lives
EQUB $28,$28,$28,$3E,$28,$28,$00,$00
EQUB $00,$08,$08,$08,$08,$08,$08,$00
.L1928 EQUB $00,$10,$10,$35,$35,$10,$10,$00 \ 'RAF' logo? Seems to be unused.
EQUB $30,$30,$3F,$03,$03,$3F,$30,$30
EQUB $00,$20,$20,$3A,$3A,$20,$20,$00
.L1940 EQUB $00,$00,$00,$05,$00,$00,$00,$00 \ Enemy explosion 1 (L)
EQUB $00,$00,$00,$00,$00,$00,$00,$00
EQUB $00,$00,$00,$00,$2A,$00,$00,$00
.L1958 EQUB $00,$00,$0A,$02,$15,$0A,$00,$00 \ Enemy explosion 1 (M)
EQUB $00,$00,$2A,$15,$00,$2A,$00,$00
EQUB $00,$00,$0A,$00,$02,$0A,$00,$00
.L1970 EQUB $00,$00,$00,$2A,$00,$00,$00,$00 \ Enemy explosion 1 (R)
EQUB $00,$00,$00,$00,$05,$00,$00,$00
EQUB $00,$00,$00,$00,$00,$00,$00,$00
.L1988 EQUB $1A,$05,$00,$C0,$05,$0A,$30,$05 \ Enemy explosion 2 (L)
EQUB $40,$00,$4A,$15,$00,$2A,$0F,$10
EQUB $00,$4A,$15,$00,$00,$48,$80,$20
.L19A0 EQUB $0A,$4A,$10,$00,$00,$40,$2A,$0A \ Enemy explosion 2 (R)
EQUB $10,$0A,$40,$15,$00,$2A,$85,$30
EQUB $80,$25,$0A,$40,$25,$90,$1A,$05
.L19B8 EQUB $0A,$00,$20,$40,$00,$0A,$00,$00 \ Enemy explosion 3 (L)
EQUB $00,$05,$00,$00,$00,$00,$00,$00
EQUB $00,$00,$00,$80,$00,$00,$08,$00
.L19D0 EQUB $00,$00,$00,$00,$00,$00,$00,$00 \ Enemy explosion 3 (M)
EQUB $0A,$00,$00,$00,$00,$00,$00,$40
EQUB $00,$00,$00,$00,$05,$00,$00,$00
.L19E8 EQUB $08,$00,$00,$00,$00,$00,$00,$00 \ Enemy explosion 3 (R)
EQUB $00,$00,$00,$00,$00,$00,$15,$08
EQUB $00,$80,$00,$00,$05,$00,$00,$00
.L1A00 EQUB $2A,$2A,$2A,$2A,$2A,$2A,$2A,$2A \ White vertical line (bullet)
.L1A08
EQUB $FF
.L1A09 \ .tm+1
EQUB $FF
.L1A0A
EQUB $FF
.L1A0B
EQUB $FF
.L1A0C
EQUB $FF,$FF,$FF,$FF
\ Life lost animation sprites
.L1A10 \ Label added by iainfm
EQUB $00,$04,$00,$04,$28,$04,$00,$04 \ Player hit 1
EQUB $00,$00,$00,$00,$28,$00,$00,$00
EQUB $28,$00,$28,$00,$28,$00,$00,$00
EQUB $00,$04,$00,$04,$28,$04,$00,$04
EQUB $00,$00,$00,$00,$28,$00,$00,$00
.L1A38 \ Label added by iainfm
EQUB $00,$00,$00,$00,$00,$00,$04,$2C \ Player hit 2
EQUB $00,$00,$00,$00,$00,$00,$14,$28
EQUB $00,$00,$00,$00,$00,$00,$14,$28
EQUB $00,$00,$00,$00,$00,$00,$04,$2C
EQUB $00,$00,$00,$00,$00,$00,$00,$28
.L1A60
EQUB $00,$00,$00,$00,$00,$40,$00,$40 \ Skull
EQUB $40,$80,$80,$40,$40,$40,$80,$00
EQUB $C0,$80,$80,$40,$C0,$40,$80,$00
EQUB $00,$80,$80,$00,$00,$40,$80,$40
.L1A80 EQUB $00,$00,$00,$00,$00,$00,$00,$00
.L1A88 EQUB $00,$00,$00,$14,$3C,$00,$00,$00 \ Pigeon L-R 1
EQUB $00,$00,$00,$3C,$3C,$34,$3C,$28
EQUB $00,$00,$3C,$2D,$22,$00,$00,$00
.L1AA0 EQUB $00,$00,$00,$14,$3C,$00,$14,$00 \ Pigeon L-R 2
EQUB $00,$00,$00,$3C,$3C,$34,$28,$00
EQUB $00,$00,$3C,$2D,$22,$00,$00,$00
.L1AB8 EQUB $00,$00,$00,$14,$3C,$00,$00,$00 \ Pigeon L-R 3
EQUB $00,$00,$00,$3C,$39,$00,$00,$00
EQUB $00,$00,$3C,$2D,$22,$00,$00,$00
.L1AD0 EQUB $00,$00,$00,$00,$14,$3C,$00,$00 \ Pigeon L-R 4
EQUB $00,$3C,$34,$3C,$39,$00,$00,$00
EQUB $00,$00,$3C,$2D,$22,$00,$00,$00
.L1AE8 EQUB $14,$00,$00,$00,$14,$3C,$00,$00 \ Pigeon L-R 5
EQUB $28,$3C,$34,$3C,$39,$00,$00,$00
EQUB $00,$00,$3C,$2D,$22,$00,$00,$00
.L1B00 EQUB $30,$24,$10,$13,$16,$19,$1C,$34
EQUB $41,$1F,$48,$48,$48,$48,$48,$48