forked from videogamepreservation/digdug-7800
-
Notifications
You must be signed in to change notification settings - Fork 1
/
DIGDUG.S
8862 lines (7805 loc) · 329 KB
/
DIGDUG.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
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
*******************************************************************************
*********** 3600 DIG DUG *************
*******************************************************************************
*******************************************************************************
; THE NECESSARY PROLOG FOR MARIA CODE
;*******************************************************************************
; STELLA (TIA) REGISTER ADDRESSES
; NOTE THESE REGISTERS ARE SHADOWED AT 0100 TO 011F
; 0200 TO 021F
; 0300 TO 031F
;*******************************************************************************
VBLANK EQU $01
AUDC0 EQU $15 ;BITS 3210 AUDIO CONTROL 0
AUDC1 EQU $16 ;BITS 3210 AUDIO CONTROL 1
AUDF0 EQU $17 ;BITS 3210 AUDIO FREQUENCY 0
AUDF1 EQU $18 ;BITS 3210 AUDIO FREQUENCY 1
AUDV0 EQU $19 ;BITS 3210 AUDIO VOLUME 0
AUDV1 EQU $1A ;BITS 3210 AUDIO VOLUME 1
INPT0 EQU $38
INPT1 EQU $39
INPT2 EQU $3A
INPT3 EQU $3B
INPT4 EQU $0C ;PLAYER 0 BUTTON CLEAR WHEN HIT
INPT5 EQU $0D ;PLAYER 1 BUTTON CLEAR WHEN HIT
;*******************************************************************************
; MARIA REGISTERS
; NOTE THESE REGISTERS ARE SHADOWED AT 0120 TO 013F
; 0220 TO 023F
; 0320 TO 033F
;*******************************************************************************
P0C0 EQU $20 ;BACKGROUND COLOR RW
; ALL PALETTE AND COLOR ARE HIGH NIBBLE COLOR, LOW NIBBLE LUMINANCE
P0C1 EQU $21 ;PALETTE ZERO COLOR ONE RW
P0C2 EQU $22 ;PALETTE ZERO COLOR TWO RW
P0C3 EQU $23 ;PALETTE ZERO COLOR THREE RW
WSYNC EQU $24 ;FAST MARIA WSYNC STROBE
P1C1 EQU $25 ;PALETTE ONE COLOR ONE RW
P1C2 EQU $26 ;PALETTE ONE COLOR TWO RW
P1C3 EQU $27 ;PALETTE ONE COLOR THREE RW
CTRLRD EQU $28 ;BIT 7 IN VBLANK, BIT 6 IN DISPLAY RO
P2C1 EQU $29 ;PALETTE TWO COLOR ONE RW
P2C2 EQU $2A ;PALETTE TWO COLOR TWO RW
P2C3 EQU $2B ;PALETTE TWO COLOR THREE RW
DPPH EQU $2C ;DISPLAY LIST POINTER HIGH WO
P3C1 EQU $2D ;PALETTE THREE COLOR ONE RW
P3C2 EQU $2E ;PALETTE THREE COLOR TWO RW
P3C3 EQU $2F ;PALETTE THREE COLOR THREE RW
DPPL EQU $30 ;DISPLAY LIST POINTER LOW WO
P4C1 EQU $31 ;PALETTE FOUR COLOR ONE RW
P4C2 EQU $32 ;PALETTE FOUR COLOR TWO RW
P4C3 EQU $33 ;PALETTE FOUR COLOR THREE RW
CHARBASE EQU $34 :CHARACTER MODE HIGH POINTER WO
P5C1 EQU $35 ;PALETTE FIVE COLOR ONE RW
P5C2 EQU $36 ;PALETTE FIVE COLOR TWO RW
P5C3 EQU $37 ;PALETTE FIVE COLOR THREE RW
OFFSET EQU $38 ;GRAPHICS HIGH POINTER OFFSET RW
P6C1 EQU $39 ;PALETTE SIX COLOR ONE RW
P6C2 EQU $3A ;PALETTE SIX COLOR TWO RW
P6C3 EQU $3B ;PALETTE SIX COLOR THREE RW
CTRL EQU $3C ;WRITE: (SEE BELOW FOR MORE INFO)
; CK DM1 DM0 CWIDTH BCNTL KM RM1 RM0
P7C1 EQU $3D ;PALETTE SEVEN COLOR ONE RW
P7C2 EQU $3E ;PALETTE SEVEN COLOR TWO RW
P7C3 EQU $3F ;PALETTE SEVEN COLOR THREE RW
*CTRL REGISTER: CK: COLOR KILL
* DMn: DMA MODE
* CWIDTH: CHAR MAP WIDTH
* BCNTL: BORDER CONTROL
* KM: KANGAROO MODE
* RMn: READ MODE
* DM1 DM0 MEANING:
* 0 0 TEST A "EOVB"
* 0 1 TEST B "STARTSCAN"
* 1 0 RUN NORMALLY
* 1 1 INACTIVE
;*******************************************************************************
; ZERO PAGE RAM 0040 TO 007F
; NOTE THIS RAM IS SHADOWED AT 2040 TO 207F
;*******************************************************************************
ORG $0040
STMPYPOS EQU $40 ;THESE ARE TOTLSTMP BYTES EACH: USED
STMPXPOS EQU $53 ; BY GENDPL TO GENERATE DISPLAY LIST.
STMPINDX EQU $66 ; ORDER OF STAMPS IS IN INCREASING
; PRIORITY.
DDYPOS EQU $40 ;DIGDUG.
DDXPOS EQU $53
DDINDX EQU $66
POOKAY EQU $41 ;4 POOKAS.
POOKAX EQU $54
POOKAIX EQU $67
FYGARY EQU $45 ;4 FYGARS.
FYGARX EQU $58
FYGARIX EQU $6B
ROCKSY EQU $49 ;5 ROCKS POSSIBLE.
ROCKSX EQU $5C
ROCKSIX EQU $6F
FLAMEY EQU $4E ;1 FLAME AT A TIME.
FLAMEX EQU $61
FLAMEIX EQU $74
PUMPY EQU $4F ;SHARED BY PUMP AND HARPOON.
PUMPX EQU $62
PUMPIX EQU $75
FRUITY EQU $52 ;FRUIT (ALIAS VEGGIES...).
FRUITX EQU $65
FRUITIX EQU $78
SNGPTR EQU $79
SNGPTR2 EQU $7A
PUMPIE EQU $7B
FLAMSIZE EQU $7C
FLAMNUM EQU $7D
* FOLLOWING 11 REGISTERS ARE INIT IN INIT. THEY MUST REMAIN ADJACENT
CURSONG EQU $7E ;CURRENT SONG.
SNGTEMP1 EQU $7F ;HIGHEST PRIORITY NOISE REQUEST
;*******************************************************************************
; ZERO PAGE RAM 0080 TO 00FF
; NOTE THIS RAM IS SHADOWED AT 2180 TO 21FF
;*******************************************************************************
ORG $0080
LASTMOVE EQU $80 ;LAST DIGDUG MOVEMENT.
DLSTPTR EQU $81 ;0,$40 FOR DLIST 0,1: USE VFLAG!
NUMPLAYR EQU $82 ;NUMBER OF PLAYERS (0 => 1, 1 => 2).
DEATH EQU $83
DETHWISH EQU $84
ENTRY EQU $85 ;DIGDUG WALKING ONTO SCREEN.
FRMCNT EQU $86
PLAYNUM EQU $87 ;CURRENT PLAYER NUMBER.
BONZO EQU $88
PROPORT2 EQU $89
PROPORT3 EQU $8A
LISTSIZ EQU $8B ;# OF BYTES USED IN DLIST FOR EACH ZONE
; (THROUGH $9A).
RACKNUM EQU $9B ;AND $9C:ACTUAL RACK # FOR EACH PLAYER.
* +1 EQU $9C
MAXPUMP EQU $9D
NUMMEN EQU $9E ;AND $9F: NUMBER OF MEN LEFT.
* +1 EQU $9F
ATTRACT EQU $A0
SYNCFRAM EQU $A1 ;IT'S BACK!!!
SCOREL EQU $A2 ;AND $A3: LOW BYTES OF SCORE FOR P0,P1.
SCOREM EQU $A4 ;AND $A5: MIDDLE BYTES FOR EACH PLAYER.
SCOREH EQU $A6 ;AND $A7: HIGH BYTES OF SCORE.
NONOISE EQU $A8
ASTAGE EQU $A9 ;STAGE FOR ATTRACT MODE SAMPLE RACK.
AVAROBIN EQU $AA
RNDM EQU $AB ;FOR 2 BYTES
* EQU $AC
TITLETIM EQU $AD ;TIMER FOR TITLEPAG: GETS INCREMENTED
; EVERY FRAME ALL THE TIME!
SELCTIM EQU $AE ;TIMER FOR SELECT: COUNTS NUMBER OF 4
; SECOND INTERVALS IN KERNEL.
PROPORT EQU $AF
DIGSPEED EQU $B0
PUMPCT EQU $B1 ;ANIMATION COUNTER.
MONSTAT EQU $B2 ;THROUGH $B9.
DIR EQU $BA ;THROUGH $C1.
NOTUNNEL EQU $C2
*KEEP TUMBLE, FALLCNT, BRCREAT, BRTUNNL NEXT TO EACH OTHER.
TUMBLE EQU $C3 ;THROUGH $C7.
FALLCNT EQU $C8 ;NUMBER OF ROCKS FALLEN THIS RACK
BRCREAT EQU $C9 ;SAVE RCREATS FOR BONZO MODE.
BRTUNNL EQU $CA ;SAVE RTUNNELS FOR BONZO MODE.
HITROCK EQU $CB ;ROCK WHICH DIGDUG IS DIRECTLY UNDER.
TEMP EQU $CC ;THROUGH $DF.
TEMP1 EQU $CC
TEMP2 EQU $CD
TEMP3 EQU $CE
TEMP4 EQU $CF
TEMP5 EQU $D0
***********
TEMP0 EQU TEMP
TCOUNT EQU TEMP+2 ;INITDIRT,INCREATS TEMPS.
PCOUNT EQU TEMP+3
FCOUNT EQU TEMP+4
RCREATS EQU TEMP+5
RTUNNELS EQU TEMP+6
TEMPX EQU TEMP+2 ;INITROCK TEMPS.
REGROCK EQU TEMP+3
RANDROCK EQU TEMP+4
CURROCK EQU TEMP+2 ;FALL TEMP
VICTIMX EQU TEMP+4 ;FALL TEMP
VICTIMY EQU TEMP+5 ;FALL TEMP
RTEMP EQU TEMP+6 ;FALL TEMP
RTEMP2 EQU TEMP+7 ;FALL TEMP - MUST FOLLOW RTEMP
ROCKSNOW EQU TEMP+8 ;FALL TEMP
GHOSTTMP EQU TEMP+12 ;MONSTER TEMP
MTEMP EQU TEMP+13 ;MONSTER TEMP
CURRBLW EQU TEMP+2 ;BLOWUP TEMP
BLWTEMP EQU TEMP+3 ;BLOWUP TEMP
; ;DDMOVE TEMPS (+0,+1)
DRTPTR EQU TEMP+3 ;DDMOVE: AND TEMP+4
DIGTEMP EQU TEMP+6 ;DDMOVE
; ;DDMOVE: TEMP+7,TEMP+9,TEMP+10
CHKTMP1 EQU TEMP+11 ;CHKSTATE TEMPS
CHKTMP2 EQU TEMP+12
CHKTMP3 EQU TEMP+13
CHKTMP4 EQU TEMP+14
DETHTEMP EQU TEMP+9 ;DEATH TEMP: MUST NOT OVERLAP GENDPL
DEATHCNT EQU TEMP+10 ;(ACTUALLY FREEZFRM TEMP) OR CHKSTATE.
DTEMP2 EQU TEMP+10
DPLOW2 EQU TEMP+12 ;TITLEPAGE TEMPS (+0,+1,+15,+16) -
DPHIGH2 EQU TEMP+13 ; MUST NOT OVERLAP FALL (2-8),
TSTAGE EQU TEMP+10 ; CHKSTATE, LOADER (11-19), OR TCMOVE
TCTEMP EQU TEMP+2 ; TEMPS.
FAKEJOY EQU TEMP+5 ;SELECT MODE TEMPS... (+0,1,12-16)
SCORTEMP EQU TEMP+19 ;ADDSCORE TEMP.
DIRTPTR EQU TEMP+14 ;INITDIRT TEMPS: THRU TEMP+19.
TEMPYPOS EQU TEMP+11 ;LOADER TEMP VARIABLES...
HEADER0 EQU TEMP+12
HEADER1 EQU TEMP+13
HEADER3 EQU TEMP+14
DPLOW EQU TEMP+15
DPHIGH EQU TEMP+16
TEMPY EQU TEMP+17
LISTPTR EQU TEMP+18 ;AND TEMP+19.
***********
* FOLLOWING 20 REGISTERS MUST REMAIN ADJACENT. THEY ARE SET TO 0 IN INCREATS.
ANIMCNT EQU $E0 ;ANIMATION CTR
DIGGING EQU $E1
PUMPNUM EQU $E2
SQUASH EQU $E3 ;DIGDUG SQUASHING
NOTGRID EQU $E4
NEEDDIR EQU $E5
FSCORE EQU $E6
FSCORCTR EQU $E7
GHOSTIME EQU $E8
ESCAPER EQU $E9
PUMP EQU $EA
PUMPING EQU $EB
PUMPCNT EQU $EC
WALKING EQU $ED
FREEZE EQU $EE
FLAMIE EQU $EF
FLAMTIME EQU $F0
FRUIT EQU $F1
DIGREST EQU $F2
SCNDTIM EQU $F3
; THE FOLLOWING 7 REGISTERS MUST REMAIN IN THEIR CURRENT POSITION
CURINDX0 EQU $F4
CURINDX1 EQU $F5
REST0 EQU $F6
REST1 EQU $F7
DURCTR EQU $F8
TUNINDX0 EQU $F9
TUNINDX1 EQU $FA
ROCKSTAT EQU $FB ;FOR 5 BYTES
* EQU $FC
* EQU $FD
* EQU $FE
* EQU $FF
;*******************************************************************************
; FIRST PAGE RAM 0140 TO 017F
; NOTE THIS RAM IS SHADOWED AT 2140 TO 217F
;*******************************************************************************
ORG $0140
;*******************************************************************************
; PIA AND TIMER (6532) LOCATIONS 0280 TO 02FF
; NOTE THESE REGISTERS ARE SHADOWED AT 0380 TO 03FF
;*******************************************************************************
SWCHA EQU $280 ;PO, P1 JOYSTICKS
; BIT 7 PLAYER 0 EAST IF CLEAR
; BIT 6 WEST
; BIT 5 SOUTH
; BIT 4 NORTH
; BIT 3 PLAYER 1 EAST IF CLEAR
; BIT 2 WEST
; BIT 1 SOUTH
; BIT 0 NORTH
SWCHB EQU $282 ;CONSOLE SWITCHES
; BIT 7 PLAYER 1 DIFFICULTY A IF SET B IF CLEAR
; BIT 6 PLAYER 0 DIFFICULTY A IF SET B IF CLEAR
; BIT 3 BLACK AND WHITE/COLOR COLOR WHEN SET
; BIT 1 GAME SELECT CLEAR WHEN PRESSED
; BIT 0 GAME RESET CLEAR WHEN PRESSED
CTLSWA EQU $281
CTLSWB EQU $283
INTIM EQU $284 ;INTERVAL TIMER IN
TIM8T EQU $295 ;TIMER 8T WRITE OUT
TIM64T EQU $296 ;TIMER 64T WRITE OUT
TIM64TI EQU $29E ;INTERUPT TIMER 64T
;*******************************************************************************
; RAM 2000 TO 2FFF
; NOTE SOME OF THIS RAM IS SHADOWED ELSEWHERE
; 2040 TO 20FF IS SHADOWED AT 0040 TO 00FF
; 2140 TO 217F IS SHADOWED AT 0140 TO 017F
; 2240 TO 227F IS SHADOWED AT 0240 TO 027F
; 2340 TO 237F IS SHADOWED AT 0340 TO 037F
;*******************************************************************************
ORG $1800
;
; DISPLAY LIST ZERO NO PAGE BOUNDARIES CROSSED!
L0Z1 EQU $1800
L0Z2 EQU $183F
L0Z3 EQU $187E
L0Z4 EQU $18BD ;THRU $18FB.
L0Z5 EQU $1900
L0Z6 EQU $193F
L0Z7 EQU $197E
L0Z8 EQU $19BD
L0Z9 EQU $1A00
L0Z9P5 EQU 5
L0Z10 EQU $1A3F
L0Z11 EQU $1A7E
L0Z12 EQU $1ABD
L0Z12P5 EQU $C2
L0Z13 EQU $1B00
L0Z13P5 EQU 5 ;LOW BYTE OF L0Z13 PLUS 5.
L0Z14 EQU $1B3F
L0Z15 EQU $1B7E
L0Z0 EQU $1BBD ;THRU $1BFF: LONGER THEN OTHER LISTS.
;
; DISPLAY LIST ONE
;
L1Z1 EQU $1C00 ;LOW BYTE OF L1 ZONES = LOW BYTE OF L0.
L1Z2 EQU $1C3F
L1Z3 EQU $1C7E
L1Z4 EQU $1CBD
L1Z5 EQU $1D00
L1Z6 EQU $1D3F
L1Z7 EQU $1D7E
L1Z8 EQU $1DBD
L1Z9 EQU $1E00
L1Z10 EQU $1E3F
L1Z11 EQU $1E7E
L1Z12 EQU $1EBD
L1Z13 EQU $1F00
L1Z14 EQU $1F3F
L1Z15 EQU $1F7E ;THRU $1FBC.
DLIJMP EQU $1FBD
DLIVECT EQU $1FBE ;AND $1FBF.
HSCOREX EQU $1FC0
HSCOREH EQU $1FC1
HSCOREM EQU $1FC2
HSCOREL EQU $1FC3
EFFRACK EQU $1FC4 ;AND $1FC5
BACKMONS EQU $1FC6 ;THROUGH $1FCD.
FRUITCST EQU $1FCE
FRUITPAL EQU $1FCF
******* EQU $1FD0
*KEEP BACKXPOS NEXT TO BACKYPOS, AND BACKTMBL,BACKHROK, BACKFCNT TOGETHER.
BACKYPOS EQU $2000 ;STMPYPOS TEMP FOR OTHER PLAYER:THRU 12
BACKXPOS EQU $2013 ;STMPXPOS TEMP: THROUGH 15.
BACKTMBL EQU $2026 ;TUMBLE TEMP FOR OTHER PLAYER:THRU 2A.
BACKHROK EQU $202B ;HITROCK TEMP FOR OTHER PLAYER.
BACKFCNT EQU $202C ;FALLCNT TEMP.
BAKRCRET EQU $202D ;BRCREAT TEMP.
BAKRTUNL EQU $202E ;BRTUNNL TEMP.
STATUS EQU $202F ;USED IN MAIN.
MODEH EQU $2030
SPEEDL EQU $2038 ;THRU $213F.
;*******************************************************************************
ORG $2040
; 2040 TO 20FF IS SHADOWED AT 0040 TO 00FF
;
;*******************************************************************************
ORG $2100
SPEEDH EQU $2100 ;THRU $2107.
CDIREC EQU $2108 ;FOR TITLE PAGE: CREATURE DIRECTION.
CBORDER EQU $2110 ;TITLE PAGE: TURNING POINT. (THRU 17)
CHARSEQL EQU $2118
BLWYPOS EQU $2120
CHARSEQN EQU $2128
GHOST EQU $2130
FACING EQU $2138 ;THRU $213F.
;*****************************************************.*************************
ORG $2140
; 2140 TO 21FF IS SHADOWED AT 0140 TO 01FF
;
;*******************************************************************************
ORG $2200
TUNNELS EQU $2200 ;THRU $22C8.
YMODC EQU $22E8
MODEL EQU $22F0 ;THRU $22F7.
PREBLWIX EQU $22F8 ;THRU $22FF
RACKTIME EQU $2300
SPEEDUP EQU $2301
FLAMWAIT EQU $2302
GHOSTOUT EQU $2303
FLEE EQU $2304
FAST EQU $2305 ;INIT TO 0 IN INCREATS
NXTSEC EQU $2306
P0C0SHAD EQU $2307 ;SHADOW OF PALETTES: THROUGH $231F.
NUMSQSH EQU $2327 ;THROUGH $232B
******* EQU $232C
******* EQU $232D
******* EQU $232E
DHORSPDL EQU $232F
DHORSPDH EQU $2330 ;MUST FOLLOW DHORSPDL
***FREE EQU $2331
****** EQU $2332 ;THROUGH $2336
BLWSTAT EQU $2337 ;THROUGH $233E
BLWCTR EQU $233F ;THROUGH $2346
BLWLSTMV EQU $2347 ;THROUGH $234E
; FOR SOUNDS
****** EQU $234F
; THE FOLLOWING 7 REGISTERS MUST REMAIN IN THEIR CURRENT POSITION
DURINDX0 EQU $2350
DURINDX1 EQU $2351
DEST0 EQU $2352
DEST1 EQU $2353
DDURCTR EQU $2354
DUNINDX0 EQU $2355
DUNINDX1 EQU $2356
SNGREQ EQU $2357 ;THROUGH $235C.
DPL0LIST EQU $235D ;THRU $23A1.
DPL1LIST EQU $23A2 ;THRU $23E6.
DUMMYDPL EQU $23E7 ;AND $23E8.
DRT1COLR EQU $23E9 ;KEEP DRTNCOLR'S TOGETHER.
DRT2COLR EQU $23EB
DRT3COLR EQU $23ED
VEGCOLR EQU $23EF ;AND $23F0
IGNORE EQU $23F1 ;FOR IGNORING JOYSTICK.
SAVEFRMC EQU $23F2
P2INIT EQU $23F3
STMPPALW EQU $2400
PALWIDZ EQU $2480 ;THROUGH $248F.
DIV3TAB EQU $2490 ;THROUGH $24BF.
STMPRIOR EQU $24C0 ;THROUGH $24D2.
MONPRIOR EQU $24C1 ;(THESE ARE JUST EQUATES...)
RCKPRIOR EQU $24C9 ;( "" " "" "" )
PUMPRIOR EQU $24CF ;( "" " "" "" )
DPL2LIST EQU $2500 ;THROUGH $2544.
ROCKNUM EQU $2550 ;THROUGH $2557, USED BY FALL
SCOREMAP EQU $25F0 ;ONE SCORE MAP FOR EITHER PLAYER.
**** THE FOLLOWING RAM IS SHARED BY HSC: IT IS RESTORED AFTER HSC RETURNS.
DIRTMAP EQU $2600 ;CHAR MAP FOR CURRENT PLAYER, AND OTHER
; PLAYER IF TWO PLAYER MODE. EACH
BACKDIRT EQU $2700 ; CONTAINS CHAR INDICES FOR SKY AND
; DIRT AND RUNS THROUGH $F0 INCLUSIVE.
HSCRAM EQU $2600
HSCDIFFL EQU $2602
*HSCDIFFN EQU $2606
HSCTIME EQU $260E
**** GENERAL IMMEDIATES
HSCATRCT EQU $3FFA
HSCENTER EQU $3FFD
LCARTNUM EQU $41
HCARTNUM EQU $42
STACK EQU $FF ;FOR NOW, GIVES 32 BYTES OF STACK.
DDSTRTX EQU 96
DDSTRTY EQU 191
DDMIDLX EQU 56
DDMIDLY EQU 107
XPOS EQU POOKAX
YPOS EQU POOKAY
MONSI EQU POOKAIX
NUMVEG EQU 17
NUMZONES EQU 15 ;ZONES RUN FROM 0 (BOTTOM) TO 15 (TOP).
NUMCREAT EQU 7 ;NUMBER OF POOKAS + FYGARS - 1.
NUMROCK EQU 4 ;MAX NUMBER OF ROCKS-1
TOTLSTMP EQU 18 ;TOTAL NUMBER OF STAMPS POSSIBLE ON
; SCREEN AT ANY ONE TIME - 1.
TOTLSTX2 EQU TOTLSTMP+TOTLSTMP+1
CSET1 EQU $E0 ;CHARACTER SET 1: PAGES 40 - 4B.
CSET2 EQU $C4
W1ZONE EQU $60
LISTLENG EQU 61 ;LENGTH OF DISPLAY LIST.
NORMSCRN EQU 0 ;VALUES FOR KERNTYPE: NORMAL DIRT SCRN.
BLNKSCRN EQU 3 ;BLANK SCREEN (BLACK).
MAXSRACK EQU 19 ;HIGHEST RACK PLAYER CAN CHOOSE.
MAXSR1 EQU MAXSRACK-1
MAXEFFR EQU 17
MINDDX EQU 8 ;MINIMUM DIGDUG X POSITION.
MAXDDX EQU 113 ;MAX DIGDUG X POSITION.
MINDDY EQU 23
MAXDDY EQU 192
ONEDGE EQU 2 ;TUMBLE STATE - ROCK READY TO FALL
SECOND EQU 60 ;60 FRAMES PER SECOND.
STRTWALK EQU 9 ;TITLEPAGE: AFTER 8 SECS, DD WALKS UP.
MAXCLIMB EQU 167 ;TITLEPAGE: HIGH POINT FOR DD CLIMB.
DROPROCK EQU 64 ;TITLEPAGE: HORIZ DD POS WHEN ROCK
; WILL BEGIN TO FALL.
**** SOUND IMMEDIATES
SNGC EQU 1 ;CREATURE MOVEMENT
SNGD EQU 2 ;SLOW DIGDUG
SNGDF EQU 3 ;FAST DIGDUG
SNGNULL EQU 4 ;SOUND OF SILENCE
SNG1 EQU 5 ;ROCK CRUSHING MONSTER
SNG2 EQU 6 ;ROCK HITTING GROUND/DIGDUG
SNG3 EQU 7 ;FLAME NOISE
SNG4 EQU 9 ;PUMP CREATURE
SNG5 EQU 8 ;DIGDUG THROWING HARPOON
SNG6 EQU 10 ;POP
SNG7 EQU 11 ;ROCK FALLING
SNG8 EQU 12 ;GOTCHA
SNG9 EQU 13 ;CREATURE ESCAPING
SNG10 EQU 14 ;EAT VEGETABLE
SNG11 EQU 15 ;BONUS MAN
SNG12 EQU 16 ;SPEEDUP MUSIC
SNG13 EQU 17 ;RACKEND
SNG14 EQU 18 ;DIGDUG DEATH
SNG15 EQU 19 ;ENTRANCE
**** CHARACTER INDEX IMMEDIATES
FULLDIRT EQU 36 ;CHARACTER INDEX FOR FILLED IN DIRT.
FULLSKY EQU 30 ;SKY CHARACTER (USES COLOR 10).
FULLSKY2 EQU 92 ;SKY IN CSET2.
RSKYHALF EQU 136
LSKYHALF EQU 140
NODIRT EQU 0 ;EMPTY DIRT CHARACTER.
DTOPEND EQU $16 ;TOP OF A VERTICAL TUNNEL.
DVMIDDLE EQU $14 ;MIDDLE OF VERTICAL TUNNEL.
DBOTEND EQU $1C ;BOTTOM OF VERTICAL TUNNEL.
DLEFTEND EQU $1A ;LEFT END OF A HORIZONTAL TUNNEL.
DHMIDDLE EQU $A ;MIDDLE OF HORIZONTAL TUNNEL.
DRHTEND EQU $E ;RIGHT END OF HORIZONTAL TUNNEL.
BIGFLOWR EQU 32
SMLFLOWR EQU 34
TEDDY EQU 50 ;LEVEL INDICATORS: TEDDY AND VEGGIES.
*TEDPALW EQU $3E
VEGPALW EQU $BE
CARROT EQU 52
RUTABAGA EQU 54
MUSHROOM EQU 56
CUCUMBER EQU 58
EGGPLANT EQU 60
BELLPEPP EQU 62
TOMATO EQU 64
ONION EQU 66
WATERMEL EQU 68
GALAXIAN EQU 70
PINEAPPL EQU 72
PINEPALW EQU $3E
BLANK1 EQU 0
BLANK2 EQU 222
BLANK3 EQU 137
BLANKR EQU 74 ;RIGHT EDGE OF DIRT.
BLANKL EQU 76 ;LEFT EDGE OF DIRT.
BLACKBOX EQU 144
BIGSTAMP EQU 224
**** STAMP INDEX IMMEDIATES: CSET2 STAMPS WHOSE INDEX IS <= 106
**** DON'T NEED ZERO PADDING. ALL OTHER STAMPS DO.
FULL0 EQU 150 ;FULL SIZE NUMBERS IN CSET2 (8 PIX).
*PUMP AND HARPOON...
DPUMP6 EQU 172
DPUMP12 EQU 173
DFULL6 EQU 174
DFULL12 EQU 175
UPUMP6 EQU 176
UPUMP12 EQU 177
UFULL6 EQU 104
UFULL12 EQU 105
ZBLANK EQU 222
RPUMP24 EQU 48
RPUMP20 EQU 49
RPUMP16 EQU 50
RPUMP12 EQU 51
RPUMP8 EQU 52
RPUMP4 EQU 53
LPUMP24 EQU 46
LPUMP20 EQU 55
LPUMP16 EQU 60
LPUMP12 EQU 64
LPUMP8 EQU 67
LPUMP4 EQU 69
RHARPOON EQU 16
LHARPOON EQU 18
UHARPOON EQU 120
DHARPOON EQU 122
*DIGDUG...
UDIGDUG1 EQU 148
UDIGDUG2 EQU 150
UDIGDUG3 EQU 152
DDIGDUG1 EQU 154
DDIGDUG2 EQU 156
DDIGDUG3 EQU 158
RDIGDUG1 EQU 0
RDIGDUG2 EQU 2
RDIGDUG3 EQU 4
LDIGDUG1 EQU 6
LDIGDUG2 EQU 8
LDIGDUG3 EQU 10
SQDIGDUG EQU 160
SDEATH EQU 106 ;(STAR).
HRDEATH1 EQU 108
HRDEATH2 EQU 110
HRDEATH3 EQU 112
HLDEATH1 EQU 114
HLDEATH2 EQU 116
HLDEATH3 EQU 118
*MONSTERS...
RPOOKA1 EQU 124
RPOOKA2 EQU 126
LPOOKA1 EQU 128
LPOOKA2 EQU 130
RBPOOKA1 EQU 224
RBPOOKA2 EQU 226
RBPOOKA3 EQU 228
RBPOOKA4 EQU 230
LBPOOKA1 EQU 232
LBPOOKA2 EQU 234
LBPOOKA3 EQU 236
LBPOOKA4 EQU 238
GPOOKA1 EQU 140
GPOOKA2 EQU 142
SQPOOKA EQU 164
RFYGAR1 EQU 132
RFYGAR2 EQU 134
LFYGAR1 EQU 136
LFYGAR2 EQU 138
RBFYGAR1 EQU 240
RBFYGAR2 EQU 242
RBFYGAR3 EQU 244
RBFYGAR4 EQU 246
LBFYGAR1 EQU 248
LBFYGAR2 EQU 250
LBFYGAR3 EQU 252
LBFYGAR4 EQU 254
GFYGAR1 EQU 144
GFYGAR2 EQU 146
SQFYGAR EQU 162
RFLAMFYG EQU 12
LFLAMFYG EQU 14
*FLAMES ...
RFLAME4 EQU 20
RFLAME8 EQU 22
RFLAME16 EQU 24
RFLAME24 EQU 28
LFLAME4 EQU 21
LFLAME8 EQU 34
LFLAME16 EQU 36
LFLAME24 EQU 40
*ROCKS...
STRTROCK EQU 166
SPLTROCK EQU 168
CRMBROCK EQU 170
TOTRROCK EQU 86
*SCORES - CSET1 (VEGETABLES)
VHUND4 EQU 98
VHUND6 EQU 101
VHUND8 EQU 187
VTHOUS1 EQU 218
VTHOUS2 EQU 70
VTHOUS3 EQU 74
VTHOUS4 EQU 194
VTHOUS5 EQU 78
VTHOUS6 EQU 198
VTHOUS7 EQU 82
VTHOUS8 EQU 202
VHUND2 EQU 178
*SCORES - CSET2 (BLOWUP AND SQUASHING)
LOWSCOR EQU 178
HUNDRED2 EQU 178
HUNDRED3 EQU 181
HUNDRED4 EQU 98
HUNDRED5 EQU 184
HUNDRED8 EQU 187
THOUSND1 EQU 218
THOUS25 EQU 190
THOUS4 EQU 194
THOUS6 EQU 198
THOUS8 EQU 202
THOUS10 EQU 206
THOUS12 EQU 210
THOUS15 EQU 214
HIGHSCOR EQU 218
HUNDRED6 EQU 101
*TITLEPAGE STAMPS
LETRL EQU 90 ;CSET2...
LETRE EQU 92
LETRV EQU 94
LETRP EQU 96
LETRO EQU 88
LETRS EQU 78 ;CSET1...
LETRA EQU 80
LETRY EQU 82
LETRG EQU 84
LETRM EQU 86
LETRR EQU 142
*TITLE PAGE STAMPS...
ATARICP EQU 88
NAMCOCP EQU 94
TITLED10 EQU 100
TITLED9 EQU 104
TITLEG10 EQU 108
TITLEG9 EQU 112
TITLEU10 EQU 116
TITLEU9 EQU 120
TDDUG10 EQU 124
TDDUG9 EQU 128
TITLEI10 EQU 132
TITLEI9 EQU 134
**** COLORS
WHITE EQU $0E
RED EQU $37
PEBBLE1 EQU $24
PEBBLE2 EQU $14
PEBBLE0A EQU $24
PEBBLE0B EQU $14
PEBBLE0C EQU $17
PEBBLE0D EQU $26
PEBBLE1A EQU $52
PEBBLE1B EQU $42
PEBBLE1C EQU $24
PEBBLE1D EQU $10
PEBBLE2A EQU $52
PEBBLE2B EQU $42
PEBBLE2C EQU $00
PEBBLE2D EQU $52
YELLOW0 EQU $1A
GOLD0 EQU $27
ORANG0 EQU $24
DKORANG0 EQU $10
PALPURP1 EQU $0A
PALBRWN1 EQU $15
YELLOW1 EQU $1E
GOLD1 EQU $27
PALPURP2 EQU $0A
PALBRWN2 EQU $15
PALTURQ2 EQU $B2
DKPURP2 EQU $04
DKORANGE EQU $10
ORANGE EQU $24
GOLD EQU $27
YELLOW EQU $1A
GREEN EQU $C8
PALETURQ EQU $F8
SKYBLUE EQU $86
DDBLUE EQU $85
PALEPURP EQU $86
DARKPURP EQU $87
PALEBRWN EQU $25
TAN EQU $23
BROWN EQU $41
BLACK EQU $00
ANYCOLR EQU $00
PL0COLR EQU WHITE
PL1COLR EQU WHITE
********************************************************************************
********************************************************************************
ORG $FF80
DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DB 0,0,0,0,0,0,0,0
ORG $FFF8
DB $FF ;COUNTRY CODE
DB $C7 ;MARIA SIGNATURE AND START OF CODE
* ;DLI VECTOR: THIS LOCATION IS A
* ; JMP TO LOCATION IN RAM (DLIJMP).
DB L(GENEJMP),H(GENEJMP) ; JUMP ADDRESS IS CHANGED AS DMA
; MOVES DOWN SCREEN.
ORG $FFFC
DB L(MAIN),H(MAIN) ;INTERRUPT RESET VECTOR.
DB L(GENERTI),H(GENERTI) ;JUST IN CASE....
ORG $D000
*******************************************************************************
*********** 3600 DIG DUG *************
*******************************************************************************
*******************************************************************************
MAIN
SEI
CLD
LDA #$17 ;LOCK 3600 MODE.
STA $1
LDX #STACK
TXS
LDA #$7F
STA CTRL
LDA #0 ;UNFREEZE JOYSTICKS.
STA $1
JSR INIT ;INIT DISPLAY LIST, VARIABLES, ETC.
JSR WAITVBL ;WE WANT TO SYNC OURSELVES WITH MARIA:
LDA #$50 ; WAIT FOR VBLANK.
STA CTRL ;ENABLE DMA.
PLAYTITL JSR TITLEPAG ;START OFF IN TITLE PAGE.
PLAYGAME
LDA SYNCFRAM
BPL PLAYGAME
DOCODE
LDA FRMCNT
STA AVAROBIN
* LDY DOOMPTR+1
* CPY #$A0
* BEQ DOOMOVER
* LDY #0
* STA (DOOMPTR),Y
* INC DOOMPTR
* BNE DOCODE2
* INC DOOMPTR+1
* BNE DOCODE2
*DOOMOVER NOP
DOCODE2 INC RACKTIME
JSR CHKDEATH ;CHKDEATH SHOULD PRECEDE CHKSTATE
JSR CHKSTATE
JSR CHKRACK
LDA DETHWISH
BNE DOFALL
JSR DDMOVE ;DDMOVE SHOULD PRECEDE COLLISON
; ; DDMOVE SHOULD PRECEDE ALL GAMEPLAY
;DDMOVE SHOULD PRECEDE PUMPER
JSR EATVEG ;EATVEG SHOULD PRECEDE FRUITER
JSR MONSTERS ;INCLUDES PUMPER,FRUITER,FLAMER,FLAMCOL
;PUMPER SHOULD PRECEDE COLLISONS+FALL
JSR COLLISON
* LDA DETHWISH ; PROBABLY NOT NECESSARY ANYMORE
* BNE DOFALL
JSR BLOWUP
DOFALL JSR FALL
JSR GENDPL ;GENERATE NEW DISPLAY LIST.
LDA FRMCNT ;IF WE TOOK LONGER THAN ONE FRAME, GO
CMP AVAROBIN ; BACK TO PLAYGAME TO EXECUTE AGAIN IN
* BEQ WAIT1FRM
DOCODE4 BNE PLAYGAME ; CASE THE FRAME WE SKIPPED SHOULD
; HAVE BEEN EXECUTED.
WAIT1FRM CMP FRMCNT ;WE TOOK LESS THAN OR EQUAL TO ONE
BEQ WAIT1FRM ; FRAME TO EXECUTE DOCODE. WAIT FOR
BNE PLAYGAME ; NEXT FRAME BEFORE CONTINUING.
* AND #$07 ;DO STUFF 5 OUT OF 8 FRAMES
* BEQ DOCODE
* CMP #1
* BEQ DOCODE
* CMP #3
* BEQ DOCODE
* CMP #4
* BEQ DOCODE
* CMP #6
* BNE PLAYGAME
* LDA AVAROBIN
*WAITARC CMP FRMCNT
* BEQ WAITARC
* BNE PLAYGAME
********************************************************************************
*********** **********
*********** INIT: CALLED UPON POWER-UP, THIS INITIALIZES **********
*********** THE DISPLAY LISTS, SKY IN DIRTMAP, AND **********
*********** CALLS INITGAME TO INITIALIZE ATTRACT MODE. **********
*********** **********
********************************************************************************
*IGAMERAK
INIT
LDA #0
STA VBLANK
STA INTIM
STA HSCOREX
STA AVAROBIN
* STA ALIEN
LDX #CSET1
STX CHARBASE
LDX #$B5 ;WILL NEED DIFF VALUE FOR PAL/SECAM
STX SYNCFRAM ;WILL NEED DIFF VALUE FOR PAL/SECAM
LDX #$4C ;SET UP JUMP INSTRUCTION FOR DLI'S.
STX DLIJMP
LDX #L(DLISETUP)
STX DLIVECT
LDX #H(DLISETUP)
STX DLIVECT+1
STA $38 ; A CONTAINS 0
STA DUMMYDPL+1
* STA CURSONG ;THESE 11 REGISTERS ARE ZERO PAGE.
* STA SNGTEMP1 ;THEY MUST BE KEPT ADJACENT TO BE
* STA LASTMOVE ;SERVED BY THE FOLLOWING LOOP.
* STA DLSTPTR
* STA NUMPLAYR
* STA DEATH
* STA DETHWISH
* STA ENTRY
* STA FRMCNT
* STA PLAYNUM
* STA BONZO
LDX #10
ZIVARS STA CURSONG,X ;SEE DIGDEF FOR WHICH VARS ARE INIT'ED
DEX
BPL ZIVARS
LDX #TOTLSTMP
ZEROSTMY STA STMPYPOS,X ;NO STAMPS ON SCREEN INITIALLY.
STA STMPRIOR,X
DEX
BPL ZEROSTMY
LDA #1
STA NONOISE
LDX #3