built on 2018-08-13 23:08:36+10:00
5000
InflatedCaveOffsetAdjustTable:
5406
LevelOffsetArray:
MusicData:
RockfordAnimationChars:
63e8
Top2LinesAndBoulderDashLogo:
FourDelays:
ExecuteLevelDrawCommands__SetOutputPointer:
Boulder Dash Disassembly
TitleCharData:5000
InflatedCaveOffsetAdjustTable:
; 0 : Offset
; 1&2: Adjust
;
; CaveCurrentCellPtr points to the NW cell and the cell in consideration is at
; 'C' (that's why you see a lot of offsets of $29 in the code).
; ---------------------
; |NW:$00|N:$01|NE:$02|
; |------+-----+------|
; | W:$28|C:$29| E:$2a|
; |------+-----+------|
; |SW:$50|S:$51|SE:$52|
; |======+=====+======|
; | $78| $79| $7a|
; ---------------------
;
; InflatedCaveCurrentCellPtr points to the cell in consideration ('C'). Since
; each cell in the cave is 2x2 characters in the inflated cave the offsets
; are as follows (I'm not sure what the extra bits hanging off the sides are
; for yet).
; ------------------------
; |NW:-162|N:-160|NE:-158|
; -------+-------+------|-------|-------
; | -4 | W:-2 |C: 0 | E:+2 | +4 |
; -------+-------+------|-------|-------
; |SW:+158|S:+160|SE:+162|
; |=======+======+=======|
; | +318| +320| +322|
; ------------------------
;
; This table translates offsets as specified in the first scheme to ones in the second.
;
; Offset: 0($00) Adjust: -162
; Offset: 1($01) Adjust: -160
; Offset: 2($02) Adjust: -158
; Offset: 40($28) Adjust: -2
; Offset: 39($27) Adjust: -4
; Offset: 41($29) Adjust: 0
; Offset: 42($2a) Adjust: 2
; Offset: 43($2b) Adjust: 4
; Offset: 80($50) Adjust: 158
; Offset: 81($51) Adjust: 160
; Offset: 82($52) Adjust: 162
; Offset: 120($78) Adjust: 318
; Offset: 121($79) Adjust: 320
; Offset: 122($7a) Adjust: 322
53b0 00 5e ff 01 60 ff 02 62 ff 28 fe ff 27 fc ff 29
53c0 00 00 2a 02 00 2b 04 00 50 9e 00 51 a0 00 52 a2
53d0 00 78 3e 01 79 40 01 7a 42 01
InflatedCaveLineAddressTable:; Inflated Cave: $4003 - $4dc2
53da 03 40 a3 40 43 41 e3 41 83 42 23 43 c3 43 63 44
53ea 03 45 a3 45 43 46 e3 46 83 47 23 48 c3 48 63 49
53fa 03 4a a3 4a 43 4b e3 4b 83 4c 23 4d
AnimatedCharData:5406
LevelOffsetArray:
5806 00 00 31 00 8a 00 b1 00 fc 00 83 01 14 02 5c 02
5816 b3 02 f6 02 5b 03 c1 03 2b 04 69 04 c3 04 fe 04
5826 5d 05 99 05 ef 05 2d 06
; CaveNumber
; MagicWallMillingTimeOrAmoeba3PercentMax
; InitialDiamondValue
; ExtraDiamondValue
; InitialRandomSeedForSublevel1
; InitialRandomSeedForSublevel2
; InitialRandomSeedForSublevel3
; InitialRandomSeedForSublevel4
; InitialRandomSeedForSublevel5
; DiamondsNeededForSublevel1
; DiamondsNeededForSublevel2
; DiamondsNeededForSublevel3
; DiamondsNeededForSublevel4
; DiamondsNeededForSublevel5
; CaveTimeForSublevel1
; CaveTimeForSublevel2
; CaveTimeForSublevel3
; CaveTimeForSublevel4
; CaveTimeForSublevel5
; BackgroundColour1
; BackgroundColour2
; ForegroundColour
; ?
; ?
; RandomObjectNumber1
; RandomObjectNumber2
; RandomObjectNumber3
; RandomObjectNumber4
; ProbabilityOfObject1
; ProbabilityOfObject2
; ProbabilityOfObject3
; ProbabilityOfObject4
; /\ 32($20) bytes length /\
CaveAData:; Variable \/
; struct
; {
; CmdObj;
; Params[];
; } Objects[]
;
; 76543210
; ccoooooo
; c: Command
; o: Object
;
; Commands:
; $00 - Single(x, y)
; $40 - Line(x, y, len, dir) --- enum dir {N=0, NE=1, E=2, SE=3, S=4, SW=5, W=6, NW=7};
; $80 - FilledRect(x, y, width, height, interior)
; $c0 - Rect(x, y, width, height)
;
; Objects:
; $00 - Empty (. [space])
; $01 - Dirt (A)
; $02 - Wall (B)
; $03 - Magic wall (C)
; $04 - Exit (D)
; $07 - Steel wall (G)
; $08 - Firefly (H)
; $10 - Boulder (P)
; $14 - Diamond (T)
; $25 - Inbox (%)
; $30 - Butterfly (0 [number])
; $32 - Butterfly (2)
; $3a - Amoeba (:)
582e 01 14 0a 0f 0a 0b 0c 0d 0e 0c 0c 0c 0c 0c 96 6e
583e 46 28 1e 08 0b 09 d4 20 00 10 14 00 3c 32 09 00
584e 42 01 09 1e 02 42 09 10 1e 02 25 03 04 04 26 12
585e ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GAAAAAA.AATAP.AAAAAPAPAAAAAAA.AAAAPAAAAG
; >C:08a0 GAP%PAAAAAA.AAAAAAAAAPTAAPAAAA.AAAAA.AAG
; >C:08c8 GAAAAAAAAAA.AAPAAAAAPAPAAPAAAAAAAAPAAAAG
; >C:08f0 GPAPPAAAAAAAAAPAAAAAAPAAPAAAAPAAAPAAAAAG
; >C:0918 GPA.PAAAAAAAAA.PAAPAAAAAAAAPAAAAAAPAPPAG
; >C:0940 GAAA.AAPAAAAAAAAPAAAAAPA.PAAAAAAAAPAPPAG
; >C:0968 GBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAAAPAAPAG
; >C:0990 GA.AAAPAATA.AAPAPAAAAAAAAAATAPTAAAAAA.AG
; >C:09b8 GAATAAAAAPAAAAA.AAAAAAAAPP.PAAPAAAAPAAAG
; >C:09e0 GAAAPAAPAPAAAAAAAAAAAAAAP.APAAPAAAAAAAAG
; >C:0a08 GAPAAAAAPAAAAAAAAPPPAAAAAAAPAA.ATAAAAPAG
; >C:0a30 GATAA.AAPA..AAAAAPAPTAATAAAAPAAAPAATA.AG
; >C:0a58 GA.PAAAAAAAAAAAAAAP.PAAPAAAAAAAATAAAAAPG
; >C:0a80 GAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBG
; >C:0aa8 G.PAAAAAAAAAPAAATAAAAPAAAAAPAAAPAAAAAAAG
; >C:0ad0 G.PAAAAAAAAA.PAAPAAAAAAAAPAAAAAAPAPPAADG
; >C:0af8 GA.AAPAAAAAAAAPAAAAAPA..AAAATAAAPAPPAAAG
; >C:0b20 GAAAAPTAAPAAAAAAAAPAAAAAAPAPTAAAAAAPAAAG
; >C:0b48 GAAA.AAPA.AAPAPPAAAAAAAAAPAPTAAAAAA.AAPG
; >C:0b70 GATAAAA.AAAAA.AAAAAAAAA.APAAPAAAAPAAAPAG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveBData:585f 02 14 14 32 03 00 01 57 58 0a 0c 09 0d 0a 96 6e
586f 46 46 46 0a 04 09 00 00 00 10 14 08 3c 32 09 02
587f 42 01 08 26 02 42 01 0f 26 02 42 08 03 14 04 42
588f 10 03 14 04 42 18 03 14 04 42 20 03 14 04 40 01
589f 05 26 02 40 01 0b 26 02 40 01 12 26 02 40 14 03
58af 14 04 25 12 15 04 12 16 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GAPAAPAABAPAAATABAAA.APABPAAAAAABAAPPAAG
; >C:08a0 GAAAAAAABAAAAAAPBPPA.AAAB.AATAAABAAAAPAG
; >C:08c8 G......................................G
; >C:08f0 GTAAAAAABAPAAAAPBAPA.AA.BAAPAATABAAPAPAG
; >C:0918 GAAAAAAABAPAAAAPBAPA.PAABAAAAAPABAAA.AAG
; >C:0940 GBBBBBBBBBBBBBBBBBBB.BBBBBBBBBBBBBBBBBBG
; >C:0968 GAAAAPPABAAPAAAABAAA.AAPBAAAAPAABAAAAAPG
; >C:0990 GAAAAAAABAA.AAAABAAA.AAABAAAAPA.BAAAAAPG
; >C:09b8 G......................................G
; >C:09e0 GPAAPAAABAAAAPAABAAP.AAABAAAAAATBPAAAAAG
; >C:0a08 GPAAAAPABAAPAAPABAAA.A.PBAAAAAAABPAAAPAG
; >C:0a30 GAPAAAAABAAAPAAABAAA.A.PBAAAAAAAB.PAAPAG
; >C:0a58 GBBBBBBBBBBBBBBBBBBB.BBBBBBBBBBBBBBBBBBG
; >C:0a80 GPA..HAABAAAAPAPBAAA.AAABAPTAAPABAAAAAAG
; >C:0aa8 GAAAAAPABPAAAAAABAAT.AAAB.AAPAAABAPAPPAG
; >C:0ad0 G......................................G
; >C:0af8 GTAA.APABPAAAAPABAPA.AAPBAPAPAAABAAAAAAG
; >C:0b20 GAAAAAPABPAATAAABAAA.PAABAAPAAAABAAAPP.G
; >C:0b48 GATAAA.PBAAPAAAABA%T.PAABA.AAAAABAAAPP.G
; >C:0b70 GAPAAAA.BAA.AAPABADA.AAABAAAAPAPBAAAA.AG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveCData:58b8 03 00 0f 00 00 32 36 34 37 18 17 18 17 15 96 64
58c8 5a 50 46 09 08 09 04 00 02 10 14 00 64 32 09 00
58d8 25 03 04 04 27 14 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GPABBABPPABAAAPBPAAPAAAABAAAPAAAAAPBATAG
; >C:08a0 GAA%BATAPABAAABBBAABAPAAAAPAAPAPAAABABPG
; >C:08c8 GAAAABAAPTAAPAAAABAAAAAPABBPAAAAAAABABBG
; >C:08f0 GTABAABPBPAAPAAAABAAAPAAAAAAPAPPAAAAAABG
; >C:0918 GPABAAABAAPABBAAPABBTAAAAAAAPAPPAAAAAABG
; >C:0940 GPPAAPAAAABAAAPAAAAAAPAPPAAAAAAPAATBBAAG
; >C:0968 GAAPABBAAPAPPAAABAAAAPAPPAAAAAABAAPABAPG
; >C:0990 GAABAAATAAAAAATAPAABBPAAPABABPAABPAATAPG
; >C:09b8 GPAPAAAABABBAATAPAABBPAAPAATABAAABAAPABG
; >C:09e0 GAPABBAAAAAPPBPAATABABPAABPAAABPAATAPAAG
; >C:0a08 GBABBAAAAAAPPBPAAPABABBAAABAAPABBAAPABBG
; >C:0a30 GABAPAPABAAABBPAAPAAAABAAAPAAAAABBAPABBG
; >C:0a58 GABAPAPABATABABPAABPAAAAPAAPAPPAAAABAAAG
; >C:0a80 GBAABPBPAAPAAAABAAATAAABAPBAAAAAABABBATG
; >C:0aa8 GBAAABBPAABATAAABPAAPAPAAAPABPAAAAAABAAG
; >C:0ad0 GBATAAAAPABBAAPABBPAAAAAAAPABPAAAAAABAAG
; >C:0af8 GAAPAAAABAAAPAAAAAAPAPPAAAAAABAAPABAAABG
; >C:0b20 GPABBAAPABBAAABAAAAPAPPAAAAAABAAPTAAPAAD
; >C:0b48 GBAAAPAAAAAAPAPTAAAAAAPAAABBAABPAATABAAG
; >C:0b70 GPPAAABAAAAAPAPTAAAAAABAAPABTATAPBAPAAAG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveDData:58df 04 14 05 14 00 6e 70 73 77 24 24 24 24 24 78 64
58ef 50 3c 32 04 08 09 00 00 10 00 00 00 14 00 00 00
58ff 25 01 03 04 26 16 81 08 0a 04 04 00 30 0a 0b 81
590f 10 0a 04 04 00 30 12 0b 81 18 0a 04 04 00 30 1a
591f 0b 81 20 0a 04 04 00 30 22 0b ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 G%AAAAAPAAAAAAAAAAAAAAAAAAAAPAAAAAAAAPAG
; >C:08a0 GAAAAAPAAAAAAAAAAAAAAPAAAAAAAAAAAAAAAAAG
; >C:08c8 GAAAAAAAAPAAPAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:08f0 GPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0918 GAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAAAAAAAAAG
; >C:0940 GAPAAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAPAAAAG
; >C:0968 GAAPAAAAAPAAAAAAAAAAAPAAPAAAAAAAAAAAAAPG
; >C:0990 GAAAAAAPAAAAAAPAAAAAAAAAAAAAAAAAAAAAPAAG
; >C:09b8 GAAAAAAAA.0AAAPAA.0AAAAAA.0AAAAAA.0AAAAG
; >C:09e0 GAAAAAAAA..AAAPAA..AAAAAA..AAAAAA..APAAG
; >C:0a08 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0a30 GAAAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPAAAG
; >C:0a58 GAAAPAAAAAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0a80 GAAAAAAPAAAAAAAAAAAPAAAAAAAAAAAAAAAAAAPG
; >C:0aa8 GAAAAAAAAAAAPAAAAAAAPAAAAAAAAAAAAAAAAAAG
; >C:0ad0 GAAPAAAAAAAAAAAAAAPAAAAAAAAAAAAAAAAAAAAG
; >C:0af8 GAAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAPAAAAAAG
; >C:0b20 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPAAPAAG
; >C:0b48 GAAAAPAAAAAAPAPPAAAAAAAAAAAAAAAAAAPAAAAG
; >C:0b70 GAAAAAAAAAAAPAPPAAAAAAAAAPAAPAPAAAAAAADG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveEData:592a 05 14 32 5a 00 00 00 00 00 04 05 06 07 08 96 78
593a 5a 3c 1e 09 0a 09 00 00 00 00 00 00 00 00 00 00
594a 25 01 03 04 27 16 80 08 0a 03 03 00 80 10 0a 03
595a 03 00 80 18 0a 03 03 00 80 20 0a 03 03 00 14 09
596a 0c 08 0a 0a 14 11 0c 08 12 0a 14 19 0c 08 1a 0a
597a 14 21 0c 08 22 0a 80 08 10 03 03 00 80 10 10 03
598a 03 00 80 18 10 03 03 00 80 20 10 03 03 00 14 09
599a 12 08 0a 10 14 11 12 08 12 10 14 19 12 08 1a 10
59aa 14 21 12 08 22 10 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 G%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:08a0 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:08c8 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:08f0 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0918 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0940 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0968 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0990 GAAAAAAA..HAAAAA..HAAAAA..HAAAAA..HAAAAG
; >C:09b8 GAAAAAAA...AAAAA...AAAAA...AAAAA...AAAAG
; >C:09e0 GAAAAAAA.T.AAAAA.T.AAAAA.T.AAAAA.T.AAAAG
; >C:0a08 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0a30 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0a58 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0a80 GAAAAAAA..HAAAAA..HAAAAA..HAAAAA..HAAAAG
; >C:0aa8 GAAAAAAA...AAAAA...AAAAA...AAAAA...AAAAG
; >C:0ad0 GAAAAAAA.T.AAAAA.T.AAAAA.T.AAAAA.T.AAAAG
; >C:0af8 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0b20 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0b48 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0b70 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveFData:59b1 06 14 28 3c 00 14 15 16 17 04 06 07 08 08 96 78
59c1 64 5a 50 0e 0a 09 00 00 10 00 00 00 32 00 00 00
59d1 82 01 03 0a 04 00 82 01 06 0a 04 00 82 01 09 0a
59e1 04 00 82 01 0c 0a 04 00 41 0a 03 0d 04 14 03 05
59f1 08 04 05 14 03 08 08 04 08 14 03 0b 08 04 0b 14
5a01 03 0e 08 04 0e 82 1d 03 0a 04 00 82 1d 06 0a 04
5a11 00 82 1d 09 0a 04 00 82 1d 0c 0a 04 00 41 1d 03
5a21 0d 04 14 24 05 08 23 05 14 24 08 08 23 08 14 24
5a31 0b 08 23 0b 14 24 0e 08 23 0e 25 03 14 04 26 14
5a41 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GBBBBBBBBBAAAAPAPAAPAAAAAAAAPABBBBBBBBBG
; >C:08a0 GB........AAAAAAAAAAAPAAAAPAAA........BG
; >C:08c8 GB.TH.....AAPAAAAAAAAAAPAAAPAA.....HT.BG
; >C:08f0 GBBBBBBBBBAAPAAAAAAAAPAAAAAAPABBBBBBBBBG
; >C:0918 GB........AAAAAAPAAAPAAAAAAAPA........BG
; >C:0940 GB.TH.....AAAAPAAAAAAPAPPAAAAA.....HT.BG
; >C:0968 GBBBBBBBBBAPPAAAAAAAAPAPPAAAAABBBBBBBBBG
; >C:0990 GB........AAAAPAPAAAAPAAPAAAAA........BG
; >C:09b8 GB.TH.....AAAAPAPAAAAPAAPAAPAA.....HT.BG
; >C:09e0 GBBBBBBBBBAPPAPAAPAAAAPAAAPAAABBBBBBBBBG
; >C:0a08 GB........APPAPAAPAAAAAAAAAAAA........BG
; >C:0a30 GB.TH.....AAAAPAAPAAAAAAAAPAAA.....HT.BG
; >C:0a58 GBBBBBBBBBAAAAAPAAAPAAAAPAAPAABBBBBBBBBG
; >C:0a80 GAAAAPAPAAPAAAAAAAAPAAAAAPAAAAAAAAAAAAPG
; >C:0aa8 GAAAAAAPAAAAPAAAAPAAPAPAAAPAAPAAAAAAAAAG
; >C:0ad0 GAAPAAAAPAAAAAPAAAPAAAAAAAPAAPAAAAAAAAAG
; >C:0af8 GAAPAAAAAAAAPAAAAAAPAPPAAAAAAAAAPAAAAAAG
; >C:0b20 GPA%AAAPAAAAAAAAAAAPAPPAAAAAAAAAPPAAPADG
; >C:0b48 GAAAAPAAAAAAPAPPAAAAAAPAAAAAAAAPAAPAAAAG
; >C:0b70 GPPAAAAAAAAAPAPPAAAAAAAAAPAAPAPAPAAPAAAG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveGData:5a42 07 4b 0a 14 02 07 08 0a 09 0f 14 19 19 19 78 78
5a52 78 78 78 09 0a 0d 00 00 00 10 08 00 64 28 02 00
5a62 42 01 07 0c 02 42 1c 05 0b 02 7a 13 15 02 02 14
5a72 04 06 14 04 0e 14 04 16 14 22 04 14 22 0c 14 22
5a82 16 25 14 03 04 27 07 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GA.AA.APPAAAAA.AAPA.%AAAA.PP.PAAPA.A..AG
; >C:08a0 G.AAPA.AA.A..AAAA.APAPA.AAA..PAAPATAA.AG
; >C:08c8 GPAAAAA..AHA..AAA.APAPA.AAA.BBBBBBBBBBBG
; >C:08f0 GAPATAAA.A..AAAAAA.AAPPAAPAAAA.A.AAA.A.G
; >C:0918 GBBBBBBBBBBBBAPA.AA...PAA.AAAA.AAAPAAAAD
; >C:0940 GPA.PAAAAAA.AAPA.AAA.AAPA..AAPA..HAAAAAG
; >C:0968 GPA.PAAAAAA.AA.PAAPAAAA.AAAPAAAAAAPAPPAG
; >C:0990 GAAA.AAP..AAA.AAPA..AAPA..AAA.AAAAPAPPAG
; >C:09b8 GAAA.AAPA.APAAAA.AAAHAAAAAAPAPAA..PAAPAG
; >C:09e0 G..AA.PAAAA.AAPAPAAAA.A..AAAAAAA..TAA.AG
; >C:0a08 GA.AAA.AA.A..AA.A..AAAAAPP.PAAPA.A.PAA.G
; >C:0a30 GAA.TAAPAPAAAA.A..AAAAAAP..PAAPA.A..AAAG
; >C:0a58 GAPA..AAPA..AAA.APAPA.AAA..PAA.AAAA.AAAG
; >C:0a80 GAAAA..APA..AAA.APAPA.APA.A.PAA.PAAAA.AG
; >C:0aa8 GA..AAAA.AAAA..AA.P.PAAPAAAA.AAAPAAA.APG
; >C:0ad0 GAAAAA.A..APPA.AAA..PAA.APAAA.PAAPAPAAAG
; >C:0af8 G.PAAAAAA.AAPA.APAAAA.A..AAPA..PAAAAAAAG
; >C:0b20 G.PAAAAAA.AA.PAAPAAAA.AAAPAAAAAAPAPPAAAG
; >C:0b48 GA.AAPA.AAA.AAPA..A::A..AAA.AAAAPAPPAAAG
; >C:0b70 GA.ATPHAAPAAAA.AAAPAAAAAAPAPHAAAAATPAAAG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveHData:5a8a 08 14 0a 14 01 03 04 05 06 0a 0f 14 14 14 78 6e
5a9a 64 5a 50 02 0e 09 00 00 00 10 08 00 5a 32 02 00
5aaa 14 04 06 14 22 04 14 22 0c 04 00 05 25 14 03 42
5aba 01 07 0c 02 42 01 0f 0c 02 42 1c 05 0b 02 42 1c
5aca 0d 0b 02 43 0e 11 08 02 14 0c 10 00 0e 12 14 13
5ada 12 41 0e 0f 08 02 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 G.A.PAA.A.AA.AAPA.AA%.AAPA..AAPA.PAAA.AG
; >C:08a0 GAPAPPAAAAAA.AAPAAAPAAAA.AAAPAAAAATPAPAG
; >C:08c8 D.PAAPAAA..AAAPAAPA.AAPAPAAABBBBBBBBBBBG
; >C:08f0 GAAAT.AAPA.HAAAAAPAAAAA.AAAAAAAAPP.PAAPG
; >C:0918 GBBBBBBBBBBBBAAPAPAAAA.A..AAAAAAP..PAAPG
; >C:0940 GA..AAA.AAPA..AAPA..AAAA.PPPAAAAA..PAA.G
; >C:0968 GAAA.PAAA.HAA.AAPA..AAAAAPAPPAAPA.A.PAAG
; >C:0990 GAAPA.AAPA.PAAAA.AAAAA.AAAP.PAAPAAAA.AAG
; >C:09b8 GAAAAAP.AAAAAA.A..HPPA.AAA..PAA.APAAAAPG
; >C:09e0 GPAPAAA.A.PAAAAAA.AAPAAAPAAAAPAAAATPA..G
; >C:0a08 GAAAAAAPA.PAAAAAAAAA.PAAPAAABBBBBBBBBBBG
; >C:0a30 GAPPAAAAAA.AAPA.AAA.AAPA..AAPA..AAA.PAAG
; >C:0a58 GBBBBBBBBBBBBPAAAAAAAA.AAAPAAAAAAPAPPAAG
; >C:0a80 GAAPAAA..AAATAAPA.AAPAPPAAAAAAAAAPAPPAAG
; >C:0aa8 GAA.AAPA.APAAACCCCCCCCAAAAAAAAA..PAAPAAG
; >C:0ad0 GPAA.PAAAAPAAP.PAAAT.AA.AAAAAAA..PAAPAAG
; >C:0af8 G.AAA.AAPA.AAAPA..AAAAAPPPPAAPA.A.PAA.PG
; >C:0b20 GA.PAAHAPAAAA.A..AAAAAAPP.PAAPAAA..AAAPG
; >C:0b48 GPA..AAPA..AAAAAPAPA.AAA..PAAPAAAA.AAAPG
; >C:0b70 GAAA..APAP.AAAAAPAPAAAAA...AA.APAAAAPAAG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveIData:5ae1 09 14 05 0a 64 89 8c fb 33 4b 4b 50 55 5a 96 96
5af1 82 82 78 08 04 09 00 00 10 14 00 00 f0 78 00 00
5b01 82 05 0a 0d 0d 00 01 0c 0a 82 19 0a 0d 0d 00 01
5b11 1f 0a 42 11 12 09 02 40 11 13 09 02 25 07 0c 04
5b21 08 0c ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GTTTPPTTPTTPAPPPPTPTTATTPTTPTTTTPPTPTPPG
; >C:08a0 GTPPTTTPPPTPTTPPPPPPTPPTATPTPPPPTPTTPPTG
; >C:08c8 GTTPPPPPPPTPTTPPAPPPTPPTTTPTPAPPTPPPTTPG
; >C:08f0 GPPTPTTPPPPPPTPPTTTAATTPPTPTTPPTPTTAPPTG
; >C:0918 GPPTPTTPPPPPPTPPTATPTPPPPTPTPTPPTTPPTPTG
; >C:0940 GTTTPPTPTATTPPTTPPTTTPPTPTPPPATPTTPPTPTG
; >C:0968 GPPPPPTPPTTTTAAPPPTPTTAPTPTTPAPPTTTTTTPG
; >C:0990 GTPTTBBBBBBBABBBBBTPPPPTPBBBBBBABBBBBBPG
; >C:09b8 GTATTB...........BPTTPPPTB...........BPG
; >C:09e0 GTPTPB.%D........BPTTPPPTB...........BPG
; >C:0a08 GTPPTB...........BPAPPTTPB...........BPG
; >C:0a30 GTPPTB...........BTTTTPTPB...........BTG
; >C:0a58 GPTTTB...........BTPPTATPB...........BTG
; >C:0a80 GPPPPB...........BTPPTTPPB...........BPG
; >C:0aa8 GTPTTB...........BAPTPPTPB...........BPG
; >C:0ad0 GTPTTB...........BBBBBBBBB...........BPG
; >C:0af8 GPPPTB...............................BPG
; >C:0b20 GPPPTB...........BTTAPTPTB...........BPG
; >C:0b48 GTTPPB...........BPPPTPTTB...........BPG
; >C:0b70 GTTAABBBBBBBBBBBBBTPPPTTTBBBBBBBBBBBBBTG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveJData:5b24 0a 14 19 3c 00 00 00 00 00 0c 0c 0c 0c 0c 96 82
5b34 78 6e 64 06 08 09 00 00 00 00 00 00 00 00 00 00
5b44 25 0d 03 04 27 16 54 05 04 11 03 54 15 04 11 05
5b54 80 05 0b 11 03 08 c2 01 04 15 11 00 0d 04 c2 07
5b64 06 0d 0d 00 0d 06 c2 09 08 09 09 00 0d 08 c2 0b
5b74 0a 05 05 00 0d 0a 82 03 06 03 0f 08 00 04 06 54
5b84 04 10 04 04 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GAAAAAAAAAAAA%AAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:08a0 GBBBBBBBBBBBB.BBBBBBBBAAAAAAAAAAAAAAAAAG
; >C:08c8 GBAAAATAAAAAAAAAAAAATBAAAAAAAAAAAAAAAAAG
; >C:08f0 GBAB.BABBBBBB.BBBBBBABAAAAAAAAAAAAAAAAAG
; >C:0918 GBABHBABTAAAAAAAAATBABAAAAAAAAAAAAAAAAAG
; >C:0940 GBABHBABABBBB.BBBBABABAAAAAAAAAAAAAAAAAG
; >C:0968 GBABHBABABTAAAAATBABABAAAAAAAAAAAAAAAAAG
; >C:0990 GBABHBABABABB.BBABABABAAAAAAAAAAAAAAAAAG
; >C:09b8 GBABHB.B.B.B...B.B.B.BAAAAAAAAAAAAAAAAAG
; >C:09e0 GBABHBHBHBHBHHHBHBHBHBAAAAAAAAAAAAAAAAAG
; >C:0a08 GBABHB.B.B.B...B.B.B.BAAAAAAAAAAAAAAAAAG
; >C:0a30 GBABHBABABABBBBBABABABAAAAAAAAAAAAAAAAAG
; >C:0a58 GBABHBABABTAAAAATBABABAAAAAAAAAAAAAAAAAG
; >C:0a80 GBABTBABABBBBBBBBBABABAAAAAAAAAAAAAAAAAG
; >C:0aa8 GBABTBABTAAAAAAAAATBABAAAAAAAAAAAAAAAAAG
; >C:0ad0 GBABTBABBBBBBBBBBBBBABAAAAAAAAAAAAAAAAAG
; >C:0af8 GBABTBTAAAAAAAAAAAAATBAAAAAAAAAAAAAAAAAG
; >C:0b20 GBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAG
; >C:0b48 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0b70 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveKData:5b89 0b 14 32 00 00 04 66 97 64 06 06 06 06 06 78 78
5b99 96 96 f0 0b 08 09 00 00 00 10 08 00 64 50 02 00
5ba9 42 0a 03 09 04 42 14 03 09 04 42 1e 03 09 04 42
5bb9 09 16 09 00 42 0c 0f 11 02 42 05 0b 09 02 42 0f
5bc9 0b 09 02 42 19 0b 09 02 42 1c 13 0b 01 14 04 03
5bd9 14 0e 03 14 18 03 14 22 03 14 04 16 14 23 15 25
5be9 14 14 04 26 11 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GPAPTAPPPABAAATPPAAPBAAATAAAPABAAATPAPAG
; >C:08a0 GAAA.APAPABAAAP.PAAPBPAAAAPAAPBPAAAPAPPG
; >C:08c8 GAAAA.AAPPBAPAAAAPAABAAPA.PPAABAAAAPAPPG
; >C:08f0 GPAPAA.PPPBAPAAAA.AABPAAAAAAPABPAAAAAAPG
; >C:0918 GPA.AAAPAABA..AAPAPPBAAAAAAAPABPAAAAAA.G
; >C:0940 GPPAAPAAAABAAAPAAAAABPAPPAAAAABPAAP.PAAG
; >C:0968 GAAPAPPAAPBPPAAAPAAABPAPPAAAAABPAAPA.ABG
; >C:0990 GAAPAAAPAABAAAPAPAAPBPAAPA.APPBA.PAAHBPG
; >C:09b8 GPAPABBBBBBBBBHBBBBBBBBBPBBBBBBBBBAABA.G
; >C:09e0 GAPA..AAAAAPPPPAAPAPAPPAAPPAAA.PAAPBPAAG
; >C:0a08 GPAPPAAAAAAPPPPAAPA.A.PAAAPAAPAPPABPAPPG
; >C:0a30 GA.APAPA.BAAPPPAAPAAAA.AAAPAAAAAPBAPAPPG
; >C:0a58 GA.APAPA.BPABBBBBBBBBBBBBBBBBPPABAAPAAAG
; >C:0a80 GPAA.PPPABPAAAAPAAAPAAA.APPAAAABAPAPPAPG
; >C:0aa8 GPAAAPPPABPAPAAA.PAAPAPAAAPAPPBAAAAAPADG
; >C:0ad0 G.APAAAAPB..AAPAPPPAAAAAAAPAPBAAAAAA.AAG
; >C:0af8 GAAPAAAA.BAAPAAAAAAPAPPAAAAABPAAPAPAAAPG
; >C:0b20 GPAPPAAPABPAAAPAAAAP%PPAAAAAAPAAPHAAPAAG
; >C:0b48 GPAAAPAAABAAPAPHAAAAAAPAAA.PAA.PAAPTPAAG
; >C:0b70 GPPATA.AABAAPAPPAAAAAAPAAPA.PAHAPPAPAAAG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveLData:5bef 0c 14 14 00 00 3c 02 3b 66 13 13 0e 10 15 b4 aa
5bff a0 a0 a0 0c 0a 09 00 00 00 10 14 00 3c 32 09 00
5c0f 42 0a 05 12 04 42 0e 05 12 04 42 12 05 12 04 42
5c1f 16 05 12 04 42 02 06 0b 02 42 02 0a 0b 02 42 02
5c2f 0e 0f 02 42 02 12 0b 02 81 1e 04 04 04 00 08 20
5c3f 05 81 1e 09 04 04 00 08 20 0a 81 1e 0e 04 04 00
5c4f 08 20 0f 25 03 14 04 27 16 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GPA.AAAPPAAAAAPAPAAPAAAAAAAAPAAAAAPAATAG
; >C:08a0 GAAAAATAPAAAAAAA.AAAAPAAAAPAAPAAAAA.AAPG
; >C:08c8 GAAAAAAAPTBAPABAA.BAAABPAAAPAAA.HAA.AA.G
; >C:08f0 GTBBBBBBBBBBBABAAABAAPBAAAAAPAA..AAAAAAG
; >C:0918 GPAAAAAAAABAAABAPAB.TABAAAAAPAAAAAAAAAAG
; >C:0940 GPPAAPAAAABAAABAAABAAPBPPAAAAAAPAATAAAAG
; >C:0968 GAAPAAAAAPBPPABAAABAAPBPPAAAAAAAAAPAAAPG
; >C:0990 GABBBBBBBBBBBABAPAB.APBAPAAAAPA.HAAATAPG
; >C:09b8 GPAPAAAAAABAAABAPABAAPBAPAATAAA..AAAPAAG
; >C:09e0 GAPAAAAAAABPP.BAATBAA.BAAAPAAAAAAATAPAAG
; >C:0a08 G.AAAAAAAABPP.BAAPBAAABAAA.AAPAAAAAPAAAG
; >C:0a30 GABBBBBBBBBBBBBBBPBAAABAAAPAAAAAAAAPA..G
; >C:0a58 GAAAPAPAAABAAABPAABPAABAPAAPAPA.HAAAAAAG
; >C:0a80 GAAAAP.PAABAAABAAABTAABAAP.AAAA..AAAAATG
; >C:0aa8 GAAAA.APAABATABAAPBAPABAAAPA.PAAAAAAAAAG
; >C:0ad0 GABBBBBBBBBBBABAAABAAABAAAPA.PAAAAAAAAAG
; >C:0af8 GAAPAAAAAABAPABAAABPAPBAAAAAA.AAPAAAAAAG
; >C:0b20 GPA%AAAPA.BAAABAAABPAPBAAAAAAAAAPTAAPAAG
; >C:0b48 GAAAAPAAAABAPABTAABAAABAAAA.AAAPAATA.AAG
; >C:0b70 GPPAAAAAAABAPABTAABAAABAAPAATATAPAAPAAAD
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveMData:5c59 0d 8c 05 08 00 01 02 03 04 32 37 3c 46 50 a0 9b
5c69 96 91 8c 06 08 0d 00 00 10 00 00 00 28 00 00 00
5c79 25 12 03 04 0a 03 3a 14 03 42 05 12 1e 02 70 05
5c89 13 1e 02 50 05 14 1e 02 c1 05 15 1e 02 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GPAAAAAPPADAAAAAPA%P:AAAAAAAPAAAAAAAAPAG
; >C:08a0 GAAAAAPAPAAAAAAAAAAAAPAAAAPAAPAPAAAAAAAG
; >C:08c8 GAAAAAAAAPAAPAAAAAAAAAAAAAAPAAAAAAAAAAAG
; >C:08f0 GPAAAAAAAPAAAAAAAAAAAPAAAAAAPAAPAAAAAAAG
; >C:0918 GPAAAAAAAAPAAAAAPAAAPAAAAAAAPAAPAAAAAAAG
; >C:0940 GAPAAPAAAAAAAAPAAAAAAPAPPAAAAAAAAAPAAAAG
; >C:0968 GAAPAAAAAPAAAAAAAAAAAPAPPAAAAAAAAAPAAAPG
; >C:0990 GAAAAAAPAAAAAAPAPAAAAPAAPAAAAAAAAPAAPAAG
; >C:09b8 GPAPAAAAAAAAAAPAPAAAAAAAAAAPAAAAAAAAAAAG
; >C:09e0 GAAAAAAAAAAPPAPAAPAAAAPAAAPAAAAPAAPAPAAG
; >C:0a08 GAAAAAAAAAAPAAPAAPAAAAAAAAAAAPAAAAAPAAAG
; >C:0a30 GAAAPAPAAAAAAAPAAAAAAAAAAAPAAAAAAAAPAAAG
; >C:0a58 GAAAPAPAAAPAAAAPAAAPAAAAAAAPAAAAAAAAAAAG
; >C:0a80 GAAAAPAPAAPAAAAAAAAPAAAAAPAAAAAAAAAAAAPG
; >C:0aa8 GAAAAAAPAAAAPAAAAPAAPAPAAAAAAPAAAAAAAAAG
; >C:0ad0 GAAPABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAAAAG
; >C:0af8 GAAPA000000000000000000000000000000AAAAG
; >C:0b20 GPAAAPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPAPAAG
; >C:0b48 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0b70 GAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPAAAG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveNData:5c97 0e 14 0a 14 00 00 00 00 00 1e 23 28 2a 2d 96 91
5ca7 8c 87 82 0c 08 09 00 00 10 00 00 00 00 00 00 00
5cb7 81 0a 0a 0d 0d 00 70 0b 0b 0c 03 c1 0c 0a 03 0d
5cc7 c1 10 0a 03 0d c1 14 0a 03 0d 50 16 08 0c 02 48
5cd7 16 07 0c 02 c1 17 06 03 04 c1 1b 06 03 04 c1 1f
5ce7 06 03 04 25 03 03 04 27 14 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GAA%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:08a0 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:08c8 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:08f0 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0918 GAAAAAAAAAAAAAAAAAAAAAHAHAHAHAHAHAAAAAAG
; >C:0940 GAAAAAAAAAAAAAAAAAAAAAPAPAPAPAPAPAAAAAAG
; >C:0968 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0990 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:09b8 GAAAAAAAAAA0A.A.A.A.A.AAAAAAAAAAAAAAAAAG
; >C:09e0 GAAAAAAAAAA.A.A.A.A.A.AAAAAAAAAAAAAAAAAG
; >C:0a08 GAAAAAAAAAA.A0A.A.A.A.AAAAAAAAAAAAAAAAAG
; >C:0a30 GAAAAAAAAAA.A.A.A.A.A.AAAAAAAAAAAAAAAAAG
; >C:0a58 GAAAAAAAAAA.A.A0A.A.A.AAAAAAAAAAAAAAAAAG
; >C:0a80 GAAAAAAAAAA.A.A.A.A.A.AAAAAAAAAAAAAAAAAG
; >C:0aa8 GAAAAAAAAAA.A.A.A0A.A.AAAAAAAAAAAAAAAAAG
; >C:0ad0 GAAAAAAAAAA.A.A.A.A.A.AAAAAAAAAAAAAAAAAG
; >C:0af8 GAAAAAAAAAA.A.A.A.A0A.AAAAAAAAAAAAAAAAAG
; >C:0b20 GAAAAAAAAAA.A.A.A.A.A.AAAAAAAAAAAAAAAAAD
; >C:0b48 GAAAAAAAAAA.A.A.A.A.A0AAAAAAAAAAAAAAAAAG
; >C:0b70 GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveOData:5cf1 0f 08 0a 14 01 1d 1e 1f 20 0f 14 14 19 1e 78 78
5d01 78 78 8c 08 0e 09 00 00 00 10 08 00 64 50 02 00
5d11 42 02 04 0a 03 42 0f 0d 0a 01 41 0c 0e 03 02 43
5d21 0c 0f 03 02 04 14 16 25 14 03 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GPAPPAA..PAAPAAPAPAA%PAAPAPPAAPAPPAAAPAG
; >C:08a0 GABAPPAAAAAAPAAPAAAPAAAABAAAPAAAAAAPAPAG
; >C:08c8 GPPBAPAAA.PAA.PAAPAPAAPBPAAAA.AA.AAPAPHG
; >C:08f0 GAAABPAAPA.HAAAAAPA.AABPA..AAAAAPPPPAAPG
; >C:0918 GAPPABPPAAA.PAAPAPAAABPA.PAAAAAAPPPPAAPG
; >C:0940 GA.PAABPAAPAP.AAPAPPBAAA.PPPA.AAAPPPAAPG
; >C:0968 GAAAPPABA.HAAPAAPAPBAAAAAPAPPAAPAPAPPAAG
; >C:0990 GAAPAPAABAPPAAAA.ABAAAPAA.PPPAAPAAAAPAAG
; >C:09b8 GAAA.APPABAAAAPA.BHPPA.AAAPPPAAPAPAAA.PG
; >C:09e0 GPAPAAAPAPBAAAAABPAAPA.APAAAAPA..AAPAPPG
; >C:0a08 GAAAAAAPAPPBAAABA.AAPPAAPAAAA.AAAPAAAAAG
; >C:0a30 GAPPAAAAAAPAAAAPAAAPAAPAP.AAPAPPAAA.PAAG
; >C:0a58 GAPPAAAAAAPACCCAAPAAAAPAAAPAAAAAAPAPPAAG
; >C:0a80 GAAPAAA.PAAAPAAPAPAAPAPPAAA.AAAAAPAPPAAG
; >C:0aa8 GAAPAAPA.APAAAAPAAAAAPA..AAAAAAPPPAAPA.G
; >C:0ad0 GPAA.PAAAAPAAPAPAAAAPA..AAAAAAAPPPAAPAAG
; >C:0af8 GPAAAPAAPA..AAPA..AAAA.PPPPAAPAPAPPAAPPG
; >C:0b20 GA.PAAH.PAAAAPAPPAAAAAAPPPPAAPA.APPAA.PG
; >C:0b48 GPAPPAAPAPPAAA.APAPA.AAAPPPAAPAAAA.AAAPG
; >C:0b70 GAAAPPAPAPPAAA.APAPADAAAP.PAAPAPAAAAPAAG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CavePData:5d2c 10 14 0a 14 01 78 81 7e 7b 0c 0f 0f 0f 0c 96 96
5d3c 96 96 96 09 0a 09 00 00 10 00 00 00 32 00 00 00
5d4c 25 01 03 04 27 04 81 08 13 04 04 00 08 0a 14 c2
5d5c 07 0a 06 08 43 07 0a 06 02 81 10 13 04 04 00 08
5d6c 12 14 c2 0f 0a 06 08 43 0f 0a 06 02 81 18 13 04
5d7c 04 00 08 1a 14 81 20 13 04 04 00 08 22 14 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 G%AAPAAAAAAAAAAPAAAAAAAAPAAAAAPAAPAAAAAG
; >C:08a0 GAPAPPAAAAAAAAAPAAAPAAAAAAAAPAAAAAAPAPAD
; >C:08c8 GAPAAPAAAAAAAAPAAPAAAAPAPAAAAAAAAAAPAPPG
; >C:08f0 GAAAAAAAPAAPAAAAAPAAAAAAAAAAAAAAPPAPAAPG
; >C:0918 GAAPAAAPAAAAPAAPAPAAAAAAAAAAAAAAPAAPAAPG
; >C:0940 GAAAAAAAAAPAAAAAPAAAAAAAAPPPAAAAAAAPAAAG
; >C:0968 GAAAAPAAAAPAAAAAPAAAAAAAAPAPPAAPAAAAPAAG
; >C:0990 GAAPAAACCCCCCAACCCCCCAAAAAPAPAAPAAAAAAAG
; >C:09b8 GAAAAAPBAAAABAABAAPPBAAAAAAAPAAAAPAAAAPG
; >C:09e0 GPAPAAABAAPABAABAAAABAAAPAAAAPAAAAAPAAAG
; >C:0a08 GAAAAAABAAPABAABAAAABPAAPAAAAAAAAPAAAAAG
; >C:0a30 GAPPAAABAAAABPABAAAABAPAAAAAPAAAAAAAPAAG
; >C:0a58 GAPPAAABAAAABPPBAPAABAAAAAPAAAAAAPAPPAAG
; >C:0a80 GAAPAAABAAAABAABAAAABAPPAAAAAAAAAPAPPAAG
; >C:0aa8 GAAAAAPBBBBBBAABBBBBBAAAAAAAAAAAAPAAPAAG
; >C:0ad0 GPAAAPAAAAPAAPAPAAAAAAAAAAAAAAAAAPAAPAAG
; >C:0af8 GAAAAAAAAAAAAAPAAAAAAAAPAAAAAPAAAAAAAAPG
; >C:0b20 GAAPAAPAA.HAAAAAA.HAAAAPA.HAAPAAA.HAAAPG
; >C:0b48 GPAAAAAPA..AAAAAA..AAAAAA..AAPAAA..AAAPG
; >C:0b70 GAAAAAAPAAAAAAAAAAAAAAAAAAAAAAAPAAAAPAAG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveBonusQData:5d8b 11 14 1e 00 0a 0b 0c 0d 0e 06 06 06 06 06 0a 0a
5d9b 0a 0a 0a 0e 02 09 00 00 00 14 00 00 ff 09 00 00
5dab 87 00 02 28 16 07 87 00 02 14 0c 00 32 0a 0c 10
5dbb 0a 04 01 0a 05 25 03 05 04 12 0c ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 G..................GGGGGGGGGGGGGGGGGGGGG
; >C:08a0 G.........P........GGGGGGGGGGGGGGGGGGGGG
; >C:08c8 G..%......A........GGGGGGGGGGGGGGGGGGGGG
; >C:08f0 G..................GGGGGGGGGGGGGGGGGGGGG
; >C:0918 G..................GGGGGGGGGGGGGGGGGGGGG
; >C:0940 G..................GGGGGGGGGGGGGGGGGGGGG
; >C:0968 G..................GGGGGGGGGGGGGGGGGGGGG
; >C:0990 G..................GGGGGGGGGGGGGGGGGGGGG
; >C:09b8 G..................GGGGGGGGGGGGGGGGGGGGG
; >C:09e0 G.........2.......DGGGGGGGGGGGGGGGGGGGGG
; >C:0a08 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0a30 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0a58 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0a80 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0aa8 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0ad0 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0af8 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b20 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b48 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b70 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveBonusRData:5dc7 12 14 0a 00 0a 0b 0c 0d 0e 10 10 10 10 10 0f 0f
5dd7 0f 0f 0f 06 0f 09 00 00 00 00 00 00 00 00 00 00
5de7 87 00 02 28 16 07 87 00 02 14 0c 01 50 01 03 09
5df7 03 48 02 03 08 03 54 01 05 08 03 50 01 06 07 03
5e07 50 12 03 09 05 54 12 05 08 05 50 12 06 07 05 25
5e17 01 04 04 12 04 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GPHAAAAAAAAAAAAAAAPGGGGGGGGGGGGGGGGGGGGG
; >C:08a0 G%PHAAAAAAAAAAAAAPDGGGGGGGGGGGGGGGGGGGGG
; >C:08c8 GTAPHAAAAAAAAAAAPATGGGGGGGGGGGGGGGGGGGGG
; >C:08f0 GPTAPHAAAAAAAAAPATPGGGGGGGGGGGGGGGGGGGGG
; >C:0918 GAPTAPHAAAAAAAPATPAGGGGGGGGGGGGGGGGGGGGG
; >C:0940 GAAPTAPHAAAAAPATPAAGGGGGGGGGGGGGGGGGGGGG
; >C:0968 GAAAPTAPHAAAPATPAAAGGGGGGGGGGGGGGGGGGGGG
; >C:0990 GAAAAPTAPHAPATPAAAAGGGGGGGGGGGGGGGGGGGGG
; >C:09b8 GAAAAAPTAPPATPAAAAAGGGGGGGGGGGGGGGGGGGGG
; >C:09e0 GAAAAAAPTAATPAAAAAAGGGGGGGGGGGGGGGGGGGGG
; >C:0a08 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0a30 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0a58 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0a80 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0aa8 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0ad0 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0af8 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b20 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b48 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b70 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveBonusSData:5e1d 13 04 0a 00 0a 0b 0c 0d 0e 0e 0e 0e 0e 0e 14 14
5e2d 14 14 14 06 08 09 00 00 00 00 00 00 00 00 00 00
5e3d 87 00 02 28 16 07 87 00 02 14 0c 00 54 01 0c 12
5e4d 02 88 0f 09 04 04 08 25 08 03 04 12 07 ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 G.......%..........GGGGGGGGGGGGGGGGGGGGG
; >C:08a0 G..................GGGGGGGGGGGGGGGGGGGGG
; >C:08c8 G..................GGGGGGGGGGGGGGGGGGGGG
; >C:08f0 G..................GGGGGGGGGGGGGGGGGGGGG
; >C:0918 G.................DGGGGGGGGGGGGGGGGGGGGG
; >C:0940 G..................GGGGGGGGGGGGGGGGGGGGG
; >C:0968 G..............HHHHGGGGGGGGGGGGGGGGGGGGG
; >C:0990 G..............HHHHGGGGGGGGGGGGGGGGGGGGG
; >C:09b8 G..............HHHHGGGGGGGGGGGGGGGGGGGGG
; >C:09e0 GTTTTTTTTTTTTTTHHHHGGGGGGGGGGGGGGGGGGGGG
; >C:0a08 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0a30 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0a58 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0a80 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0aa8 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0ad0 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0af8 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b20 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b48 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b70 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
CaveBonusTData:5e5b 14 03 1e 00 00 00 00 00 00 06 06 06 06 06 14 14
5e6b 14 14 14 06 08 09 00 00 00 00 00 00 00 00 00 00
5e7b 87 00 02 28 16 07 87 00 02 14 0c 01 d0 0b 03 03
5e8b 02 80 0b 07 03 06 00 43 0b 06 03 02 43 0b 0a 03
5e9b 02 50 08 07 03 03 25 03 03 04 09 0a ff
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GAA%AAAAAAAPPPAAAAAGGGGGGGGGGGGGGGGGGGGG
; >C:08a0 GAAAAAAAAAAPPPAAAAAGGGGGGGGGGGGGGGGGGGGG
; >C:08c8 GAAAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGGGGGGG
; >C:08f0 GAAAAAAAAAACCCAAAAAGGGGGGGGGGGGGGGGGGGGG
; >C:0918 GAAAAAAAPAA...AAAAAGGGGGGGGGGGGGGGGGGGGG
; >C:0940 GAAAAAAAAPA...AAAAAGGGGGGGGGGGGGGGGGGGGG
; >C:0968 GAAAAAAAAAP...AAAAAGGGGGGGGGGGGGGGGGGGGG
; >C:0990 GAAAAAAAADACCCAAAAAGGGGGGGGGGGGGGGGGGGGG
; >C:09b8 GAAAAAAAAAA...AAAAAGGGGGGGGGGGGGGGGGGGGG
; >C:09e0 GAAAAAAAAAA...AAAAAGGGGGGGGGGGGGGGGGGGGG
; >C:0a08 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0a30 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0a58 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0a80 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0aa8 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0ad0 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0af8 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b20 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b48 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b70 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
DemoMoveData:5ea8 ff ff 1e 77 2d 97 4f 2d 47 3e 1b 4f 1e b7 1d 27
5eb8 4f 6d 17 4d 3b 4f 1d 1b 47 3b 4f 4e 5b 3e 5b 4d
5ec8 3b 5f 3e ab 1e 3b 1d 6b 4d 17 4f 3d 47 4d 4b 2e
5ed8 27 3e a7 a7 1d 47 1d 47 2d 5f 57 4e 57 6f 1d 00
;
ObjCodeFromScannedThisTickCodeTable:5ee8 00 00 00 00 00 00 00 00 00 00 00 00 08 09 0a 0b
5ef8 00 10 00 12 00 14 00 16 00 00 00 00 00 00 00 00
5f08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
5f18 00 00 00 00 30 31 32 33 00 38 00 3a 00 00 00 00
;
; Cells contain values that represent a game object in a specific
; state, like a falling/stationary boulder for example. A falling and
; a stationary boulder still look like a boulder. This table translates
; a cell's value to the base character for that object.
BaseCharNoForObjectTable:5f28 60 46 4e 22 2e 62 2e 4a 64 64 64 64 64 64 64 64
5f38 44 44 44 44 48 48 48 48 00 00 00 66 68 6a 68 66
5f48 24 26 28 2a 2c 62 66 68 6a 00 00 00 00 00 00 00
5f58 20 20 20 20 20 20 20 20 4c 4c 40 40 00 00 00 00
;
ObjHandlerVectorTable:; $00[.] - Space
; $01[A] - Dirt
; $02[B] - Brick wall
; $03[C] - Magic wall
; $04[D] - Hidden outbox
; $05[E] - Outbox
; $06[F] - Fragile steel wall
; $07[G] - Steel wall
; $08[H] - Firefly (left)
; $09[I] - Firefly (up)
; $0a[J] - Firefly (right)
; $0b[K] - Firefly (down)
; $0c[L] - *Firefly (left)
; $0d[M] - *Firefly (up)
; $0e[N] - *Firefly (right)
; $0f[O] - *Firefly (down)
; $10[P] - Boulder (stationary)
; $11[Q] - *Boulder (stationary)
; $12[R] - Boulder (falling)
; $13[S] - *Boulder (falling)
; $14[T] - Diamond (stationary)
; $15[U] - *Diamond (stationary)
; $16[V] - Diamond (falling)
; $17[W] - *Diamond (falling)
; $1b[[] - Explosion to space (stage 0) (to be scanned explosions start here)
; $1c[\] - Explosion to space (stage 1) (scanned explosions start here)
; $1d[]] - Explosion to space (stage 2)
; $1e[^] - Explosion to space (stage 3)
; $1f[_] - Explosion to space (stage 4)
; $20[ ] - Explosion to diamond (stage 0) (to be scanned explosions start here)
; $21[!] - Explosion to diamond (stage 1) (scanned explosions start here)
; $22["] - Explosion to diamond (stage 2)
; $23[#] - Explosion to diamond (stage 3)
; $24[$] - Explosion to diamond (stage 4)
; $25[%] - Inbox (Rockford's initial position)
; $26[&] - Pre-Rockford (stage 1)
; $27['] - Pre-Rockford (stage 2)
; $28[(] - Pre-Rockford (stage 3)
; $30[0] - Butterfly (down)
; $31[1] - Butterfly (left)
; $32[2] - Butterfly (up)
; $33[3] - Butterfly (right)
; $34[4] - *Butterfly (down)
; $35[5] - *Butterfly (left)
; $36[6] - *Butterfly (up)
; $37[7] - *Butterfly (right)
; $38[8] - Rockford
; $39[9] - *Rockford
; $3a[:] - Amoeba
; $3b[;] - *Amoeba
; * = SCANNED
; [x] = 'x' is char shown with VICE monitor's 'i' command
5f68 | $0000 | $0000 | $0000 | $0000 |
5f70 | ProcessHiddenOutbox | ProcessInAndOutBoxes | $0000 | $0000 |
5f78 | ProcessFirefly | ProcessFirefly | ProcessFirefly | ProcessFirefly |
5f80 | $0000 | $0000 | $0000 | $0000 |
5f88 | ProcessStationaryBoulder | $0000 | ProcessFallingBoulder | $0000 |
5f90 | ProcessStationaryDiamond | $0000 | ProcessFallingDiamond | $0000 |
5f98 | $0000 | $0000 | $0000 | ProcessExplosion |
5fa0 | ProcessExplosion | ProcessExplosion | ProcessExplosion | ProcessExplosion |
5fa8 | ProcessExplosion | ProcessExplosion | ProcessExplosion | ProcessExplosion |
5fb0 | ProcessExplosion | ProcessInAndOutBoxes | ProcessRockfordsAppearance | ProcessRockfordsAppearance |
5fb8 | ProcessRockfordsAppearance | $0000 | $0000 | $0000 |
5fc0 | $0000 | $0000 | $0000 | $0000 |
5fc8 | ProcessButterfly | ProcessButterfly | ProcessButterfly | ProcessButterfly |
5fd0 | $0000 | $0000 | $0000 | $0000 |
5fd8 | ProcessRockford | $0000 | ProcessAmoeba | $0000 |
5fe0 | $0000 | $0000 | $0000 | $0000 |
; MusicData ($5fe8-$60e7) is copied to CopiedMusicData ($3000-$30ff).
; MusicData and GameCharData (below) are copied together to $3000 by InitAll.
; The music data occupies exactly 256 bytes, and the charset 768 (1k in total).
5fe8 16 22 1d 26 22 29 25 2e 14 24 1f 27 20 29 27 30
5ff8 12 2a 12 2c 1e 2e 12 31 20 2c 33 37 21 2d 31 35
6008 16 22 16 2e 16 1d 16 24 14 20 14 30 14 24 14 20
6018 16 22 16 2e 16 1d 16 24 1e 2a 1e 3a 1e 2e 1e 2a
6028 14 20 14 2c 14 1b 14 22 1c 28 1c 38 1c 2c 1c 28
6038 11 1d 29 2d 11 1f 29 2e 0f 27 0f 27 16 33 16 27
6048 16 2e 16 2e 16 2e 16 2e 22 2e 22 2e 16 2e 16 2e
6058 14 2e 14 2e 14 2e 14 2e 20 2e 20 2e 14 2e 14 2e
6068 16 2e 32 2e 16 2e 33 2e 22 2e 32 2e 16 2e 33 2e
6078 14 2e 32 2e 14 2e 33 2e 20 2c 30 2c 14 2c 31 2c
6088 16 2e 16 3a 16 2e 35 38 22 2e 22 37 16 2e 31 35
6098 14 2c 14 38 14 2c 14 38 20 2c 20 33 14 2c 14 38
60a8 16 2e 32 2e 16 2e 33 2e 22 2e 32 2e 16 2e 33 2e
60b8 14 2e 32 2e 14 2e 33 2e 20 2c 30 2c 14 2c 31 2c
60c8 2e 32 29 2e 26 29 22 26 2c 30 27 2c 24 27 14 20
60d8 35 32 32 2e 2e 29 29 26 27 30 24 2c 20 27 14 20
GameCharData:; GameCharData ($60e8-$63e7) copied to GameTiles ($3100-$33ff).
; As mentioned above InitAll copies MusicData and GameCharData to $3000.
; $3000 is used as the in-game character set (not counting the marquee) and is
; accessed by the VIC. Since the music data is 256 bytes, and 256/8 is 32, the
; first character is $20. Any character less than that will interpret music
; data as graphics.
60e8RockfordAnimationChars:
63e8
Top2LinesAndBoulderDashLogo:
; m-i-c-r-o-..f-u-n-.*-.m-i-c-r-o-..f-u-n-
; ............p-r-e-s-e-n-t-s-............
66e8 2d 61 29 5d 23 57 32 66 2f 63 20 20 26 5a 35 69
66f8 2e 62 20 74 75 20 2d 61 29 5d 23 57 32 66 2f 63
6708 20 20 26 5a 35 69 2e 62 20 20 20 20 20 20 20 20
6718 20 20 20 20 30 64 32 66 25 59 33 67 25 59 2e 62
6728 34 68 33 67 20 20 20 20 20 20 20 20 20 20 20 20
; >C:6738 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
; >C:6760 C......................................C
; >C:6788 C.HCCCI................................C
; >C:67b0 C.HC..H.HCCC.HC.H.HC...HCCI.HCCC.HCCI..C
; >C:67d8 C.HCCCJ.HC.H.HC.H.HC...HC.H.HC...HC.H..C
; >C:6800 C.HCCCI.HC.H.HC.H.HC...HC.H.HCC..HCCJ..C
; >C:6828 C.HC..H.HC.H.HC.H.HC...HC.H.HC...HCCI..C
; >C:6850 C.HCCCJ.HCCC.HCCC.HCCC.HCCJ.HCCC.HC.H..C
; >C:6878 C......................................C
; >C:68a0 C......HCCCI...........................C
; >C:68c8 C......HC..H..HCI.HCCC.HC..H.]^_.......C
; >C:68f0 C......HC..H.HC.H.HC...HC..H...........C
; >C:6918 C......HC..H.HCCC.HCCC.HCCCC...........C
; >C:6940 C......HC..H.HC.H...HC.HC..H...........C
; >C:6968 C......HCCCJ.HC.H.HCCC.HC..H...........C
; >C:6990 C......................................C
; >C:69b8 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
6738 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
6748 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
6758 03 03 03 03 03 03 03 03 03 00 00 00 00 00 00 00
6768 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
6778 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03
6788 03 00 08 03 03 03 09 00 00 00 00 00 00 00 00 00
6798 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
67a8 00 00 00 00 00 00 00 03 03 00 08 03 00 00 08 00
67b8 08 03 03 03 00 08 03 00 08 00 08 03 00 00 00 08
67c8 03 03 09 00 08 03 03 03 00 08 03 03 09 00 00 03
67d8 03 00 08 03 03 03 0a 00 08 03 00 08 00 08 03 00
67e8 08 00 08 03 00 00 00 08 03 00 08 00 08 03 00 00
67f8 00 08 03 00 08 00 00 03 03 00 08 03 03 03 09 00
6808 08 03 00 08 00 08 03 00 08 00 08 03 00 00 00 08
6818 03 00 08 00 08 03 03 00 00 08 03 03 0a 00 00 03
6828 03 00 08 03 00 00 08 00 08 03 00 08 00 08 03 00
6838 08 00 08 03 00 00 00 08 03 00 08 00 08 03 00 00
6848 00 08 03 03 09 00 00 03 03 00 08 03 03 03 0a 00
6858 08 03 03 03 00 08 03 03 03 00 08 03 03 03 00 08
6868 03 03 0a 00 08 03 03 03 00 08 03 00 08 00 00 03
6878 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
6888 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
6898 00 00 00 00 00 00 00 03 03 00 00 00 00 00 00 08
68a8 03 03 03 09 00 00 00 00 00 00 00 00 00 00 00 00
68b8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03
68c8 03 00 00 00 00 00 00 08 03 00 00 08 00 00 08 03
68d8 09 00 08 03 03 03 00 08 03 00 00 08 00 1d 1e 1f
68e8 00 00 00 00 00 00 00 03 03 00 00 00 00 00 00 08
68f8 03 00 00 08 00 08 03 00 08 00 08 03 00 00 00 08
6908 03 00 00 08 00 00 00 00 00 00 00 00 00 00 00 03
6918 03 00 00 00 00 00 00 08 03 00 00 08 00 08 03 03
6928 03 00 08 03 03 03 00 08 03 03 03 03 00 00 00 00
6938 00 00 00 00 00 00 00 03 03 00 00 00 00 00 00 08
6948 03 00 00 08 00 08 03 00 08 00 00 00 08 03 00 08
6958 03 00 00 08 00 00 00 00 00 00 00 00 00 00 00 03
6968 03 00 00 00 00 00 00 08 03 03 03 0a 00 08 03 00
6978 08 00 08 03 03 03 00 08 03 00 00 08 00 00 00 00
6988 00 00 00 00 00 00 00 03 03 00 00 00 00 00 00 00
6998 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
69a8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03
69b8 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
69c8 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
69d8 03 03 03 03 03 03 03 03
Top2LinesAndBoulderDashLogo__Junk:69e0 20 20 20 20 20 20 20 2c
LicenseText:; .......l-i-c-e-n-s-e-d-..f-r-o-m-.......
; .......c-r-a-c-k-e-d-..b-y-..n-o-v-a-...
; ..............c-..1-9-8-4-..............
; .f-i-r-s-t-..s-t-a-r-..s-o-f-t-w-a-r-e-.
; m-i-c-r-o-..f-u-n-.*-.m-i-c-r-o-..f-u-n-
; ........................................
69e8 60 29 5d 23 57 25 59 2e 62 33 67 25 59 24 58 20
69f8 20 26 5a 32 66 2f 63 2d 61 20 20 20 20 20 20 20
6a08 20 20 20 20 20 20 20 23 57 32 66 21 55 23 57 2b
6a18 5f 25 59 24 58 20 20 22 56 39 6d 20 20 2e 62 2f
6a28 63 36 6a 21 55 20 20 20 20 20 20 20 20 20 20 20
6a38 20 20 20 20 20 20 23 57 20 20 11 45 19 4d 18 4c
6a48 14 48 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6a58 20 26 5a 29 5d 32 66 33 67 34 68 20 20 33 67 34
6a68 68 21 55 32 66 20 20 33 67 2f 63 26 5a 34 68 37
6a78 6b 21 55 32 66 25 59 20 2d 61 29 5d 23 57 32 66
6a88 2f 63 20 20 26 5a 35 69 2e 62 20 74 75 20 2d 61
6a98 29 5d 23 57 32 66 2f 63 20 20 26 5a 35 69 2e 62
6aa8 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6ab8 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6ac8 20 20 20 20 20 20 20 20
;
; Generate a "random" number based on CIA timers (and the state of the C flag).
; The operation is pretty self explanatory. About the only point of interest is
; the addition without regard to state of the carry flag.
TimeBasedRandomNumber:6ad0 ad 04 dc LDA Cia1_TimerALo
6ad3 4d 05 dc EOR Cia1_TimerAHi
6ad6 4d 04 dd EOR Cia2_TimerALo
6ad9 6d 05 dd ADC Cia2_TimerAHi ; The C flag has a say in things! A bit of extra entropy is sometimes a good thing.
6adc 4d 06 dd EOR Cia2_TimerBLo
6adf 4d 07 dd EOR Cia2_TimerBHi
6ae2 60 RTS
;
; A: Colour to set
; Y: Start offset.
; The portion of the first line not covered by Y is set to MCM white (brown non-MCM).
SetupColourRam:6ae3 48 PHA
; Make first line MCM white (brown non-MCM).
6ae4 a2 27 LDX #$27
6ae6 a9 09 LDA #$09
_MarqueeLoop:6ae8 9d 00 d8 STA C64_ColourRam,X
6aeb ca DEX
6aec 10 fa BPL _MarqueeLoop
6aee a2 00 LDX #<C64_ColourRam
6af0 86 46 STX LocalVar
6af2 a2 d8 LDX #>C64_ColourRam
6af4 86 47 STX LocalVar+1
6af6 a2 03 LDX #$03
6af8 68 PLA
_BodyLoop:6af9 91 46 STA (LocalVar),Y
6afb c8 INY
6afc d0 fb BNE _BodyLoop
6afe e6 47 INC LocalVar+1
6b00 ca DEX
6b01 10 f6 BPL _BodyLoop
6b03 60 RTS
;
; Saves the top line. Nothing exciting except for the fact that only
; the first character of each pair (most glyphs are two characters wide)
; is saved to save space.
BackupTopLine:6b04 a2 00 LDX #$00
6b06 a0 00 LDY #$00
6b08 bd 00 0c LDA GameTileMap1_or_TitleTextTileMap,X
6b0b 99 62 98 STA TopLineBackup,Y
6b0e e8 INX
6b0f e8 INX
6b10 c8 INY
6b11 c0 14 CPY #$14
6b13 d0 f3 BNE $6b08
6b15 60 RTS
;
; Set the text for the top line. Sniffs the buffer and
; colours the text using various dopy heuristics.
; IN: LocalVar ($46 & $47) points to the text.
SetTopLineText:6b16 a2 01 LDX #$01 ; 1 = White
6b18 a0 03 LDY #$03
6b1a b1 46 LDA (LocalVar),Y
6b1c c9 3c CMP #$3c ; $3c is left half of diamond character.
6b1e d0 02 BNE $6b22
6b20 a2 07 LDX #$07 ; 7 = Yellow
6b22 8a TXA
6b23 a2 03 LDX #$03
6b25 9d 0e d8 STA C64_ColourRam+$e,X
6b28 ca DEX
6b29 10 fa BPL $6b25
6b2b a2 01 LDX #$01
6b2d a0 01 LDY #$01
6b2f b1 46 LDA (LocalVar),Y
6b31 c9 19 CMP #$19
6b33 10 02 BPL $6b37
6b35 a2 07 LDX #$07
6b37 8a TXA
6b38 a2 03 LDX #$03
6b3a 9d 02 d8 STA C64_ColourRam+2,X
6b3d ca DEX
6b3e 10 fa BPL $6b3a
6b40 a2 00 LDX #$00
6b42 a0 00 LDY #$00
6b44 b1 46 LDA (LocalVar),Y
6b46 c9 01 CMP #$01
6b48 d0 02 BNE $6b4c
6b4a a9 20 LDA #$20
6b4c 9d 00 0c STA GameTileMap1_or_TitleTextTileMap,X
6b4f e8 INX
6b50 18 CLC
6b51 69 34 ADC #$34
6b53 9d 00 0c STA GameTileMap1_or_TitleTextTileMap,X
6b56 e8 INX
6b57 c8 INY
6b58 c0 14 CPY #$14
6b5a d0 e8 BNE $6b44
6b5c 60 RTS
;
ReadJoystickDirectionPort1:6b5d ad 01 dc LDA Cia1_DataB
6b60 29 0f AND #$0f
6b62 60 RTS
ReadJoystickDirectionPort2:6b63 ad 00 dc LDA Cia1_DataA
6b66 29 0f AND #$0f
6b68 60 RTS
;
; NOTE: multiple entry points!
ReadFireButtonCurrentPlayer:6b69 a5 9d LDA CurrentPlayer
ReadFireButtonPlayerInA:6b6b 25 a4 AND NumJoysticksMinusOne
6b6d f0 05 BEQ ReadFireButtonPort1
6b6f ad 00 dc LDA Cia1_DataA
6b72 d0 03 BNE _StoreFireButtonBit
ReadFireButtonPort1:6b74 ad 01 dc LDA Cia1_DataB
_StoreFireButtonBit:6b77 29 10 AND #$10
6b79 85 b8 STA FireButtonStatus
6b7b 60 RTS
;
Text_ByPeterLiepa:; ..by.peter.liepa....
6b7c 20 20 22 39 20 30 25 34 25 32 20 2c 29 25 30 21
6b8c 20 20 20 20
Text__WithChrisGrey:; ..with.chris.grey...
6b90 20 20 37 29 34 28 20 23 28 32 29 33 20 27 32 25
6ba0 39 20 20 20
F1Text__Line4:; 1.player..1.joystick
6ba4 11 20 30 2c 21 39 25 32 20 20 11 20 2a 2f 39 33
6bb4 34 29 23 2b
Text_Plyr1Ply2:; .plyr.1......plyr.2.
6bb8 20 30 2c 39 32 20 11 20 20 20 20 20 20 30 2c 39
6bc8 32 20 12 20
Text_LastScores:; .000000.last.000000.
6bcc 20 10 10 10 10 10 10 20 2c 21 33 34 20 10 10 10
6bdc 10 10 10 20
Text_HighScores:; .000000.high.000000.
6be0 20 10 10 10 10 10 10 20 28 29 27 28 20 10 10 10
6bf0 10 10 10 20
Text_GameOver:; .g.a.m.e...o.v.e.r..
6bf4 20 27 20 21 20 2d 20 25 20 20 20 2f 20 36 20 25
6c04 20 32 20 20
Pre_level_Marquee_Text:; player.1?.3.men.a?0.
6c08 30 2c 21 39 25 32 20 11 0d 20 13 20 2d 25 2e 20
6c18 21 0f 10 20
Text_OutOfTime:; ....out.of.time.....
6c1c 20 20 20 20 2f 35 34 20 2f 26 20 34 29 2d 25 20
6c2c 20 20 20 20
Text_BonusLife:; .b.o.n.u.s..l.i.f.e.
6c30 20 22 20 2f 20 2e 20 35 20 33 20 20 2c 20 29 20
6c40 26 20 25 20
F1Text__Line5:; .cave?.a..level?.1..
6c44 20 23 21 36 25 1a 20 21 20 20 2c 25 36 25 2c 1a
6c54 20 11 20 20
Text__SpaceBarToResume:; .spacebar.to.resume.
6c58 20 33 30 21 23 25 22 21 32 20 34 2f 20 32 25 33
6c68 35 2d 25 20
Text_PressButtonToPlay:; press.button.to.play
6c6c 30 32 25 33 33 20 22 35 34 34 2f 2e 20 34 2f 20
6c7c 30 2c 21 39
;
; ---------------------------------------------------------------
; INPUTS:
; ObjectTypeForScreenUpdate $8A = Object code
; InflatedCaveOutputOutputPtr $36 & $37 = Position
;
; NOTES:
; Call SetInflatedCaveOutputPtr to set InflatedCaveOutputPtr
; Inflated Cave: $4003 - $4dc2
; ---------------------------------------------------------------
SetCellInInflatedCave:6c80 a6 8a LDX ObjectTypeForScreenUpdate
6c82 bd 28 5f LDA BaseCharNoForObjectTable,X
6c85 a0 00 LDY #$00
6c87 91 36 STA (InflatedCaveOutputPtr),Y
6c89 18 CLC
6c8a 69 01 ADC #$01
6c8c c8 INY
6c8d 91 36 STA (InflatedCaveOutputPtr),Y
6c8f 69 0f ADC #$0f
6c91 a0 50 LDY #$50
6c93 91 36 STA (InflatedCaveOutputPtr),Y
6c95 69 01 ADC #$01
6c97 c8 INY
6c98 91 36 STA (InflatedCaveOutputPtr),Y
6c9a 60 RTS
;
; ---------------------------------------------
; INPUTS:
; .InflatedCaveCurrentCellPtr $34 & 35
; y = Offset
; OUTPUT:
; .InflatedCaveOutputPtr $36 & $37
;
; Inflated Cave: $4003 - $4dc2
; ---------------------------------------------
SetInflatedCaveOutputPtr:6c9b a2 fd LDX #$fd
6c9d 98 TYA
6c9e e8 INX
6c9f e8 INX
6ca0 e8 INX
6ca1 dd b0 53 CMP InflatedCaveOffsetAdjustTable,X
6ca4 d0 f8 BNE $6c9e
6ca6 18 CLC
6ca7 a5 34 LDA InflatedCaveCurrentCellPtr
6ca9 7d b1 53 ADC InflatedCaveOffsetAdjustTable+1,X
6cac 85 36 STA InflatedCaveOutputPtr
6cae a5 35 LDA InflatedCaveCurrentCellPtr+1
6cb0 7d b2 53 ADC InflatedCaveOffsetAdjustTable+2,X
6cb3 85 37 STA InflatedCaveOutputPtr+1
6cb5 60 RTS
;
; Set a cell in the cave (where the game logic occurs) and the inflated cave
; (staging area for screen, each cell is presented as 2x2 characters).
;
; A contains the object type and Y the offset from the current position.
; A is preseCaverved.
SetCell:6cb6 85 8a STA ObjectTypeForScreenUpdate
6cb8 91 32 STA (CaveCurrentCellPtr),Y ; the cave
6cba a5 92 LDA CaveMatrixY
6cbc 0a ASL A
6cbd aa TAX
6cbe a5 91 LDA CaveMatrixX
6cc0 0a ASL A
6cc1 18 CLC
6cc2 7d da 53 ADC InflatedCaveLineAddressTable,X
6cc5 85 34 STA InflatedCaveCurrentCellPtr
6cc7 a9 00 LDA #$00
6cc9 7d db 53 ADC InflatedCaveLineAddressTable+1,X
6ccc 85 35 STA InflatedCaveCurrentCellPtr+1
6cce 20 9b 6c JSR SetInflatedCaveOutputPtr
6cd1 20 80 6c JSR SetCellInInflatedCave ; the inflated cave
6cd4 a5 8a LDA ObjectTypeForScreenUpdate
6cd6 60 RTS
;
__ProcessCave__ClearCurrentCell:6cd7 a9 00 LDA #$00
6cd9 85 8a STA ObjectTypeForScreenUpdate
6cdb a0 29 LDY #$29
6cdd 91 32 STA (CaveCurrentCellPtr),Y
6cdf a5 34 LDA InflatedCaveCurrentCellPtr
6ce1 85 36 STA InflatedCaveOutputPtr
6ce3 a5 35 LDA InflatedCaveCurrentCellPtr+1
6ce5 85 37 STA InflatedCaveOutputPtr+1
6ce7 20 80 6c JSR SetCellInInflatedCave
6cea 4c 15 7e JMP __ProcessCave__NoObjectHandler
;
PseudoRandom:; .RandSeed1
; ...........\/............
; |b7|b6|b5|b4|b3|b2|b1|b0|
; ...........\/............ C
; |b0| 0| 0| 0| 0| 0| 0| 0|--->|b1|
; ...........\/............
; .SeededRandTemp1
6ced a5 3f LDA RandSeed1
6cef 6a ROR A
6cf0 6a ROR A
6cf1 29 80 AND #$80
6cf3 8d 04 98 STA SeededRandTemp1
;
; .RandSeed2
; ...........\/............
; |b7|b6|b5|b4|b3|b2|b1|b0|
; ...........\/............ C
; |0 |b7|b6|b5|b4|b3|b2|b1|--->|b0|
; ...........\/............
; .SeededRandTemp2
6cf6 a5 3e LDA RandSeed2
6cf8 6a ROR A
6cf9 29 7f AND #$7f
6cfb 8d 05 98 STA SeededRandTemp2
; .\/RandSeed2
; ...........\/............
; |b7|b6|b5|b4|b3|b2|b1|b0|
; ...........\/............ C
; |b0| 0| 0| 0| 0| 0| 0| 0|--->|b1|
; ...........\/............
; ....+(RandSeed2+0x13)....
; .\/RandSeed2
6cfe a5 3e LDA RandSeed2
6d00 6a ROR A
6d01 6a ROR A
6d02 29 80 AND #$80
6d04 18 CLC
6d05 65 3e ADC RandSeed2
6d07 69 13 ADC #$13
6d09 85 3e STA RandSeed2
;
6d0b a5 3f LDA RandSeed1
6d0d 6d 04 98 ADC SeededRandTemp1
6d10 6d 05 98 ADC SeededRandTemp2
6d13 85 3f STA RandSeed1
6d15 60 RTS
;
; Update one cave cell and on screen provided it isn't steel wall.
SetCellButPreserveSteelWall:6d16 b1 32 LDA (CaveCurrentCellPtr),Y
; Object $07 = steel wall.
6d18 c9 07 CMP #$07
6d1a f0 05 BEQ _Finished
6d1c a5 89 LDA ObjectTypeForUpdateCaveCell
6d1e 20 b6 6c JSR SetCell
_Finished:6d21 60 RTS
; Specify object type for fill in ObjectTypeForUpdateCaveCell (v).
; If the starred cell is the current cell the update occurs as shown:
; -------------
; | | | |
; |---+---+---|
; | v |*v*|v-1|
; |---+---+---|
; |v-1|v-1|v-1|
; |---+---+---|
; |v-1|v-1|v-1|
; -------------
Explode3x3CellsDownOneRow:6d22 a0 28 LDY #$28
6d24 20 16 6d JSR SetCellButPreserveSteelWall
6d27 a0 29 LDY #$29
6d29 20 16 6d JSR SetCellButPreserveSteelWall
; The decrement backs off the fill type for squares yet to
; be processed -- eg. back from explosion stage 1 to stage 0.
6d2c c6 89 DEC ObjectTypeForUpdateCaveCell
6d2e a0 2a LDY #$2a
6d30 20 16 6d JSR SetCellButPreserveSteelWall
6d33 a0 50 LDY #$50
6d35 20 16 6d JSR SetCellButPreserveSteelWall
6d38 a0 51 LDY #$51
6d3a 20 16 6d JSR SetCellButPreserveSteelWall
6d3d a0 52 LDY #$52
6d3f 20 16 6d JSR SetCellButPreserveSteelWall
6d42 a0 78 LDY #$78
6d44 20 16 6d JSR SetCellButPreserveSteelWall
6d47 a0 79 LDY #$79
6d49 20 16 6d JSR SetCellButPreserveSteelWall
6d4c a0 7a LDY #$7a
6d4e 20 16 6d JSR SetCellButPreserveSteelWall
6d51 4c 91 6d JMP Explode3x3Cells__Common
; Handler for object $04.
ProcessHiddenOutbox:6d54 a5 90 LDA LevelCompleteFlag
6d56 f0 07 BEQ ProcessHiddenOutbox__NotEnoughDiamonds
6d58 a0 29 LDY #$29
; Object $05 = flashing outbox.
6d5a a9 05 LDA #$05
6d5c 20 b6 6c JSR SetCell
ProcessHiddenOutbox__NotEnoughDiamonds:6d5f 4c 15 7e JMP __ProcessCave__NoObjectHandler
; Specify object type for fill in ObjectTypeForUpdateCaveCell (v).
; If the starred cell is the current cell the update occurs as shown:
; -------------
; | v | v | v |
; |---+---+---|
; | v |*v*|v-1|
; |---+---+---|
; |v-1|v-1|v-1|
; -------------
Explode3x3Cells:6d62 a0 00 LDY #$00
6d64 20 16 6d JSR SetCellButPreserveSteelWall
6d67 a0 01 LDY #$01
6d69 20 16 6d JSR SetCellButPreserveSteelWall
6d6c a0 02 LDY #$02
6d6e 20 16 6d JSR SetCellButPreserveSteelWall
6d71 a0 28 LDY #$28
6d73 20 16 6d JSR SetCellButPreserveSteelWall
6d76 a0 29 LDY #$29
6d78 20 16 6d JSR SetCellButPreserveSteelWall
; The decrement backs off the fill type for squares yet to
; be processed -- eg. back from explosion stage 1 to stage 0.
6d7b c6 89 DEC ObjectTypeForUpdateCaveCell
6d7d a0 2a LDY #$2a
6d7f 20 16 6d JSR SetCellButPreserveSteelWall
6d82 a0 50 LDY #$50
6d84 20 16 6d JSR SetCellButPreserveSteelWall
6d87 a0 51 LDY #$51
6d89 20 16 6d JSR SetCellButPreserveSteelWall
6d8c a0 52 LDY #$52
6d8e 20 16 6d JSR SetCellButPreserveSteelWall
; This is used by both Set3x3 functions.
Explode3x3Cells__Common:6d91 a9 50 LDA #$50
6d93 8d 11 98 STA $9811
6d96 20 e3 7c JSR ResetVoice2
6d99 a2 06 LDX #$06
Explode3x3Cells__SoundLoop:6d9b bd a5 6d LDA ExplosionSIDVoiceTable,X
6d9e 9d 07 d4 STA Sid_Voice2FreqLo,X
6da1 ca DEX
6da2 10 f7 BPL Explode3x3Cells__SoundLoop
6da4 60 RTS
; All values for one SID voice.
ExplosionSIDVoiceTable:6da5 32 14 0f 00 81 1b 00
; Matrix offset values used for firefly and butterfly turns.
FromLeftClockwiseOffsetTable:6dac 28 01 2a 51
FromDownClockwiseOffsetTable:6db0 51 28 01 2a
; X is zeroed when the test succeeds. Note that this function tests
; for both scanned and unscanned Rockfords, but only pre-existing amoeba.
TestForRockfordOrAmoeba:6db4 b1 32 LDA (CaveCurrentCellPtr),Y
; Object $38 = Rockford.
6db6 c9 38 CMP #$38
6db8 90 06 BCC TestForRockfordOrAmoeba__Finished
; Object $3b = Amoeba created this frame.
6dba c9 3b CMP #$3b
6dbc b0 02 BCS TestForRockfordOrAmoeba__Finished
6dbe a2 00 LDX #$00
TestForRockfordOrAmoeba__Finished:6dc0 60 RTS
; Sets the Z flag when an explosion should occur.
TestForExplosionByContactWithRockfordOrAmoeba:6dc1 a2 01 LDX #$01
6dc3 a0 01 LDY #$01
6dc5 20 b4 6d JSR TestForRockfordOrAmoeba
6dc8 a0 28 LDY #$28
6dca 20 b4 6d JSR TestForRockfordOrAmoeba
6dcd a0 2a LDY #$2a
6dcf 20 b4 6d JSR TestForRockfordOrAmoeba
6dd2 a0 51 LDY #$51
6dd4 20 b4 6d JSR TestForRockfordOrAmoeba
6dd7 e0 00 CPX #$00
6dd9 60 RTS
;
ProcessFirefly:6dda 20 c1 6d JSR TestForExplosionByContactWithRockfordOrAmoeba
6ddd d0 0a BNE ProcessFirefly__NoExplosion
; Install an explosion to space.
6ddf a9 1c LDA #$1c
6de1 85 89 STA ObjectTypeForUpdateCaveCell
6de3 20 62 6d JSR Explode3x3Cells
6de6 4c 15 7e JMP __ProcessCave__NoObjectHandler
; Get the direction the firefly is facing: 0=left, 1=up, 2=right, 3=down.
ProcessFirefly__NoExplosion:6de9 a0 29 LDY #$29
6deb b1 32 LDA (CaveCurrentCellPtr),Y
6ded 29 03 AND #$03
6def aa TAX
; Check if there is a space to the firefly's left.
6df0 bc b0 6d LDY FromDownClockwiseOffsetTable,X
6df3 b1 32 LDA (CaveCurrentCellPtr),Y
6df5 d0 0e BNE ProcessFirefly__CantTurnLeft
; Turn left and move.
6df7 18 CLC
6df8 8a TXA
6df9 69 03 ADC #$03
6dfb 29 03 AND #$03
6dfd 69 0c ADC #$0c
6dff 20 b6 6c JSR SetCell
6e02 4c d7 6c JMP __ProcessCave__ClearCurrentCell
; Check if there is a space straight ahead.
ProcessFirefly__CantTurnLeft:6e05 bc ac 6d LDY FromLeftClockwiseOffsetTable,X
6e08 b1 32 LDA (CaveCurrentCellPtr),Y
6e0a d0 0d BNE ProcessFirefly__CantMoveStraightAhead
; Move straight ahead.
6e0c 18 CLC
6e0d 8a TXA
6e0e 69 0c ADC #$0c
6e10 bc ac 6d LDY FromLeftClockwiseOffsetTable,X
6e13 20 b6 6c JSR SetCell
6e16 4c d7 6c JMP __ProcessCave__ClearCurrentCell
; Turn right, but do not move.
ProcessFirefly__CantMoveStraightAhead:6e19 18 CLC
6e1a a0 29 LDY #$29
6e1c 8a TXA
6e1d 69 01 ADC #$01
6e1f 29 03 AND #$03
6e21 69 0c ADC #$0c
6e23 91 32 STA (CaveCurrentCellPtr),Y
6e25 4c 15 7e JMP __ProcessCave__NoObjectHandler
;
FallingDiamondSoundFX:6e28 ee 0d 98 INC $980d
6e2b a2 03 LDX #$03
FallingDiamondSoundFX__Loop:6e2d bd 8c 71 LDA RockfordCollectingDiamondSIDValues+2,X
6e30 9d 7f 98 STA $987f,X
6e33 ca DEX
6e34 10 f7 BPL FallingDiamondSoundFX__Loop
6e36 a9 a0 LDA #$a0
6e38 8d 83 98 STA $9883
6e3b 20 d0 6a JSR TimeBasedRandomNumber
6e3e 8d 7d 98 STA Voice1SIDRegsBuffer
6e41 20 d0 6a JSR TimeBasedRandomNumber
6e44 29 07 AND #$07
6e46 0a ASL A
6e47 0a ASL A
6e48 0a ASL A
6e49 69 86 ADC #$86
6e4b 8d 7e 98 STA $987e
6e4e 60 RTS
; All values for one SID voice.
FallingBoulderSIDVoiceTable:6e4f 32 09 07 00 81 00 f0
;
FallingBoulderSoundFX:6e56 ee 0d 98 INC $980d
6e59 a2 06 LDX #$06
FallingBoulderSoundFX__Loop:6e5b bd 4f 6e LDA FallingBoulderSIDVoiceTable,X
6e5e 9d 7d 98 STA Voice1SIDRegsBuffer,X
6e61 ca DEX
6e62 10 f7 BPL FallingBoulderSoundFX__Loop
6e64 60 RTS
; Tests if an object is slippery.
; In:
; A: The object code to test.
; Out:
; Z: 1 if slippery.
; Modified:
; X
TestIfObjectSlippery:6e65 a2 00 LDX #$00
6e67 c9 10 CMP #$10
6e69 d0 02 BNE TestIfObjectSlippery_NotOnBoulder
6e6b a2 01 LDX #$01
TestIfObjectSlippery_NotOnBoulder:6e6d c9 14 CMP #$14
6e6f d0 02 BNE TestIfObjectSlippery_NotOnDiamond
6e71 a2 01 LDX #$01
TestIfObjectSlippery_NotOnDiamond:6e73 c9 02 CMP #$02
6e75 d0 02 BNE TestIfObjectSlippery_NotOnBrickWall
6e77 a2 01 LDX #$01
TestIfObjectSlippery_NotOnBrickWall:6e79 e0 01 CPX #$01
6e7b 60 RTS
;
CheckIfFallingObjectKillsAnimal:6e7c a2 01 LDX #$01
; Test for hitting a butterfly.
6e7e b1 32 LDA (CaveCurrentCellPtr),Y
6e80 29 33 AND #$33
6e82 d1 32 CMP (CaveCurrentCellPtr),Y
6e84 d0 0c BNE CheckIfFallingObjectKillsAnimal_NotButterfly
6e86 09 30 ORA #$30
6e88 d1 32 CMP (CaveCurrentCellPtr),Y
6e8a d0 06 BNE CheckIfFallingObjectKillsAnimal_NotButterfly
; Remember to explode to diamonds.
6e8c a2 00 LDX #$00
6e8e a9 21 LDA #$21
6e90 85 89 STA ObjectTypeForUpdateCaveCell
CheckIfFallingObjectKillsAnimal_NotButterfly:6e92 e0 00 CPX #$00
6e94 f0 14 BEQ CheckIfFallingObjectKillsAnimal_Finished
6e96 a2 01 LDX #$01
; Test for hitting a firefly.
6e98 b1 32 LDA (CaveCurrentCellPtr),Y
6e9a 29 0b AND #$0b
6e9c d1 32 CMP (CaveCurrentCellPtr),Y
6e9e d0 0a BNE CheckIfFallingObjectKillsAnimal_Finished
6ea0 29 08 AND #$08
6ea2 f0 06 BEQ CheckIfFallingObjectKillsAnimal_Finished
6ea4 a2 00 LDX #$00
; Remember to explode to space.
6ea6 a9 1c LDA #$1c
6ea8 85 89 STA ObjectTypeForUpdateCaveCell
CheckIfFallingObjectKillsAnimal_Finished:6eaa e0 00 CPX #$00
6eac 60 RTS
;
ProcessButterfly:6ead 20 c1 6d JSR TestForExplosionByContactWithRockfordOrAmoeba
6eb0 d0 0a BNE ProcessButterfly__NoExplosion
; Install an explosion to diamonds.
6eb2 a9 21 LDA #$21
6eb4 85 89 STA ObjectTypeForUpdateCaveCell
6eb6 20 62 6d JSR Explode3x3Cells
6eb9 4c 15 7e JMP __ProcessCave__NoObjectHandler
; Get the direction the butterfly is facing: 0=down, 1=left, 2=up, 3=right.
ProcessButterfly__NoExplosion:6ebc a0 29 LDY #$29
6ebe b1 32 LDA (CaveCurrentCellPtr),Y
6ec0 29 03 AND #$03
6ec2 aa TAX
; Check if there is a space to the right.
6ec3 bc ac 6d LDY FromLeftClockwiseOffsetTable,X
6ec6 b1 32 LDA (CaveCurrentCellPtr),Y
6ec8 d0 0e BNE ProcessButterfly__CantTurnRight
; Turn right and move.
6eca 18 CLC
6ecb 8a TXA
6ecc 69 01 ADC #$01
6ece 29 03 AND #$03
6ed0 69 34 ADC #$34
6ed2 20 b6 6c JSR SetCell
6ed5 4c d7 6c JMP __ProcessCave__ClearCurrentCell
; Check if there is a space straight ahead.
ProcessButterfly__CantTurnRight:6ed8 bc b0 6d LDY FromDownClockwiseOffsetTable,X
6edb b1 32 LDA (CaveCurrentCellPtr),Y
6edd d0 0d BNE ProcessButterfly__CantMoveStraightAhead
; Move straight ahead.
6edf 18 CLC
6ee0 8a TXA
6ee1 69 34 ADC #$34
6ee3 bc b0 6d LDY FromDownClockwiseOffsetTable,X
6ee6 20 b6 6c JSR SetCell
6ee9 4c d7 6c JMP __ProcessCave__ClearCurrentCell
; Turn left, but do not move.
ProcessButterfly__CantMoveStraightAhead:6eec 18 CLC
6eed a0 29 LDY #$29
6eef 8a TXA
6ef0 69 03 ADC #$03
6ef2 29 03 AND #$03
6ef4 69 34 ADC #$34
6ef6 91 32 STA (CaveCurrentCellPtr),Y
6ef8 4c 15 7e JMP __ProcessCave__NoObjectHandler
;
__ProcessCave__CreateScannedStationaryDiamond:6efb a0 29 LDY #$29
6efd a9 15 LDA #$15
6eff 20 b6 6c JSR SetCell
6f02 4c 15 7e JMP __ProcessCave__NoObjectHandler
;
ProcessFallingDiamond:6f05 a0 51 LDY #$51
; Check for a space below.
6f07 b1 32 LDA (CaveCurrentCellPtr),Y
6f09 d0 08 BNE ProcessFallingDiamond__NoSpaceBelow
; Move the falling diamond down one row, and mark as scanned.
6f0b a9 17 LDA #$17
6f0d 20 b6 6c JSR SetCell
6f10 4c d7 6c JMP __ProcessCave__ClearCurrentCell
; Check for a magic wall below.
ProcessFallingDiamond__NoSpaceBelow:6f13 c9 03 CMP #$03
6f15 d0 1d BNE ProcessFallingDiamond__NoMagicWallBelow
; Has the magic wall already been activated?
6f17 a5 8d LDA MagicWallActiveState
6f19 d0 04 BNE ProcessFallingDiamond__MagicWallAlreadyActivated
; Activate the magic wall.
6f1b a9 01 LDA #$01
6f1d 85 8d STA MagicWallActiveState
; Is the magic wall still active? If not the diamond will just be consumed.
ProcessFallingDiamond__MagicWallAlreadyActivated:6f1f c9 01 CMP #$01
6f21 d0 0b BNE ProcessFallingDiamond__ClearDiamondAboveMagicWall
; Is the row below the magic wall empty? If not the diamond will just be consumed.
6f23 a0 79 LDY #$79
6f25 b1 32 LDA (CaveCurrentCellPtr),Y
6f27 d0 05 BNE ProcessFallingDiamond__ClearDiamondAboveMagicWall
; Convert the diamond to a (scanned) falling boulder below the magic wall.
6f29 a9 13 LDA #$13
6f2b 20 b6 6c JSR SetCell
ProcessFallingDiamond__ClearDiamondAboveMagicWall:6f2e 20 56 6e JSR FallingBoulderSoundFX
6f31 4c d7 6c JMP __ProcessCave__ClearCurrentCell
; Tinkle while the diamond falls.
ProcessFallingDiamond__NoMagicWallBelow:6f34 20 28 6e JSR FallingDiamondSoundFX
; Check if the diamond has hit a slippery object.
6f37 a0 51 LDY #$51
6f39 b1 32 LDA (CaveCurrentCellPtr),Y
6f3b 20 65 6e JSR TestIfObjectSlippery
6f3e d0 2b BNE ProcessFallingDiamond__NotSlipperyHit
; Is there a space below-left?
6f40 a0 50 LDY #$50
6f42 b1 32 LDA (CaveCurrentCellPtr),Y
6f44 d0 0e BNE ProcessFallingDiamond__CantFallLeft
; Is there a space left?
6f46 a0 28 LDY #$28
6f48 b1 32 LDA (CaveCurrentCellPtr),Y
6f4a d0 08 BNE ProcessFallingDiamond__CantFallLeft
; Move the diamond left.
6f4c a9 17 LDA #$17
6f4e 20 b6 6c JSR SetCell
6f51 4c d7 6c JMP __ProcessCave__ClearCurrentCell
; Is there a space below-right?
ProcessFallingDiamond__CantFallLeft:6f54 a0 52 LDY #$52
6f56 b1 32 LDA (CaveCurrentCellPtr),Y
6f58 d0 0e BNE ProcessFallingDiamond__CantFallRight
; Is there a space right?
6f5a a0 2a LDY #$2a
6f5c b1 32 LDA (CaveCurrentCellPtr),Y
6f5e d0 08 BNE ProcessFallingDiamond__CantFallRight
; Move the diamond right.
6f60 a9 17 LDA #$17
6f62 20 b6 6c JSR SetCell
6f65 4c d7 6c JMP __ProcessCave__ClearCurrentCell
; The diamond is on a slippery object, but can't fall left or right.
ProcessFallingDiamond__CantFallRight:6f68 4c fb 6e JMP __ProcessCave__CreateScannedStationaryDiamond
; Have we hit Rockford on the head?
ProcessFallingDiamond__NotSlipperyHit:6f6b c9 38 CMP #$38
6f6d d0 0a BNE ProcessFallingDiamond__DidntHitRockford
; Poor old Rockford is dead -- explode him to space.
6f6f a9 1c LDA #$1c
6f71 85 89 STA ObjectTypeForUpdateCaveCell
6f73 20 22 6d JSR Explode3x3CellsDownOneRow
6f76 4c 15 7e JMP __ProcessCave__NoObjectHandler
; Have we hit an animal?
ProcessFallingDiamond__DidntHitRockford:6f79 20 7c 6e JSR CheckIfFallingObjectKillsAnimal
6f7c d0 06 BNE ProcessFallingDiamond__DidntHitAnimal
; Explode the animal.
6f7e 20 22 6d JSR Explode3x3CellsDownOneRow
6f81 4c 15 7e JMP __ProcessCave__NoObjectHandler
; Can't do anything interesting, so convert to a stationary diamond.
ProcessFallingDiamond__DidntHitAnimal:6f84 4c fb 6e JMP __ProcessCave__CreateScannedStationaryDiamond
;
ProcessStationaryDiamond:6f87 a0 51 LDY #$51
; Is there a space below the diamond?
6f89 b1 32 LDA (CaveCurrentCellPtr),Y
6f8b d0 0b BNE ProcessStationaryDiamond__NoSpaceBelow
; Convert to a scanned falling diamond and move down.
6f8d a9 17 LDA #$17
6f8f 20 b6 6c JSR SetCell
6f92 20 28 6e JSR FallingDiamondSoundFX
6f95 4c d7 6c JMP __ProcessCave__ClearCurrentCell
; Is the diamond sitting on a slippery object?
ProcessStationaryDiamond__NoSpaceBelow:6f98 a0 51 LDY #$51
6f9a b1 32 LDA (CaveCurrentCellPtr),Y
6f9c 20 65 6e JSR TestIfObjectSlippery
6f9f d0 28 BNE ProcessStationaryDiamond__Finished
; Is there a space below-left?
6fa1 a0 50 LDY #$50
6fa3 b1 32 LDA (CaveCurrentCellPtr),Y
6fa5 d0 0e BNE ProcessStationaryDiamond__CantFallLeft
; Is there a space left?
6fa7 a0 28 LDY #$28
6fa9 b1 32 LDA (CaveCurrentCellPtr),Y
6fab d0 08 BNE ProcessStationaryDiamond__CantFallLeft
; Move the diamond left.
6fad a9 17 LDA #$17
6faf 20 b6 6c JSR SetCell
6fb2 4c d7 6c JMP __ProcessCave__ClearCurrentCell
; Is there a space below-right?
ProcessStationaryDiamond__CantFallLeft:6fb5 a0 52 LDY #$52
6fb7 b1 32 LDA (CaveCurrentCellPtr),Y
6fb9 d0 0e BNE ProcessStationaryDiamond__Finished
; Is there a space right?
6fbb a0 2a LDY #$2a
6fbd b1 32 LDA (CaveCurrentCellPtr),Y
6fbf d0 08 BNE ProcessStationaryDiamond__Finished
; Move the diamond right.
6fc1 a9 17 LDA #$17
6fc3 20 b6 6c JSR SetCell
6fc6 4c d7 6c JMP __ProcessCave__ClearCurrentCell
ProcessStationaryDiamond__Finished:6fc9 4c 15 7e JMP __ProcessCave__NoObjectHandler
;
AmoebaUpLeftRightDownOffsetTable:6fcc 01 28 2a 51
;
ProcessAmoeba:6fd0 ee 02 98 INC AmoebaCellCountThisTick
6fd3 ad 03 98 LDA AmoebaCellCountPreviousTick
6fd6 c9 c8 CMP #$c8
6fd8 90 08 BCC __ProcessAmoeba__NotTooBig
__ProcessAmoeba__GreaterOrEqualTo200:; $11 = Scanned stationary boulder.
6fda a9 11 LDA #$11
6fdc 20 b6 6c JSR SetCell
6fdf 4c 15 7e JMP __ProcessCave__NoObjectHandler
__ProcessAmoeba__NotTooBig:6fe2 a5 8c LDA AmeobaCouldGrowLastTick
6fe4 d0 08 BNE __ProcessAmoeba__NotConfined
; $14 = Stationary diamond.
6fe6 a9 14 LDA #$14
6fe8 20 b6 6c JSR SetCell
6feb 4c 15 7e JMP __ProcessCave__NoObjectHandler
__ProcessAmoeba__NotConfined:6fee a5 42 LDA AmeobaCouldGrowThisTick
6ff0 d0 20 BNE __ProcessAmoeba__AlreadyKnowAmoebaCanGrowThisTick
6ff2 a9 03 LDA #$03
6ff4 85 46 STA LocalVar
6ff6 a2 01 LDX #$01
__ProcessAmoeba__ConfinementTestLoop:6ff8 a4 46 LDY LocalVar
6ffa b9 cc 6f LDA AmoebaUpLeftRightDownOffsetTable,Y
6ffd a8 TAY
6ffe b1 32 LDA (CaveCurrentCellPtr),Y
; $00 = Space, $01 = Dirt, $02 = Brick wall.
; Amoeba can grow into space and dirt. It is confined by anything else.
7000 c9 02 CMP #$02
7002 b0 02 BCS __ProcessAmoeba__CantGrowThisDirection
7004 a2 00 LDX #$00
__ProcessAmoeba__CantGrowThisDirection:7006 c6 46 DEC LocalVar
7008 10 ee BPL __ProcessAmoeba__ConfinementTestLoop
700a e0 00 CPX #$00
700c d0 04 BNE __ProcessAmoeba__AlreadyKnowAmoebaCanGrowThisTick
700e a9 01 LDA #$01
7010 85 42 STA AmeobaCouldGrowThisTick
__ProcessAmoeba__AlreadyKnowAmoebaCanGrowThisTick:7012 20 d0 6a JSR TimeBasedRandomNumber
7015 25 9a AND AmoebaGrowthProbabilityMask
7017 c9 04 CMP #$04
7019 b0 1b BCS __ProcessAmoeba__DontGrowThisTick
701b aa TAX
701c bc cc 6f LDY AmoebaUpLeftRightDownOffsetTable,X
701f a2 01 LDX #$01
7021 b1 32 LDA (CaveCurrentCellPtr),Y
7023 d0 02 BNE __ProcessAmoeba__NotSpace
7025 a2 00 LDX #$00
__ProcessAmoeba__NotSpace:7027 c9 01 CMP #$01
7029 d0 02 BNE __ProcessAmoeba__NotDirt
702b a2 00 LDX #$00
__ProcessAmoeba__NotDirt:702d e0 00 CPX #$00
702f d0 05 BNE __ProcessAmoeba__DontGrowThisTick
; $3b = Scanned amoeba.
7031 a9 3b LDA #$3b
7033 20 b6 6c JSR SetCell
__ProcessAmoeba__DontGrowThisTick:7036 4c 15 7e JMP __ProcessCave__NoObjectHandler
;
ExtraLife:7039 a5 5c LDA Lives
703b c9 09 CMP #$09
703d f0 06 BEQ $7045
703f e6 5c INC Lives
7041 a9 80 LDA #$80
7043 85 a8 STA ExtraLifeFXCounter
7045 60 RTS
ProcessExtraLife:7046 a5 a9 LDA OldScore1000sDigit
7048 c5 61 CMP ScoreDigits+2
704a f0 03 BEQ $704f
704c 20 39 70 JSR ExtraLife
704f a5 aa LDA OldScore100sDigit
7051 c9 04 CMP #$04
7053 d0 07 BNE $705c
7055 c5 62 CMP ScoreDigits+3
7057 f0 03 BEQ $705c
7059 20 39 70 JSR ExtraLife
705c 60 RTS
; You get an extra life every 500 points.
IncrementScore:705d a5 61 LDA ScoreDigits+2
705f 85 a9 STA OldScore1000sDigit
7061 a5 62 LDA ScoreDigits+3
7063 85 aa STA OldScore100sDigit
7065 a2 05 LDX #$05
7067 18 CLC
7068 b5 5f LDA ScoreDigits,X
706a 75 4e ADC ScoreIncrementDigits,X
706c c9 0a CMP #$0a
706e 90 02 BCC $7072
7070 e9 0a SBC #$0a
7072 95 5f STA ScoreDigits,X
7074 09 10 ORA #$10
7076 9d 48 98 STA ScoreChars,X
7079 ca DEX
707a 10 ec BPL $7068
707c 20 46 70 JSR ProcessExtraLife
707f 60 RTS
;
DiamondQuotaReachedSoundSIDValues:; $32, $2f:
; A frequency value of $2f32. On PAL machines this gives a
; frequency of 709.5212042331696 HZ
; Calculated using this formula (PAL): (reg*985250)/16777216
; $00, $00:
; Pulse width. N/A
; $81:
; Control register
; Noise waveform, ADSR cycle
; $19:
; Attack 8 ms, Decay 750 ms
; $01:
; Sustain volume of 0, Release 24 ms
7080 32 2f 00 00 81 19 01
InitiateDiamondQuotaReachedSound:7087 a9 01 LDA #$01
7089 85 d8 STA SFXTrigger_DiamondQuotaReachedOrEntryBoxExplode
708b 60 RTS
;
CheckIfLevelTimeIsUp:708c a5 ab LDA TimeLeft
708e d0 34 BNE $70c4
7090 a5 ac LDA TimeLeft+1
7092 d0 30 BNE $70c4
7094 a5 ad LDA TimeLeft+2
7096 d0 05 BNE TimeRunningOutFX
7098 a9 02 LDA #$02
709a 85 97 STA ExitCaveFlag
709c 60 RTS
TimeRunningOutFX:709d ad 11 98 LDA $9811
70a0 d0 22 BNE $70c4
70a2 20 e3 7c JSR ResetVoice2
70a5 a9 0a LDA #$0a
70a7 8d 0c d4 STA Sid_Voice2AttackDecay
70aa a9 00 LDA #$00
70ac 8d 0d d4 STA Sid_Voice2SustainRelease
70af a9 27 LDA #$27
70b1 38 SEC
70b2 e5 ad SBC TimeLeft+2
70b4 8d 08 d4 STA Sid_Voice2FreqHi
70b7 a9 11 LDA #$11
70b9 8d 0b d4 STA Sid_Voice2Ctrl
70bc ad 0d 98 LDA $980d
70bf 09 80 ORA #$80
70c1 8d 0d 98 STA $980d
70c4 60 RTS
;
GameSecondTick:; Subtract one from time (it'a a zero-based string).
70c5 a2 02 LDX #$02
70c7 18 CLC
70c8 b5 ab LDA TimeLeft,X
70ca 69 09 ADC #$09
70cc c9 0a CMP #$0a
70ce 90 02 BCC $70d2
70d0 e9 0a SBC #$0a
70d2 95 ab STA TimeLeft,X
70d4 09 10 ORA #$10
70d6 9d 44 98 STA TimeLeftText,X
70d9 ca DEX
70da 10 ec BPL $70c8
;
70dc 20 8c 70 JSR CheckIfLevelTimeIsUp
70df 60 RTS
;
GameSecondTickWithAmoebaProcessing:70e0 20 c5 70 JSR GameSecondTick
70e3 e6 af INC TimeCaveHasRan
70e5 a5 af LDA TimeCaveHasRan
70e7 cd 01 24 CMP BufferedLevel_MagicWallMillingTimeOrAmoeba3PercentMax
70ea d0 04 BNE GameSecondTickWithAmoebaProcessing__Exit
70ec a9 0f LDA #$0f
70ee 85 9a STA AmoebaGrowthProbabilityMask
GameSecondTickWithAmoebaProcessing__Exit:70f0 60 RTS
FlashingEntryBoxSecondTick:70f1 c6 95 DEC FlashingEntryBoxCountDown
70f3 d0 0f BNE FlashingEntryBoxSecondTick__Exit
FlashingEntryBoxSecondTick__Birth:70f5 20 87 70 JSR InitiateDiamondQuotaReachedSound
70f8 a9 00 LDA #$00
70fa 85 93 STA FlashingEntryBoxFlag
70fc 85 fb STA LastKeyInScanRow0_ScannedMoreThanOnce
70fe 85 fc STA LastKeyInScanRow7_ScannedMoreThanOnce
7100 a9 01 LDA #$01
7102 85 94 STA EnableSomeSFXAndMarqueeUpdates
FlashingEntryBoxSecondTick__Exit:7104 60 RTS
;
SetTopLineToScore:7105 a9 3a LDA #<CurrentPlayerScoresText
7107 85 46 STA LocalVar
7109 a9 98 LDA #>CurrentPlayerScoresText
710b 85 47 STA LocalVar+1
710d 20 16 6b JSR SetTopLineText
7110 60 RTS
;
SubSecondTick:7111 e6 ae INC SubSecondCounter
7113 a5 ae LDA SubSecondCounter
7115 c9 3c CMP #$3c
7117 d0 13 BNE SubSecondTick_Exit
SubSecondTick__OneGameSecondPassed:7119 a9 00 LDA #$00
711b 85 ae STA SubSecondCounter
711d a5 9b LDA SecondsDontPass
711f d0 0b BNE SubSecondTick_Exit
7121 a5 93 LDA FlashingEntryBoxFlag
7123 d0 04 BNE SubSecondTick__FlashingEntryBoxSecondTick
7125 20 e0 70 JSR GameSecondTickWithAmoebaProcessing
7128 60 RTS
SubSecondTick__FlashingEntryBoxSecondTick:7129 20 f1 70 JSR FlashingEntryBoxSecondTick
SubSecondTick_Exit:712c 60 RTS
;
IncrementDiamondCount:712d a2 01 LDX #$01
712f 18 CLC
7130 8a TXA
7131 75 b0 ADC DiamondCountDigits,X
7133 c9 0a CMP #$0a
7135 90 02 BCC $7139
7137 e9 0a SBC #$0a
7139 95 b0 STA DiamondCountDigits,X
713b 09 10 ORA #$10
; Update the diamond count in CurrentPlayerInfoText.
713d 9d 41 98 STA $9841,X
7140 ca DEX
7141 10 ed BPL $7130
7143 60 RTS
;
DiamondQuotaDigitsToString:7144 a2 01 LDX #$01
7146 b5 b2 LDA DiamondQuotaDigits,X
7148 09 10 ORA #$10
714a 9d 3b 98 STA DiamondQuotaString,X
714d ca DEX
714e 10 f6 BPL $7146
7150 60 RTS
ScoreIncrementToString:7151 a2 01 LDX #$01
7153 b5 52 LDA ScoreIncrementDigits+4,X
7155 09 10 ORA #$10
7157 9d 3e 98 STA DiamondValueString,X
715a ca DEX
715b 10 f6 BPL $7153
715d 60 RTS
;
CheckIfGotDiamondQuota:715e a5 b0 LDA DiamondCountDigits
7160 c5 b2 CMP DiamondQuotaDigits
7162 d0 25 BNE __CheckIfGotDiamondQuota__Exit
7164 a5 b1 LDA DiamondCountDigits+1
7166 c5 b3 CMP DiamondQuotaDigits+1
7168 d0 1f BNE __CheckIfGotDiamondQuota__Exit
; Quota reached.
716a a9 01 LDA #$01
716c 85 90 STA LevelCompleteFlag
; Set score increment to the value of diamonds above the quota.
716e a2 02 LDX #$02
7170 b5 b4 LDA ExtraDiamondValue,X
7172 95 51 STA ScoreIncrementDigits+3,X
7174 ca DEX
7175 10 f9 BPL $7170
7177 20 51 71 JSR ScoreIncrementToString
; Display diamonds where the diamond quota used to be displayed.
717a a9 3c LDA #$3c
717c 8d 3b 98 STA DiamondQuotaString
717f 8d 3c 98 STA $983c
; Diamond quota FX.
7182 20 87 70 JSR InitiateDiamondQuotaReachedSound
7185 a9 06 LDA #$06
7187 85 a5 STA WhiteFlashWhiteCount
__CheckIfGotDiamondQuota__Exit:7189 60 RTS
;
RockfordCollectingDiamondSIDValues:718a 78 14 07 00 11 00 f0
;
RockfordMovingToDiamond:7191 ee 0d 98 INC $980d
7194 a2 06 LDX #$06
RockfordMovingToDiamond__Loop:7196 bd 8a 71 LDA RockfordCollectingDiamondSIDValues,X
7199 9d 7d 98 STA Voice1SIDRegsBuffer,X
719c ca DEX
719d 10 f7 BPL RockfordMovingToDiamond__Loop
719f 20 5d 70 JSR IncrementScore
71a2 20 2d 71 JSR IncrementDiamondCount
71a5 20 5e 71 JSR CheckIfGotDiamondQuota
71a8 e6 b7 INC RockfordMoveSucceededFlag
71aa 60 RTS
;
RockfordTriesToMoveBoulder:71ab 20 d0 6a JSR TimeBasedRandomNumber
71ae 29 03 AND #$03
71b0 d0 0a BNE $71bc
71b2 e6 b7 INC RockfordMoveSucceededFlag
71b4 20 56 6e JSR FallingBoulderSoundFX
71b7 a9 11 LDA #$11
71b9 20 b6 6c JSR SetCell
71bc 60 RTS
;
TryToMoveRockford:71bd a9 00 LDA #$00
71bf 85 b7 STA RockfordMoveSucceededFlag
71c1 b1 32 LDA (CaveCurrentCellPtr),Y
71c3 d0 08 BNE TryToMoveRockford__NotSpace
71c5 e6 b7 INC RockfordMoveSucceededFlag
71c7 a9 35 LDA #$35
71c9 8d 08 98 STA $9808
71cc 60 RTS
TryToMoveRockford__NotSpace:71cd c9 01 CMP #$01
71cf d0 08 BNE TryToMoveRockford__NotDirt
71d1 e6 b7 INC RockfordMoveSucceededFlag
71d3 a9 a5 LDA #$a5
71d5 8d 08 98 STA $9808
71d8 60 RTS
TryToMoveRockford__NotDirt:71d9 c9 14 CMP #$14
71db d0 03 BNE TryToMoveRockford__NotDiamond
71dd 4c 91 71 JMP RockfordMovingToDiamond
TryToMoveRockford__NotDiamond:71e0 c9 05 CMP #$05
71e2 d0 0a BNE TryToMoveRockford__NotOutbox
71e4 a9 02 LDA #$02
71e6 85 97 STA ExitCaveFlag
71e8 a9 01 LDA #$01
71ea 85 9f STA EnteredOutboxFlag
71ec e6 b7 INC RockfordMoveSucceededFlag
TryToMoveRockford__NotOutbox:71ee c9 10 CMP #$10
71f0 d0 1e BNE TryToMoveRockford__Finished
71f2 c0 28 CPY #$28
71f4 d0 0b BNE TryToMoveRockford__NotMovingBoulderLeft
71f6 a0 27 LDY #$27
71f8 b1 32 LDA (CaveCurrentCellPtr),Y
71fa d0 03 BNE TryToMoveRockford__CantMoveBoulderLeft
71fc 20 ab 71 JSR RockfordTriesToMoveBoulder
TryToMoveRockford__CantMoveBoulderLeft:71ff a0 28 LDY #$28
TryToMoveRockford__NotMovingBoulderLeft:7201 c0 2a CPY #$2a
7203 d0 0b BNE TryToMoveRockford__Finished
7205 a0 2b LDY #$2b
7207 b1 32 LDA (CaveCurrentCellPtr),Y
7209 d0 03 BNE TryToMoveRockford__CantMoveBoulderRight
720b 20 ab 71 JSR RockfordTriesToMoveBoulder
TryToMoveRockford__CantMoveBoulderRight:720e a0 2a LDY #$2a
TryToMoveRockford__Finished:7210 60 RTS
MoveRockfordIfPossible:7211 20 bd 71 JSR TryToMoveRockford
7214 a5 b7 LDA RockfordMoveSucceededFlag
7216 f0 1d BEQ MoveRockfordIfPossible__CantMove
7218 20 69 6b JSR ReadFireButtonCurrentPlayer
721b d0 0a BNE MoveRockfordIfPossible__FireNotPressed
721d a9 00 LDA #$00
721f 20 b6 6c JSR SetCell
7222 a9 00 LDA #$00
7224 85 b7 STA RockfordMoveSucceededFlag
7226 60 RTS
MoveRockfordIfPossible__FireNotPressed:7227 a9 39 LDA #$39
7229 20 b6 6c JSR SetCell
722c a0 29 LDY #$29
722e a9 00 LDA #$00
7230 20 b6 6c JSR SetCell
7233 e6 b7 INC RockfordMoveSucceededFlag
MoveRockfordIfPossible__CantMove:7235 60 RTS
HandleJoystickForRockford:; 8 4 2 1
; -------
; . . . * Up - $e (14)
; . . * . Down - $d (13)
; . * . . Left - $b (11)
; * . . . Right - $7 (7)
; * . . * ur - $6 (6)
; * . * . dr - $5 (5)
; . * * . dl - $9 (9)
; . * . * ul - $a (10)
7236 c9 0d CMP #$0d
7238 d0 17 BNE HandleJoystickForRockford__NotDown
HandleJoystickForRockford__Down:723a a5 e5 LDA RockfordCellsFromTopOfScreen
723c c9 06 CMP #$06
723e d0 05 BNE $7245
7240 a5 ee LDA ScrollDirectionY
7242 f0 01 BEQ $7245
; Rockford stalls here. This is a weird effect which only happens in the
; x-direction when he's moving to the right, the x-component of the scroll
; is to the left and he's at a specific x-coordinate on the screen.
7244 60 RTS
7245 a0 51 LDY #$51
7247 20 11 72 JSR MoveRockfordIfPossible
724a a5 b7 LDA RockfordMoveSucceededFlag
724c f0 02 BEQ $7250
724e e6 45 INC RockfordY
7250 60 RTS
HandleJoystickForRockford__NotDown:7251 c9 0e CMP #$0e
7253 d0 0c BNE HandleJoystickForRockford__NotUp
HandleJoystickForRockford__Up:7255 a0 01 LDY #$01
7257 20 11 72 JSR MoveRockfordIfPossible
725a a5 b7 LDA RockfordMoveSucceededFlag
725c f0 02 BEQ $7260
725e c6 45 DEC RockfordY
7260 60 RTS
HandleJoystickForRockford__NotUp:7261 c9 08 CMP #$08
7263 b0 1b BCS HandleJoystickForRockford__NotRight
HandleJoystickForRockford__Right:; Right or any diagional that includes right.
7265 a5 e6 LDA RockfordCellsFromLeftOfScreen
7267 c9 08 CMP #$08
7269 d0 05 BNE $7270
726b a5 ea LDA ScrollDirectionX
726d f0 01 BEQ $7270
; Rockford stalls here. This is a weird effect which only happens in the
; y-direction when he's moving down, the y-component of the scroll is up
; and he's at a specific y-coordinate on the screen.
726f 60 RTS
7270 a9 00 LDA #$00
7272 85 98 STA RockfordDir_0Right_1Left_is_sticky_
7274 a0 2a LDY #$2a
7276 20 11 72 JSR MoveRockfordIfPossible
7279 a5 b7 LDA RockfordMoveSucceededFlag
727b f0 02 BEQ $727f
727d e6 44 INC RockfordX
727f 60 RTS
HandleJoystickForRockford__NotRight:7280 c9 0c CMP #$0c
7282 b0 0f BCS HandleJoystickForRockford__Finished
HandleJoystickForRockford__Left:; >=$8 && <$c (not $e or $d)
; Left or any diagional that includes left.
7284 a9 01 LDA #$01
7286 85 98 STA RockfordDir_0Right_1Left_is_sticky_
7288 a0 28 LDY #$28
728a 20 11 72 JSR MoveRockfordIfPossible
728d a5 b7 LDA RockfordMoveSucceededFlag
728f f0 02 BEQ HandleJoystickForRockford__Finished
7291 c6 44 DEC RockfordX
HandleJoystickForRockford__Finished:7293 60 RTS
;
ProcessRockford:7294 a5 a2 LDA IsDemoMode
7296 f0 05 BEQ __ProcessRockford__NotDemoMode
__ProcessRockford__DemoMode:7298 a5 8b LDA JoystickStatus
729a 4c ad 72 JMP __ProcessRockford__Process
__ProcessRockford__NotDemoMode:729d a5 a4 LDA NumJoysticksMinusOne
729f 25 9d AND CurrentPlayer
72a1 f0 05 BEQ $72a8
72a3 20 63 6b JSR ReadJoystickDirectionPort2
; Branch always taken.
__ProcessRockford__Process:72ad 20 36 72 JSR HandleJoystickForRockford
72b0 a9 00 LDA #$00
72b2 85 96 STA RockfordDeadTicks
72b4 4c 15 7e JMP __ProcessCave__NoObjectHandler
; These two tables are processed in one sweep by '.ProcessExplosion'.
ExplodeToSpaceObjectSequenceTable:72b7 1f 00 1e 1f 1d 1e 1c 1d 1b 1c
ExplodeToDiamondObjectSequenceTable:72c1 24 14 23 24 22 23 21 22 20 21
;
PreRockfordObjectSequenceTable:72cb 28 38 27 28 26 27 25 26
;
ProcessExplosion:72d3 a0 29 LDY #$29
72d5 b1 32 LDA (CaveCurrentCellPtr),Y
72d7 a0 00 LDY #$00
ProcessExplosion__FindSequenceLoop:72d9 d9 b7 72 CMP ExplodeToSpaceObjectSequenceTable,Y
72dc d0 03 BNE ProcessExplosion__SequenceNotMatched
72de be b8 72 LDX ExplodeToSpaceObjectSequenceTable+1,Y
ProcessExplosion__SequenceNotMatched:72e1 c8 INY
72e2 c8 INY
72e3 c0 14 CPY #$14
72e5 d0 f2 BNE ProcessExplosion__FindSequenceLoop
72e7 8a TXA
72e8 a0 29 LDY #$29
72ea 20 b6 6c JSR SetCell
72ed 4c 15 7e JMP __ProcessCave__NoObjectHandler
ProcessRockfordsAppearance:72f0 a5 95 LDA FlashingEntryBoxCountDown
72f2 d0 1a BNE ProcessRockfordsAppearance__Exit
72f4 a0 29 LDY #$29
72f6 b1 32 LDA (CaveCurrentCellPtr),Y
72f8 a0 00 LDY #$00
ProcessRockfordsAppearance__FindSequenceLoop:72fa d9 cb 72 CMP PreRockfordObjectSequenceTable,Y
72fd d0 03 BNE ProcessRockfordsAppearance__SequenceNotMatched
72ff be cc 72 LDX PreRockfordObjectSequenceTable+1,Y
ProcessRockfordsAppearance__SequenceNotMatched:7302 c8 INY
7303 c8 INY
7304 c0 08 CPY #$08
7306 d0 f2 BNE ProcessRockfordsAppearance__FindSequenceLoop
7308 8a TXA
7309 a0 29 LDY #$29
730b 20 b6 6c JSR SetCell
ProcessRockfordsAppearance__Exit:730e 4c 15 7e JMP __ProcessCave__NoObjectHandler
RenderSteelWallInInflatedCaveHelper:; $2e is the base character of the first steel wall.
; There'a another at $4a.
7311 a9 2e LDA #$2e
7313 a0 00 LDY #$00
7315 91 36 STA (InflatedCaveOutputPtr),Y
7317 18 CLC
7318 69 01 ADC #$01
731a c8 INY
731b 91 36 STA (InflatedCaveOutputPtr),Y
731d 69 0f ADC #$0f
731f a0 50 LDY #$50
7321 91 36 STA (InflatedCaveOutputPtr),Y
7323 69 01 ADC #$01
7325 c8 INY
7326 91 36 STA (InflatedCaveOutputPtr),Y
7328 60 RTS
RenderSteelWallInInflatedCave:7329 a5 92 LDA CaveMatrixY
732b 0a ASL A
732c aa TAX
732d a5 91 LDA CaveMatrixX
732f 0a ASL A
7330 18 CLC
7331 7d da 53 ADC InflatedCaveLineAddressTable,X
7334 85 34 STA InflatedCaveCurrentCellPtr
7336 a9 00 LDA #$00
7338 7d db 53 ADC InflatedCaveLineAddressTable+1,X
733b 85 35 STA InflatedCaveCurrentCellPtr+1
733d 20 9b 6c JSR SetInflatedCaveOutputPtr
7340 20 11 73 JSR RenderSteelWallInInflatedCaveHelper
7343 60 RTS
;
ProcessInAndOutBoxes:7344 a0 29 LDY #$29
7346 e6 b9 INC FlashingEntryBoxState
7348 a5 b9 LDA FlashingEntryBoxState
734a 29 01 AND #$01
734c d0 0c BNE __ProcessInAndOutBoxes__Steel
; Render cell from lattice to Inflated cave.
; Is either cell $05[E] (outbox) or $25[%] (inbox),
; both of which map to (via .BaseCharNoForObjectTable)
; a hollow box.
__ProcessInAndOutBoxes__Door:734e b1 32 LDA (CaveCurrentCellPtr),Y
7350 20 b6 6c JSR SetCell
; If it's the inbox do some extra processing to arrange
; Rockford's appearence.
7353 c9 25 CMP #$25
7355 d0 06 BNE __ProcessInAndOutBoxes__Exit
7357 4c f0 72 JMP ProcessRockfordsAppearance
__ProcessInAndOutBoxes__Steel:735a 20 29 73 JSR RenderSteelWallInInflatedCave
__ProcessInAndOutBoxes__Exit:735d 4c 15 7e JMP __ProcessCave__NoObjectHandler
;
ProcessStationaryBoulder:7360 a0 51 LDY #$51
7362 b1 32 LDA (CaveCurrentCellPtr),Y
7364 d0 0b BNE ProcessStationaryBoulder__NoSpaceBelow
; $13 = Scanned falling boulder
7366 a9 13 LDA #$13
7368 20 b6 6c JSR SetCell
736b 20 56 6e JSR FallingBoulderSoundFX
736e 4c d7 6c JMP __ProcessCave__ClearCurrentCell
ProcessStationaryBoulder__NoSpaceBelow:7371 a0 51 LDY #$51
7373 b1 32 LDA (CaveCurrentCellPtr),Y
7375 20 65 6e JSR TestIfObjectSlippery
7378 d0 28 BNE ProcessStationaryBoulder__Finished
737a a0 50 LDY #$50
737c b1 32 LDA (CaveCurrentCellPtr),Y
737e d0 0e BNE ProcessStationaryBoulder__CantFallLeft
7380 a0 28 LDY #$28
7382 b1 32 LDA (CaveCurrentCellPtr),Y
7384 d0 08 BNE ProcessStationaryBoulder__CantFallLeft
7386 a9 13 LDA #$13
7388 20 b6 6c JSR SetCell
738b 4c d7 6c JMP __ProcessCave__ClearCurrentCell
ProcessStationaryBoulder__CantFallLeft:738e a0 52 LDY #$52
7390 b1 32 LDA (CaveCurrentCellPtr),Y
7392 d0 0e BNE ProcessStationaryBoulder__Finished
7394 a0 2a LDY #$2a
7396 b1 32 LDA (CaveCurrentCellPtr),Y
7398 d0 08 BNE ProcessStationaryBoulder__Finished
739a a9 13 LDA #$13
739c 20 b6 6c JSR SetCell
739f 4c d7 6c JMP __ProcessCave__ClearCurrentCell
ProcessStationaryBoulder__Finished:73a2 4c 15 7e JMP __ProcessCave__NoObjectHandler
CreateScannedStationaryBoulder:73a5 a0 29 LDY #$29
73a7 a9 11 LDA #$11
73a9 20 b6 6c JSR SetCell
73ac 60 RTS
ProcessFallingBoulder:73ad a0 51 LDY #$51
73af b1 32 LDA (CaveCurrentCellPtr),Y
73b1 d0 08 BNE ProcessFallingBoulder__NoSpaceBelow
; $13 = Scanned falling boulder
73b3 a9 13 LDA #$13
73b5 20 b6 6c JSR SetCell
73b8 4c d7 6c JMP __ProcessCave__ClearCurrentCell
ProcessFallingBoulder__NoSpaceBelow:73bb c9 03 CMP #$03
73bd d0 21 BNE ProcessFallingBoulder__NoMagicWallBelow
73bf a5 8d LDA MagicWallActiveState
73c1 d0 04 BNE ProcessFallingBoulder__MagicWallAlreadyActivated
73c3 a9 01 LDA #$01
73c5 85 8d STA MagicWallActiveState
ProcessFallingBoulder__MagicWallAlreadyActivated:73c7 c9 01 CMP #$01
73c9 d0 0b BNE ProcessFallingBoulder__ClearBoulderAboveMagicWall
73cb a0 79 LDY #$79
73cd b1 32 LDA (CaveCurrentCellPtr),Y
73cf d0 05 BNE ProcessFallingBoulder__ClearBoulderAboveMagicWall
; $17 = Scanned falling diamond
73d1 a9 17 LDA #$17
73d3 20 b6 6c JSR SetCell
ProcessFallingBoulder__ClearBoulderAboveMagicWall:73d6 a9 00 LDA #$00
73d8 a0 29 LDY #$29
73da 20 b6 6c JSR SetCell
; NOTE: When a diamond is consumed my a magic wall the current scan is aborted.
73dd 4c 28 6e JMP FallingDiamondSoundFX
ProcessFallingBoulder__NoMagicWallBelow:73e0 20 56 6e JSR FallingBoulderSoundFX
73e3 a0 51 LDY #$51
73e5 b1 32 LDA (CaveCurrentCellPtr),Y
73e7 20 65 6e JSR TestIfObjectSlippery
73ea d0 2e BNE ProcessFallingBoulder__NotSlipperyHit
73ec a0 50 LDY #$50
73ee b1 32 LDA (CaveCurrentCellPtr),Y
73f0 d0 0e BNE ProcessFallingBoulder__CantFallLeft
73f2 a0 28 LDY #$28
73f4 b1 32 LDA (CaveCurrentCellPtr),Y
73f6 d0 08 BNE ProcessFallingBoulder__CantFallLeft
73f8 a9 13 LDA #$13
73fa 20 b6 6c JSR SetCell
73fd 4c d7 6c JMP __ProcessCave__ClearCurrentCell
ProcessFallingBoulder__CantFallLeft:7400 a0 52 LDY #$52
7402 b1 32 LDA (CaveCurrentCellPtr),Y
7404 d0 0e BNE ProcessFallingBoulder__CantFallRight
7406 a0 2a LDY #$2a
7408 b1 32 LDA (CaveCurrentCellPtr),Y
740a d0 08 BNE ProcessFallingBoulder__CantFallRight
740c a9 13 LDA #$13
740e 20 b6 6c JSR SetCell
7411 4c d7 6c JMP __ProcessCave__ClearCurrentCell
ProcessFallingBoulder__CantFallRight:7414 20 a5 73 JSR CreateScannedStationaryBoulder
7417 4c 15 7e JMP __ProcessCave__NoObjectHandler
ProcessFallingBoulder__NotSlipperyHit:741a c9 38 CMP #$38
741c d0 0a BNE ProcessFallingBoulder__DidntHitRockford
741e a9 1c LDA #$1c
7420 85 89 STA ObjectTypeForUpdateCaveCell
7422 20 22 6d JSR Explode3x3CellsDownOneRow
7425 4c 15 7e JMP __ProcessCave__NoObjectHandler
ProcessFallingBoulder__DidntHitRockford:7428 20 7c 6e JSR CheckIfFallingObjectKillsAnimal
742b d0 06 BNE ProcessFallingBoulder__DidntHitAnimal
742d 20 22 6d JSR Explode3x3CellsDownOneRow
7430 4c 15 7e JMP __ProcessCave__NoObjectHandler
ProcessFallingBoulder__DidntHitAnimal:7433 20 a5 73 JSR CreateScannedStationaryBoulder
7436 4c 15 7e JMP __ProcessCave__NoObjectHandler
BlankLines0and4ofSpaceChars:7439 a9 00 LDA #$00
743b 8d 00 33 STA CopiedGameCharData+$200
743e 8d 04 33 STA CopiedGameCharData+$204
7441 8d 08 33 STA CopiedGameCharData+$208
7444 8d 0c 33 STA CopiedGameCharData+$20c
7447 8d 80 33 STA CopiedGameCharData+$280
744a 8d 84 33 STA CopiedGameCharData+$284
744d 8d 88 33 STA CopiedGameCharData+$288
7450 8d 8c 33 STA CopiedGameCharData+$28c
7453 60 RTS
;
ExtraLifeFX:7454 a5 a8 LDA ExtraLifeFXCounter
7456 c9 01 CMP #$01
7458 d0 06 BNE __ExtraLifeFX__DoFX__
745a 20 39 74 JSR BlankLines0and4ofSpaceChars
745d c6 a8 DEC ExtraLifeFXCounter
745f 60 RTS
;
__ExtraLifeFX__DoFX__:7460 20 d0 6a JSR TimeBasedRandomNumber
7463 8d 00 33 STA CopiedGameCharData+$200
7466 8d 0c 33 STA CopiedGameCharData+$20c
7469 20 d0 6a JSR TimeBasedRandomNumber
746c 8d 84 33 STA CopiedGameCharData+$284
746f 8d 88 33 STA CopiedGameCharData+$288
7472 20 d0 6a JSR TimeBasedRandomNumber
7475 8d 04 33 STA CopiedGameCharData+$204
7478 8d 08 33 STA CopiedGameCharData+$208
747b 20 d0 6a JSR TimeBasedRandomNumber
747e 8d 80 33 STA CopiedGameCharData+$280
7481 8d 8c 33 STA CopiedGameCharData+$28c
7484 c6 a8 DEC ExtraLifeFXCounter
7486 60 RTS
;
ScrollingBGTick:7487 ac 00 20 LDY CopiedTitleChar
748a a2 00 LDX #$00
_AnimateBkgndLoop:748c bd 01 20 LDA CopiedTitleChar+1,X
748f 9d 00 20 STA CopiedTitleChar,X
7492 e8 INX
7493 e0 07 CPX #$07
7495 d0 f5 BNE _AnimateBkgndLoop
7497 8c 07 20 STY CopiedTitleChar+7
749a 60 RTS
;
YScrollTable:749b 03 c0 ff 07 00 00 08 00 00 0c 40 00
XScrollTable:74a7 03 c0 ff 09 00 00 0a 00 00 10 40 00
;
CalcScrollOffsets_XIfNeeded_YIfNeeded:74b3 a5 e1 LDA XScrollTableIndex
74b5 d0 0e BNE $74c5
74b7 a5 e2 LDA XCoarseScrollDirFlag
74b9 d0 0a BNE $74c5
;
CalcXScrollOffsets_X_YIfNeeded:74bb a5 e8 LDA ScreenLeft
74bd 4a LSR A
74be 49 ff EOR #$ff
74c0 38 SEC
74c1 65 44 ADC RockfordX
; These instructions produce the same result as:
; 1. LDA .ScreenLeft
; 2. LSR A
; 3. EOR #$ff
; 5. CLC
; 6. ADC #$01
; 7. CLC
; 8. ADC .unsure_RockfordX
; Steps 1-2 : A = .ScreenLeft/2 (convert from chars to cells)
; Steps 3-6 : A = -A
; Steps 7-8 : A = A + .RockfordX
; So : A = .RockfordX - .ScreenLeft/2
74c3 85 e6 STA RockfordCellsFromLeftOfScreen
;
74c5 a5 e3 LDA YScrollTableIndex
74c7 d0 0e BNE $74d7
74c9 a5 e4 LDA YCoarseScrollDirFlag
74cb d0 0a BNE $74d7
;
CalcYScrollOffsets_Y:74cd a5 ec LDA ScreenTop
74cf 4a LSR A
74d0 49 ff EOR #$ff
74d2 38 SEC
74d3 65 45 ADC RockfordY
74d5 85 e5 STA RockfordCellsFromTopOfScreen
74d7 60 RTS
;
XScrollVicCtl2Table:74d8 15 13 11 17
YScrollVicCtl1Table:; Higher indices scroll up (Rockford moving down).
74dc 17 15 13 11
;
ScheduleYScroll:74e0 a5 e3 LDA YScrollTableIndex
74e2 d0 11 BNE __ScheduleYScroll__ContinueScroll
74e4 a5 e4 LDA YCoarseScrollDirFlag
74e6 d0 0d BNE __ScheduleYScroll__ContinueScroll
74e8 a5 c2 LDA AnotherFrameCounter
74ea 29 01 AND #$01
74ec f0 01 BEQ __ScheduleYScroll__StartScroll
74ee 60 RTS
__ScheduleYScroll__StartScroll:; We only start a scroll if .AnotherFrameCounter is even.
; This is important to keep the scrolling logic in sync with the rest of the IRQ handler.
; (IRQ handler flips buffers on even frames and copies the visible section of the inflated
; cave the the back buffer on odd frames.)
;
; .FineScrollDirY: $40 up, $c0 down.
74ef a5 ed LDA FineScrollDirY
74f1 c9 c0 CMP #$c0
74f3 f0 4d BEQ __ScheduleYScroll__DownOneChar
__ScheduleYScroll__ContinueScroll:74f5 a5 eb LDA FineScrollY
74f7 18 CLC
74f8 65 ed ADC FineScrollDirY
74fa 85 eb STA FineScrollY
; // THE C FLAG IS ALL-IMPORTANT HERE!
74fc a5 ec LDA ScreenTop
74fe 65 ee ADC ScrollDirectionY
7500 85 ec STA ScreenTop
7502 a5 eb LDA FineScrollY
7504 18 CLC
7505 2a ROL A
7506 2a ROL A
7507 2a ROL A
7508 2a ROL A
7509 29 07 AND #$07
750b 4a LSR A
750c 85 e3 STA YScrollTableIndex
750e aa TAX
750f bd dc 74 LDA YScrollVicCtl1Table,X
; It is important to realise that this is the $d011 setting for the NEXT frame.
; $d011 has already been set from .RastInt_vic_control1 earlier in the handler.
7512 85 54 STA RastInt_vic_control1
7514 a5 e3 LDA YScrollTableIndex
7516 c9 01 CMP #$01
; "Why compare to 1?", you ask:
; ============================================================================================
;
; Let's assume we've just initiated a scroll.
; n is always even since scrolling only starts on even frames.
;
; Frame n+0 (this frame):
; -----------------------
; 1) .RastInt_vic_control1 = .YScrollVicCtl1Table[1] ($15)
; This setting takes effect in the next frame.
; The previous setting was .YScrollVicCtl1Table[0] ($17), the resting state when not scrolling.
;
; 2) We change .InflatedCaveSubsetPtrH & InflatedCaveSubsetPtrL.
; Since the Inflated Cave is copied to the back buffer on odd frames and it then has to be
; flipped to the front, which happens in even frames, this change will not be seen for a bit.
; This is why we do it at what seems like a strange fine scroll value (not an extreme).
;
; 3). Our caller flips the buffers (since we're an even frame).
;
; Frame n+1:
; ----------
; The $d011 value set during in frame n+0 ($15) is now in effect.
;
; 1) .RastInt_vic_control1 = .YScrollVicCtl1Table[2] ($13)
;
; 2) Our caller copies the Inflated Cave to the back buffer.
; The back buffer now reflects the changes made in frame n+0 step 2.
; It is not visible yet however as it has to be flipped to the front.
;
; Frame n+2:
; ----------
; The $d011 value set during in frame n+1 ($13) is now in effect.
; We have looped! That means we need a coarse scroll.
; The sequence is 4, 5, 6, 7, 0, 1, 2, 3 because of bad line strangeness
; due to the screen splitting. Boulder Dash only uses 5, 7, 1, 3.
;
; 1) .RastInt_vic_control1 = .YScrollVicCtl1Table[3] ($11)
;
; 2) Our caller flips the buffers. The changes made in frame n+0 step 2 are now visible,
; just when we need them!
__ScheduleYScroll__UpOneChar:; Stuff on screen moves up, Rockford moving down.
751e a5 d6 LDA InflatedCaveSubset
7520 18 CLC
7521 69 50 ADC #$50
7523 85 d6 STA InflatedCaveSubset
7525 a5 d7 LDA InflatedCaveSubset+1
7527 69 00 ADC #$00
7529 85 d7 STA InflatedCaveSubset+1
752b a5 e3 LDA YScrollTableIndex
752d d0 25 BNE $7554
752f a5 e4 LDA YCoarseScrollDirFlag
7531 c9 01 CMP #$01
7533 d0 1f BNE $7554
7535 20 cd 74 JSR CalcYScrollOffsets_Y
7538 a5 ec LDA ScreenTop
753a f0 18 BEQ $7554
753c a5 e5 LDA RockfordCellsFromTopOfScreen
753e c9 07 CMP #$07
7540 f0 12 BEQ $7554
__ScheduleYScroll__DownOneChar:; Stuff on screen moves down, Rockford moving up.
;
; Things are slightly different when scrolling down (Rockford going up). We start scrolling on an
; even frame and under these conditions, as explained above. The fine scroll changes take one frame
; to reach the screen and the coarse scroll changes take two frames. The $d011 scroll settings to
; scroll up are 5, 7, 1 & 3, we rest on 7. Since the coarse scroll path is two frames we schedule a
; coarse scroll this frame but hold off scheduling a fine scroll till the next frame (which takes
; only one frame). This means it takes two frames to initiate an upward scroll whereas scrolling
; down takes one.
7542 a5 d6 LDA InflatedCaveSubset
7544 38 SEC
7545 e9 50 SBC #$50
7547 85 d6 STA InflatedCaveSubset
7549 a5 d7 LDA InflatedCaveSubset+1
754b e9 00 SBC #$00
754d 85 d7 STA InflatedCaveSubset+1
754f a9 03 LDA #$03
7551 85 e4 STA YCoarseScrollDirFlag
7553 60 RTS
7554 a5 e3 LDA YScrollTableIndex
7556 85 e4 STA YCoarseScrollDirFlag
7558 60 RTS
;
ScheduleXScroll:7559 a5 e1 LDA XScrollTableIndex
755b d0 11 BNE $756e
755d a5 e2 LDA XCoarseScrollDirFlag
755f d0 0d BNE $756e
7561 a5 c2 LDA AnotherFrameCounter
7563 29 01 AND #$01
7565 f0 01 BEQ $7568
7567 60 RTS
7568 a5 e9 LDA FineScrollDirX
756a c9 c0 CMP #$c0
756c f0 50 BEQ $75be
756e a5 e7 LDA FineScrollX
7570 18 CLC
7571 65 e9 ADC FineScrollDirX
7573 85 e7 STA FineScrollX
7575 a5 e8 LDA ScreenLeft
7577 65 ea ADC ScrollDirectionX
7579 85 e8 STA ScreenLeft
757b a5 e7 LDA FineScrollX
757d 18 CLC
757e 2a ROL A
757f 2a ROL A
7580 2a ROL A
7581 29 03 AND #$03
7583 85 e1 STA XScrollTableIndex
7585 aa TAX
7586 bd d8 74 LDA XScrollVicCtl2Table,X
7589 a6 95 LDX FlashingEntryBoxCountDown
758b d0 08 BNE $7595
758d a6 5d LDX Cave
758f e0 11 CPX #$11
7591 90 02 BCC $7595
7593 09 08 ORA #$08
7595 85 56 STA RastInt_vic_control2
7597 a5 e1 LDA XScrollTableIndex
7599 c9 01 CMP #$01
759b d0 0a BNE $75a7
759d a5 e2 LDA XCoarseScrollDirFlag
759f d0 06 BNE $75a7
75a1 e6 d6 INC InflatedCaveSubset
75a3 d0 02 BNE $75a7
75a5 e6 d7 INC InflatedCaveSubset+1
75a7 a5 e1 LDA XScrollTableIndex
75a9 d0 25 BNE $75d0
75ab a5 e2 LDA XCoarseScrollDirFlag
75ad c9 01 CMP #$01
75af d0 1f BNE $75d0
75b1 20 bb 74 JSR CalcXScrollOffsets_X_YIfNeeded
75b4 a5 e8 LDA ScreenLeft
75b6 f0 18 BEQ $75d0
75b8 a5 e6 LDA RockfordCellsFromLeftOfScreen
75ba c9 09 CMP #$09
75bc f0 12 BEQ $75d0
75be a5 d6 LDA InflatedCaveSubset
75c0 38 SEC
75c1 e9 01 SBC #$01
75c3 85 d6 STA InflatedCaveSubset
75c5 a5 d7 LDA InflatedCaveSubset+1
75c7 e9 00 SBC #$00
75c9 85 d7 STA InflatedCaveSubset+1
75cb a9 03 LDA #$03
75cd 85 e2 STA XCoarseScrollDirFlag
75cf 60 RTS
75d0 a5 e1 LDA XScrollTableIndex
75d2 85 e2 STA XCoarseScrollDirFlag
75d4 60 RTS
;
StopScrollingAtEdges:75d5 a2 00 LDX #$00
__StopScrollingAtEdges__ClipYDir:; We only stop the scroll if we've fine scrolled right up to the edge.
75d7 a5 eb LDA FineScrollY
75d9 d0 18 BNE __StopScrollingAtEdges__ClipXDir
75db a5 ec LDA ScreenTop
75dd d0 08 BNE __StopScrollingAtEdges__NotScrolledFullyDown
__StopScrollingAtEdges__ScrolledFullyUp:75df a4 ee LDY ScrollDirectionY
75e1 f0 04 BEQ __StopScrollingAtEdges__NotScrolledFullyDown
__StopScrollingAtEdges__DirUp:; Stop the Y-scroll.
75e3 86 ed STX FineScrollDirY
75e5 86 ee STX ScrollDirectionY
__StopScrollingAtEdges__NotScrolledFullyDown:75e7 c9 15 CMP #$15
75e9 d0 08 BNE __StopScrollingAtEdges__ClipXDir
__StopScrollingAtEdges__ScrolledFullyUp2:75eb a4 ee LDY ScrollDirectionY
75ed d0 04 BNE __StopScrollingAtEdges__ClipXDir
__StopScrollingAtEdges__DirUp2:; Stop the Y-scroll.
75ef 86 ed STX FineScrollDirY
75f1 86 ee STX ScrollDirectionY
;
__StopScrollingAtEdges__ClipXDir:; We only stop the scroll if we've fine scrolled right up to the edge.
75f3 a5 e7 LDA FineScrollX
75f5 d0 18 BNE __StopScrollingAtEdges__Exit
75f7 a5 e8 LDA ScreenLeft
75f9 d0 08 BNE $7603
__StopScrollingAtEdges__ScrolledFullyRight:75fb a4 ea LDY ScrollDirectionX
75fd f0 04 BEQ $7603
__StopScrollingAtEdges__DirLeft:; Stop the X-scroll.
75ff 86 e9 STX FineScrollDirX
7601 86 ea STX ScrollDirectionX
;
7603 c9 2a CMP #$2a
7605 d0 08 BNE __StopScrollingAtEdges__Exit
__StopScrollingAtEdges__ScrolledFullyLeft:7607 a4 ea LDY ScrollDirectionX
7609 d0 04 BNE __StopScrollingAtEdges__Exit
__StopScrollingAtEdges__DirRight:; Stop the X-scroll.
760b 86 e9 STX FineScrollDirX
760d 86 ea STX ScrollDirectionX
;
__StopScrollingAtEdges__Exit:760f 60 RTS
;
ChooseYScrollDirection:7610 a5 e5 LDA RockfordCellsFromTopOfScreen
7612 c9 0b CMP #$0b
7614 30 08 BMI $761e
; Scroll down if Rockford is >=11 cells from top.
__ChooseYScrollDirection__Up:7616 a9 40 LDA #$40
7618 85 ed STA FineScrollDirY
761a a9 00 LDA #$00
761c 85 ee STA ScrollDirectionY
761e a5 e5 LDA RockfordCellsFromTopOfScreen
7620 c9 05 CMP #$05
7622 10 08 BPL $762c
; Scroll up if Rockford is <5 cells from top.
__ChooseYScrollDirection__Down:7624 a9 c0 LDA #$c0
7626 85 ed STA FineScrollDirY
7628 a9 ff LDA #$ff
762a 85 ee STA ScrollDirectionY
762c 60 RTS
ChooseXScrollDirection:762d a5 e6 LDA RockfordCellsFromLeftOfScreen
762f c9 11 CMP #$11
7631 30 08 BMI $763b
; Scroll right if Rockford >=17 cells from left.
__ChooseXScrollDirection__Left:7633 a9 40 LDA #$40
7635 85 e9 STA FineScrollDirX
7637 a9 00 LDA #$00
7639 85 ea STA ScrollDirectionX
763b a5 e6 LDA RockfordCellsFromLeftOfScreen
763d c9 03 CMP #$03
763f 10 08 BPL $7649
; Scroll left if Rockford <3 cells from left.
__ChooseXScrollDirection__Right:7641 a9 c0 LDA #$c0
7643 85 e9 STA FineScrollDirX
7645 a9 ff LDA #$ff
7647 85 ea STA ScrollDirectionX
7649 60 RTS
ChooseScrollDirection:764a a0 09 LDY #$09
764c a2 04 LDX #$04
__ChooseScrollDirection__YLoop:764e a5 e5 LDA RockfordCellsFromTopOfScreen
7650 d9 9b 74 CMP YScrollTable,Y
7653 d0 0a BNE __ChooseScrollDirection__YNoMatch
__ChooseScrollDirection__YMatch:7655 b9 9c 74 LDA YScrollTable+1,Y
7658 85 ed STA FineScrollDirY
765a b9 9d 74 LDA YScrollTable+2,Y
765d 85 ee STA ScrollDirectionY
__ChooseScrollDirection__YNoMatch:765f a5 ec LDA ScreenTop
7661 f0 0f BEQ __ChooseScrollDirection__YNext
7663 a5 ed LDA FineScrollDirY
7665 d0 0b BNE __ChooseScrollDirection__YNext
7667 a5 95 LDA FlashingEntryBoxCountDown
7669 f0 07 BEQ __ChooseScrollDirection__YNext
766b a5 e5 LDA RockfordCellsFromTopOfScreen
766d d9 9b 74 CMP YScrollTable,Y
7670 90 e3 BCC __ChooseScrollDirection__YMatch
__ChooseScrollDirection__YNext:7672 88 DEY
7673 88 DEY
7674 88 DEY
7675 ca DEX
7676 d0 d6 BNE __ChooseScrollDirection__YLoop
7678 20 10 76 JSR ChooseYScrollDirection
767b a0 09 LDY #$09
767d a2 04 LDX #$04
767f a5 e6 LDA RockfordCellsFromLeftOfScreen
7681 d9 a7 74 CMP XScrollTable,Y
7684 d0 0a BNE $7690
7686 b9 a8 74 LDA XScrollTable+1,Y
7689 85 e9 STA FineScrollDirX
768b b9 a9 74 LDA XScrollTable+2,Y
768e 85 ea STA ScrollDirectionX
7690 a5 e8 LDA ScreenLeft
7692 f0 0f BEQ $76a3
7694 a5 e9 LDA FineScrollDirX
7696 d0 0b BNE $76a3
7698 a5 95 LDA FlashingEntryBoxCountDown
769a f0 07 BEQ $76a3
769c a5 e6 LDA RockfordCellsFromLeftOfScreen
769e d9 a7 74 CMP XScrollTable,Y
76a1 90 e3 BCC $7686
76a3 88 DEY
76a4 88 DEY
76a5 88 DEY
76a6 ca DEX
76a7 d0 d6 BNE $767f
76a9 20 2d 76 JSR ChooseXScrollDirection
76ac 60 RTS
;
Scroller:76ad a5 a6 LDA IsBonusLevelFlag
76af f0 05 BEQ __Scroller__DoScroll
76b1 a5 95 LDA FlashingEntryBoxCountDown
76b3 d0 01 BNE __Scroller__DoScroll
76b5 60 RTS
__Scroller__DoScroll:76b6 20 b3 74 JSR CalcScrollOffsets_XIfNeeded_YIfNeeded
76b9 20 4a 76 JSR ChooseScrollDirection
76bc 20 d5 75 JSR StopScrollingAtEdges
76bf 20 59 75 JSR ScheduleXScroll
76c2 20 e0 74 JSR ScheduleYScroll
76c5 60 RTS
;
AdvanceCaveCurrentCellPtr:76c6 e6 32 INC CaveCurrentCellPtr
76c8 d0 02 BNE $76cc
76ca e6 33 INC CaveCurrentCellPtr+1
76cc 60 RTS
; IN: ZF, A
;
; .CaveCurrentCellPtr(???) points to the NW cell ($00).
; The current cell C is at an offset of $29. See table below:
; ---------------------
; |NW:$00|N:$01|NE:$02|
; |------+-----+------|
; | W:$28|C:$29| E:$2a|
; |------+-----+------|
; |SW:$50|S:$51|SE:$52|
; |======+=====+======|
; | $78| $79| $7a|
; ---------------------
ResetCaveCurrentCellPtr:76cd f0 02 BEQ $76d1
76cf a9 28 LDA #$28
76d1 18 CLC
76d2 69 27 ADC #$27
76d4 85 32 STA CaveCurrentCellPtr
76d6 a9 08 LDA #$08
76d8 85 33 STA CaveCurrentCellPtr+1
76da 60 RTS
;
FillInflatedCaveWithScrollingSteelWallChar:76db a2 00 LDX #$00
76dd bd da 53 LDA InflatedCaveLineAddressTable,X
76e0 85 34 STA InflatedCaveCurrentCellPtr
76e2 bd db 53 LDA InflatedCaveLineAddressTable+1,X
76e5 85 35 STA InflatedCaveCurrentCellPtr+1
76e7 a0 00 LDY #$00
76e9 a9 7c LDA #$7c
76eb 91 34 STA (InflatedCaveCurrentCellPtr),Y
76ed c8 INY
; $a0(160) is two character lines (each cell is 2x2).
76ee c0 a0 CPY #$a0
76f0 d0 f9 BNE $76eb
76f2 e8 INX
76f3 e8 INX
76f4 e0 2c CPX #$2c
76f6 d0 e5 BNE $76dd
76f8 60 RTS
;
CoverLevel:; Build a line address table for currently visible
; portion of empanded lattice.
76f9 a5 d6 LDA InflatedCaveSubset
76fb 85 02 STA __CoverLevel__LineAddressTable
76fd a5 d7 LDA InflatedCaveSubset+1
76ff 85 03 STA __CoverLevel__LineAddressTable+1
7701 a2 00 LDX #$00
7703 b5 02 LDA __CoverLevel__LineAddressTable,X
7705 18 CLC
7706 69 50 ADC #$50
7708 95 04 STA __CoverLevel__LineAddressTable+2,X
770a b5 03 LDA __CoverLevel__LineAddressTable+1,X
770c 69 00 ADC #$00
770e 95 05 STA __CoverLevel__LineAddressTable+3,X
7710 e8 INX
7711 e8 INX
7712 e0 2e CPX #$2e
7714 d0 ed BNE $7703
;
7716 a9 00 LDA #$00
; Not used as CellX. Is a simple loop counter.
7718 85 91 STA CaveMatrixX
__CoverLevel__Outer:771a a2 00 LDX #$00
__CoverLevel__Inner:771c a9 00 LDA #$00
; .CoverLevel::__POINTLESS really is totally pointless. The game does
; both read and write it but it has no effect. We never actually get
; to $7736 and even if we did we'd simply fall through to
; .__CoverLevel__PointlessBranchTarget. I suspect that during development
; the plan was to first cover the level with scrolling steel walls for a bit
; and then start filling with spaces - a sort of fade in fade out effect -
; and the pointless code and variable are what's left.
771e 85 ba STA CoverLevel__POINTLESS__
7720 b5 02 LDA __CoverLevel__LineAddressTable,X
7722 85 36 STA InflatedCaveOutputPtr
7724 b5 03 LDA __CoverLevel__LineAddressTable+1,X
7726 85 37 STA InflatedCaveOutputPtr+1
__CoverLevel__RandomNumber:7728 20 d0 6a JSR TimeBasedRandomNumber
772b 29 3f AND #$3f
772d c9 2b CMP #$2b
; Take branch below if A>=$2b(43)
772f b0 f7 BCS __CoverLevel__RandomNumber
; 0<=A<=$2a(42)
7731 a8 TAY
7732 e6 ba INC CoverLevel__POINTLESS__
7734 d0 04 BNE __CoverLevel__PointlessBranchTarget
7736 a9 00 LDA #$00
7738 91 36 STA (InflatedCaveOutputPtr),Y
__CoverLevel__PointlessBranchTarget:; $7c is scrolling steel wall.
773a a9 7c LDA #$7c
773c 91 36 STA (InflatedCaveOutputPtr),Y
773e e8 INX
773f e8 INX
7740 e0 30 CPX #$30
7742 d0 d8 BNE __CoverLevel__Inner
7744 e6 91 INC CaveMatrixX
7746 a5 91 LDA CaveMatrixX
7748 c9 30 CMP #$30
774a d0 ce BNE __CoverLevel__Outer
774c 60 RTS
; Pads the Inflated Cave ($4003 - $4DC2) with 1st steel wall char ($4a).
; Padded bytes: $4000-4002 (3 bytes) and $4dc3-4ec2 (256 bytes).
PadInflatedCave:774d a2 00 LDX #$00
774f a9 4a LDA #$4a
7751 9d c3 4d STA InflatedCave__END_PLUS_ONE__,X
7754 ca DEX
7755 d0 fa BNE $7751
7757 a2 02 LDX #$02
7759 9d 00 40 STA $4000,X
775c ca DEX
775d 10 fa BPL $7759
775f 60 RTS
; Uncover one random cell on each line, 69 times (no already uncovered checks).
RandomlyUncoverScreen:; Loop 69 times.
7760 a9 45 LDA #$45
7762 85 bb STA _LoopCounter
;
7764 a9 00 LDA #$00
7766 85 92 STA CaveMatrixY
7768 20 cd 76 JSR ResetCaveCurrentCellPtr
__RandomlyUncoverScreen__GetRandomNumber:776b 20 d0 6a JSR TimeBasedRandomNumber
776e 85 91 STA CaveMatrixX
7770 a9 27 LDA #$27
7772 38 SEC
7773 e5 91 SBC CaveMatrixX
7775 90 f4 BCC __RandomlyUncoverScreen__GetRandomNumber
; .CaveCurrentCellX <= $27(39)
; A = 39-.CaveCurrentCellX
7777 85 bc STA RandomlyUncoverScreen__OffsetToStartOfNextLine
7779 e6 bc INC RandomlyUncoverScreen__OffsetToStartOfNextLine
; .RandomlyUncoverScreen::OffsetToStartOfNextLine = 40-.CaveCurrentCellX
;
; Adjust .CaveCurrentCellPtr(Low&High) to point to .CaveCurrentCellX on the line.
777b a5 32 LDA CaveCurrentCellPtr
777d 18 CLC
777e 65 91 ADC CaveMatrixX
7780 85 32 STA CaveCurrentCellPtr
7782 a5 33 LDA CaveCurrentCellPtr+1
7784 69 00 ADC #$00
7786 85 33 STA CaveCurrentCellPtr+1
; Setting the cell to itself like this will make it appear.
7788 a0 29 LDY #$29
778a b1 32 LDA (CaveCurrentCellPtr),Y
778c 20 b6 6c JSR SetCell
; Move to the start of the next line.
778f a5 32 LDA CaveCurrentCellPtr
7791 18 CLC
7792 65 bc ADC RandomlyUncoverScreen__OffsetToStartOfNextLine
7794 85 32 STA CaveCurrentCellPtr
7796 a5 33 LDA CaveCurrentCellPtr+1
7798 69 00 ADC #$00
779a 85 33 STA CaveCurrentCellPtr+1
;
779c e6 92 INC CaveMatrixY
779e a5 92 LDA CaveMatrixY
77a0 c9 16 CMP #$16
77a2 d0 c7 BNE __RandomlyUncoverScreen__GetRandomNumber
77a4 c6 bb DEC _LoopCounter
77a6 d0 bc BNE $7764
77a8 60 RTS
;
PlayRevealLevelSoundAndRedefineChar:77a9 a5 bd LDA PlayRevealLevelSoundAndRedefineCharFlag
77ab f0 4b BEQ __PlayRevealLevelSoundAndRedefineChar__Disabled
__PlayRevealLevelSoundAndRedefineChar__Enabled:77ad a9 00 LDA #$00
77af 8d 0d 98 STA $980d
; We add one before we use it, so the phase number outside are one less than in here.
77b2 ee 0b 98 INC PlayRevealLevelSoundAndRedefineChar__SFXPhase
77b5 ad 0b 98 LDA PlayRevealLevelSoundAndRedefineChar__SFXPhase
77b8 c9 02 CMP #$02
77ba f0 24 BEQ __PlayRevealLevelSoundAndRedefineChar__RedefineChar
77bc c9 01 CMP #$01
77be d0 16 BNE __PlayRevealLevelSoundAndRedefineChar__ReleasePhase
; 1 = Attack phase
__PlayRevealLevelSoundAndRedefineChar__AttackPhase:77c0 a9 05 LDA #$05
77c2 8d 0c d4 STA Sid_Voice2AttackDecay
77c5 20 d0 6a JSR TimeBasedRandomNumber
77c8 29 7f AND #$7f
77ca 69 64 ADC #$64
77cc 8d 08 d4 STA Sid_Voice2FreqHi
77cf a9 11 LDA #$11
77d1 8d 0b d4 STA Sid_Voice2Ctrl
; Branch always taken.
77d4 d0 0a BNE __PlayRevealLevelSoundAndRedefineChar__RedefineChar
; 3 = Release phase
__PlayRevealLevelSoundAndRedefineChar__ReleasePhase:77d6 a2 00 LDX #$00
77d8 8e 0b 98 STX PlayRevealLevelSoundAndRedefineChar__SFXPhase
77db a9 10 LDA #$10
77dd 8d 0b d4 STA Sid_Voice2Ctrl
; 2 = Sustain phase
__PlayRevealLevelSoundAndRedefineChar__RedefineChar:77e0 ad e0 33 LDA CopiedGameCharData+$2e0
77e3 85 4a STA PlayRevealLevelSoundAndRedefineChar__FirstLine
77e5 a2 00 LDX #$00
__PlayRevealLevelSoundAndRedefineChar__Loop:77e7 bd e1 33 LDA CopiedGameCharData+$2e1,X
77ea 9d e0 33 STA CopiedGameCharData+$2e0,X
77ed e8 INX
77ee e0 07 CPX #$07
77f0 d0 f5 BNE __PlayRevealLevelSoundAndRedefineChar__Loop
77f2 a5 4a LDA PlayRevealLevelSoundAndRedefineChar__FirstLine
77f4 8d e7 33 STA CopiedGameCharData+$2e7
77f7 60 RTS
__PlayRevealLevelSoundAndRedefineChar__Disabled:; When can be disabled in any phase so reset it to the attack phase.
77f8 a9 00 LDA #$00
77fa 8d 0b 98 STA PlayRevealLevelSoundAndRedefineChar__SFXPhase
77fd 60 RTS
;
UncoverCaveScreen:; Randomly "uncover" screen.
; The game is mainly interrupt driven and the this function takes some
; time to complete. When it returns the screen will not be totally uncovered.
77fe 20 60 77 JSR RandomlyUncoverScreen
; Uncover the entire screen.
7801 a9 00 LDA #$00
7803 85 92 STA CaveMatrixY
7805 20 cd 76 JSR ResetCaveCurrentCellPtr
7808 a9 00 LDA #$00
780a 85 91 STA CaveMatrixX
780c a0 29 LDY #$29
780e b1 32 LDA (CaveCurrentCellPtr),Y
7810 20 b6 6c JSR SetCell
7813 20 c6 76 JSR AdvanceCaveCurrentCellPtr
7816 e6 91 INC CaveMatrixX
7818 a5 91 LDA CaveMatrixX
781a c9 28 CMP #$28
781c d0 ee BNE $780c
781e e6 92 INC CaveMatrixY
7820 a5 92 LDA CaveMatrixY
7822 c9 16 CMP #$16
7824 d0 e2 BNE $7808
; What is the purpose of the padding?
7826 20 4d 77 JSR PadInflatedCave
7829 60 RTS
; Handle animating Rockford.
; IN: X is source offset. Y is destination offset.
; X and Y are preserved.
AnimateRockford:782a a5 8b LDA JoystickStatus
782c c9 0f CMP #$0f
782e f0 3c BEQ AnimateRockford__Bored
7830 a9 00 LDA #$00
7832 85 be STA __TapFootFlag
7834 85 bf STA __BlinkFlag
7836 a5 98 LDA RockfordDir_0Right_1Left_is_sticky_
7838 d0 19 BNE $7853
; Right facing.
783a bd e8 65 LDA RockfordAnimationChars+$200,X
783d 99 60 32 STA CopiedGameCharData+$160,Y
7840 bd f0 65 LDA RockfordAnimationChars+$208,X
7843 99 68 32 STA CopiedGameCharData+$168,Y
7846 bd 68 66 LDA RockfordAnimationChars+$280,X
7849 99 e0 32 STA CopiedGameCharData+$1e0,Y
784c bd 70 66 LDA RockfordAnimationChars+$288,X
784f 99 e8 32 STA CopiedGameCharData+$1e8,Y
7852 60 RTS
; Left facing.
7853 bd e8 64 LDA RockfordAnimationChars+$100,X
7856 99 60 32 STA CopiedGameCharData+$160,Y
7859 bd f0 64 LDA RockfordAnimationChars+$108,X
785c 99 68 32 STA CopiedGameCharData+$168,Y
785f bd 68 65 LDA RockfordAnimationChars+$180,X
7862 99 e0 32 STA CopiedGameCharData+$1e0,Y
7865 bd 70 65 LDA RockfordAnimationChars+$188,X
7868 99 e8 32 STA CopiedGameCharData+$1e8,Y
786b 60 RTS
AnimateRockford__Bored:786c e0 00 CPX #$00
786e d0 1c BNE AnimateRockford__RedfineBlinkingChars
AnimateRockford__FirstLine:7870 a9 00 LDA #$00
7872 85 bf STA __BlinkFlag
7874 20 d0 6a JSR TimeBasedRandomNumber
7877 29 03 AND #$03
7879 d0 04 BNE AnimateRockford__DontBlink
; Set blink flag. There's a 1 in 4 chance of this occuring.
787b a9 01 LDA #$01
787d 85 bf STA __BlinkFlag
AnimateRockford__DontBlink:787f 20 d0 6a JSR TimeBasedRandomNumber
7882 29 0f AND #$0f
7884 d0 06 BNE AnimateRockford__RedfineBlinkingChars
; Toggle the foot tapping. There's a one in 16 chance of this.
7886 a9 01 LDA #$01
7888 45 be EOR __TapFootFlag
788a 85 be STA __TapFootFlag
AnimateRockford__RedfineBlinkingChars:788c a5 bf LDA __BlinkFlag
788e f0 0f BEQ AnimateRockford__ResetBlinkingChars
7890 bd e8 63 LDA RockfordAnimationChars,X
7893 99 60 32 STA CopiedGameCharData+$160,Y
7896 bd f0 63 LDA RockfordAnimationChars+8,X
7899 99 68 32 STA CopiedGameCharData+$168,Y
789c 4c ab 78 JMP AnimateRockford__RedfineFootTappingChars
AnimateRockford__ResetBlinkingChars:789f b9 10 32 LDA CopiedGameCharData+$110,Y
78a2 99 60 32 STA CopiedGameCharData+$160,Y
78a5 b9 18 32 LDA CopiedGameCharData+$118,Y
78a8 99 68 32 STA CopiedGameCharData+$168,Y
AnimateRockford__RedfineFootTappingChars:78ab a5 be LDA __TapFootFlag
78ad f0 0d BEQ AnimateRockford__ResetFootTappingChars
78af bd 68 64 LDA RockfordAnimationChars+$80,X
78b2 99 e0 32 STA CopiedGameCharData+$1e0,Y
78b5 bd 70 64 LDA RockfordAnimationChars+$88,X
78b8 99 e8 32 STA CopiedGameCharData+$1e8,Y
78bb 60 RTS
AnimateRockford__ResetFootTappingChars:78bc b9 90 32 LDA CopiedGameCharData+$190,Y
78bf 99 e0 32 STA CopiedGameCharData+$1e0,Y
78c2 b9 98 32 LDA CopiedGameCharData+$198,Y
78c5 99 e8 32 STA CopiedGameCharData+$1e8,Y
78c8 60 RTS
AnimateGameCharsAndHandleTopLineSwitch:78c9 a5 95 LDA FlashingEntryBoxCountDown
78cb d0 07 BNE $78d4
78cd a5 94 LDA EnableSomeSFXAndMarqueeUpdates
78cf f0 03 BEQ $78d4
78d1 20 05 71 JSR SetTopLineToScore
78d4 a5 c0 LDA AnimationFrameTimes8
78d6 0a ASL A
78d7 aa TAX
78d8 a0 00 LDY #$00
AnimateGameCharsAndHandleTopLineSwitch__Loop:; Diamonds
78da bd 06 56 LDA AnimatedCharData+$200,X
78dd 99 40 32 STA CopiedGameCharData+$140,Y
78e0 bd 0e 56 LDA AnimatedCharData+$208,X
78e3 99 48 32 STA CopiedGameCharData+$148,Y
78e6 bd 86 56 LDA AnimatedCharData+$280,X
78e9 99 c0 32 STA CopiedGameCharData+$1c0,Y
78ec bd 8e 56 LDA AnimatedCharData+$288,X
78ef 99 c8 32 STA CopiedGameCharData+$1c8,Y
;
; Amoeba
78fa bd 06 54 LDA AnimatedCharData,X
78fd 99 00 32 STA CopiedGameCharData+$100,Y
7900 bd 0e 54 LDA AnimatedCharData+8,X
7903 99 08 32 STA CopiedGameCharData+$108,Y
7906 bd 86 54 LDA AnimatedCharData+$80,X
7909 99 80 32 STA CopiedGameCharData+$180,Y
790c bd 8e 54 LDA AnimatedCharData+$88,X
790f 99 88 32 STA CopiedGameCharData+$188,Y
;
7912 a5 ff LDA AnimationEnableFlags
7914 29 02 AND #$02
7916 f0 18 BEQ $7930
; Butterfly
7918 bd 06 57 LDA AnimatedCharData+$300,X
791b 99 00 31 STA CopiedGameCharData,Y
791e bd 0e 57 LDA AnimatedCharData+$308,X
7921 99 08 31 STA CopiedGameCharData+8,Y
7924 bd 86 57 LDA AnimatedCharData+$380,X
7927 99 80 31 STA CopiedGameCharData+$80,Y
792a bd 8e 57 LDA AnimatedCharData+$388,X
792d 99 88 31 STA CopiedGameCharData+$88,Y
;
7930 a5 ff LDA AnimationEnableFlags
7932 29 01 AND #$01
7934 f0 18 BEQ $794e
; Firefly
7936 bd 06 55 LDA AnimatedCharData+$100,X
7939 99 20 33 STA CopiedGameCharData+$220,Y
793c bd 0e 55 LDA AnimatedCharData+$108,X
793f 99 28 33 STA CopiedGameCharData+$228,Y
7942 bd 86 55 LDA AnimatedCharData+$180,X
7945 99 a0 33 STA CopiedGameCharData+$2a0,Y
7948 bd 8e 55 LDA AnimatedCharData+$188,X
794b 99 a8 33 STA CopiedGameCharData+$2a8,Y
;
794e 20 2a 78 JSR AnimateRockford
7951 e8 INX
7952 c8 INY
7953 c0 08 CPY #$08
7955 d0 83 BNE AnimateGameCharsAndHandleTopLineSwitch__Loop
7957 60 RTS
WhiteFlash:7958 a5 a5 LDA WhiteFlashWhiteCount
795a f0 14 BEQ $7970
795c a9 01 LDA #$01
795e 8d 21 d0 STA Vic_BkgndColour0
7961 8d 20 d0 STA Vic_BorderColour
7964 c6 a5 DEC WhiteFlashWhiteCount
7966 d0 08 BNE $7970
7968 a9 00 LDA #$00
796a 8d 21 d0 STA Vic_BkgndColour0
796d 8d 20 d0 STA Vic_BorderColour
7970 60 RTS
SoundFX:7971 a9 0f LDA #$0f
7973 8d 18 d4 STA Sid_FilterModeAndVolume
7976 a5 9b LDA SecondsDontPass
7978 f0 01 BEQ SoundFX_NotPaused
SoundFX_Paused:797a 60 RTS
SoundFX_NotPaused:797b a5 d8 LDA SFXTrigger_DiamondQuotaReachedOrEntryBoxExplode
797d f0 21 BEQ $79a0
SoundFX_DiamondQuotaReachedOrEntryBoxExplode_Check:797f a5 d9 LDA SFXTimer_DiamondQuotaReachedOrEntryBoxExplode
7981 d0 12 BNE SoundFX_DiamondQuotaReachedOrEntryBoxExplode_InProgress
SoundFX_DiamondQuotaReachedOrEntryBoxExplode_Start:7983 20 e7 7c JSR ResetVoice3
7986 a2 06 LDX #$06
7988 bd 80 70 LDA DiamondQuotaReachedSoundSIDValues,X
798b 9d 0e d4 STA Sid_Voice3FreqLo,X
798e ca DEX
798f 10 f7 BPL $7988
7991 a9 21 LDA #$21
7993 85 d9 STA SFXTimer_DiamondQuotaReachedOrEntryBoxExplode
SoundFX_DiamondQuotaReachedOrEntryBoxExplode_InProgress:7995 c6 d9 DEC SFXTimer_DiamondQuotaReachedOrEntryBoxExplode
7997 d0 07 BNE $79a0 ; The target of this branch may as well be $79d2
SoundFX_DiamondQuotaReachedOrEntryBoxExplode_Stop:7999 a9 00 LDA #$00
799b 85 d8 STA SFXTrigger_DiamondQuotaReachedOrEntryBoxExplode
799d 20 e7 7c JSR ResetVoice3
79a0 a5 d9 LDA SFXTimer_DiamondQuotaReachedOrEntryBoxExplode
79a2 d0 2e BNE $79d2
79a4 a5 94 LDA EnableSomeSFXAndMarqueeUpdates ; Note that not all SFX use this enable flag
79a6 f0 21 BEQ SoundFX_MagiWall_Check
SoundFX_Amoeba_Check:79a8 a5 43 LDA AmoebaIsGrowing
79aa f0 1d BEQ SoundFX_MagiWall_Check
SoundFX_Amoeba_Tick:79ac a9 10 LDA #$10
79ae 8d 12 d4 STA Sid_Voice3Ctrl
79b1 20 d0 6a JSR TimeBasedRandomNumber
79b4 29 1f AND #$1f
79b6 c9 08 CMP #$08
79b8 90 f7 BCC $79b1 ; Keep on trying till we get a frequency in range
79ba 8d 0f d4 STA Sid_Voice3FreqHi
79bd a9 30 LDA #$30
79bf 8d 13 d4 STA Sid_Voice3AttackDecay
79c2 a9 11 LDA #$11
79c4 8d 12 d4 STA Sid_Voice3Ctrl
79c7 d0 09 BNE $79d2 ; Branch always taken
SoundFX_MagiWall_Check:79c9 a5 8d LDA MagicWallActiveState
79cb c9 01 CMP #$01
79cd f0 03 BEQ $79d2
79cf 20 e7 7c JSR ResetVoice3
79d2 ee 0f 98 INC $980f
79d5 ad 0f 98 LDA $980f
79d8 2d 78 98 AND $9878
79db d0 55 BNE _NotSureYet_
79dd ad 0d 98 LDA $980d
79e0 29 7f AND #$7f
79e2 f0 29 BEQ $7a0d
79e4 ae 7a 98 LDX $987a
79e7 ca DEX
79e8 8e 04 d4 STX Sid_Voice1Ctrl
79eb e0 80 CPX #$80
79ed d0 05 BNE $79f4
79ef a9 08 LDA #$08
79f1 8d 04 d4 STA Sid_Voice1Ctrl
79f4 a2 06 LDX #$06
79f6 bd 7d 98 LDA Voice1SIDRegsBuffer,X
79f9 9d 76 98 STA $9876,X
79fc 9d 00 d4 STA Sid_Voice1FreqLo,X
79ff ca DEX
7a00 10 f4 BPL $79f6
7a02 ad 0d 98 LDA $980d
7a05 29 80 AND #$80
7a07 8d 0d 98 STA $980d
7a0a 4c 32 7a JMP _NotSureYet_
7a0d 4e 7c 98 LSR $987c
7a10 ad 7c 98 LDA $987c
7a13 29 f0 AND #$f0
7a15 8d 7c 98 STA $987c
7a18 8d 06 d4 STA Sid_Voice1SustainRelease
7a1b f0 0b BEQ $7a28
7a1d c9 04 CMP #$04
7a1f b0 11 BCS _NotSureYet_
7a21 ae 7a 98 LDX $987a
7a24 e0 11 CPX #$11
7a26 d0 0a BNE _NotSureYet_
7a28 a2 08 LDX #$08
7a2a 8e 04 d4 STX Sid_Voice1Ctrl
7a2d a9 00 LDA #$00
7a2f 8d 7c 98 STA $987c
_NotSureYet_:7a32 a5 bd LDA PlayRevealLevelSoundAndRedefineCharFlag
7a34 f0 01 BEQ $7a37
7a36 60 RTS
7a37 ad 11 98 LDA $9811
7a3a f0 03 BEQ $7a3f
7a3c ce 11 98 DEC $9811
7a3f ad 0d 98 LDA $980d
7a42 29 80 AND #$80
7a44 f0 01 BEQ $7a47
7a46 60 RTS
7a47 ad 11 98 LDA $9811
7a4a f0 01 BEQ $7a4d
7a4c 60 RTS
7a4d ad 09 98 LDA $9809
7a50 d0 2d BNE $7a7f
7a52 ac 08 98 LDY $9808
7a55 f0 2c BEQ $7a83
7a57 20 e3 7c JSR ResetVoice2
7a5a 8c 08 d4 STY Sid_Voice2FreqHi
7a5d a9 00 LDA #$00
7a5f 8d 08 98 STA $9808
7a62 a9 c0 LDA #$c0
7a64 8d 0d d4 STA Sid_Voice2SustainRelease
7a67 a9 30 LDA #$30
7a69 8d 0c d4 STA Sid_Voice2AttackDecay
7a6c a9 81 LDA #$81
7a6e 8d 0b d4 STA Sid_Voice2Ctrl
7a71 ad 0a 98 LDA $980a
7a74 c9 02 CMP #$02
7a76 f0 04 BEQ $7a7c
7a78 4a LSR A
7a79 8d 0a 98 STA $980a
7a7c 8d 09 98 STA $9809
7a7f ce 09 98 DEC $9809
7a82 60 RTS
7a83 4c e3 7c JMP ResetVoice2
;
RedefineMagicWallCharsToNormalWall:7a86 a2 07 LDX #$07
7a88 bd 70 32 LDA CopiedGameCharData+$170,X
7a8b 9d 10 31 STA CopiedGameCharData+$10,X
7a8e 9d 18 31 STA CopiedGameCharData+$18,X
7a91 9d 90 31 STA CopiedGameCharData+$90,X
7a94 9d 98 31 STA CopiedGameCharData+$98,X
7a97 ca DEX
7a98 10 ee BPL $7a88
7a9a 60 RTS
MagicWallFX:7a9b a5 c2 LDA AnotherFrameCounter
7a9d 29 01 AND #$01
7a9f f0 21 BEQ MagicWallFX__Animate
MagicWallFX__Sound:7aa1 a9 10 LDA #$10
7aa3 8d 12 d4 STA Sid_Voice3Ctrl
7aa6 20 d0 6a JSR TimeBasedRandomNumber
7aa9 29 03 AND #$03
7aab 0a ASL A
7aac 0a ASL A
7aad 0a ASL A
7aae 69 86 ADC #$86
7ab0 8d 0f d4 STA Sid_Voice3FreqHi
7ab3 a9 00 LDA #$00
7ab5 8d 13 d4 STA Sid_Voice3AttackDecay
7ab8 a9 a0 LDA #$a0
7aba 8d 14 d4 STA Sid_Voice3SustainRelease
7abd a9 11 LDA #$11
7abf 8d 12 d4 STA Sid_Voice3Ctrl
MagicWallFX__Animate:7ac2 a5 c0 LDA AnimationFrameTimes8
7ac4 29 1f AND #$1f
; A = 0 to 24 in multiples of 8.
7ac6 aa TAX
7ac7 a0 00 LDY #$00
MagicWallFX__AnimateLoop:7ac9 bd 60 33 LDA CopiedGameCharData+$260,X
7acc 99 10 31 STA CopiedGameCharData+$10,Y
7acf 99 18 31 STA CopiedGameCharData+$18,Y
7ad2 99 90 31 STA CopiedGameCharData+$90,Y
7ad5 99 98 31 STA CopiedGameCharData+$98,Y
7ad8 e8 INX
7ad9 c8 INY
7ada c0 08 CPY #$08
7adc d0 eb BNE MagicWallFX__AnimateLoop
7ade 60 RTS
HandleMagicWall:7adf a5 8d LDA MagicWallActiveState
7ae1 c9 01 CMP #$01
7ae3 d0 03 BNE $7ae8
7ae5 4c 9b 7a JMP MagicWallFX
7ae8 c9 02 CMP #$02
7aea d0 0a BNE $7af6
7aec 20 86 7a JSR RedefineMagicWallCharsToNormalWall
7aef 20 e7 7c JSR ResetVoice3
7af2 a9 03 LDA #$03
7af4 85 8d STA MagicWallActiveState
7af6 60 RTS
Animate:; Move to the next frame in animations.
; There are 8 frames in each animatiom and each
; character has 8 lines. So .AnimationFrameLineOffset
; is a multiple of 8 from 0 to 56.
7af7 a5 c0 LDA AnimationFrameTimes8
7af9 18 CLC
7afa 69 08 ADC #$08
7afc 29 3f AND #$3f
7afe 85 c0 STA AnimationFrameTimes8
7b00 20 c9 78 JSR AnimateGameCharsAndHandleTopLineSwitch
7b03 20 df 7a JSR HandleMagicWall
7b06 60 RTS
HandleMagicWallState:; FWI: .MagicWallActiveState:
; 0 inactive. 1 active. 2 finished (signal to restore chars & kill sfx).
; 3 done and chars restored.
7b07 a5 9b LDA SecondsDontPass
7b09 49 01 EOR #$01
7b0b 25 8d AND MagicWallActiveState
7b0d c9 01 CMP #$01
7b0f d0 19 BNE $7b2a
; We get here when state is 1 OR 3. I think the OR is a mistake.
; The error has no ramifications unless .MagicWallActiveSeconds wraps.
7b11 e6 8e INC MagicWallActiveFrameCounter
7b13 a5 8e LDA MagicWallActiveFrameCounter
7b15 c9 3c CMP #$3c
7b17 d0 11 BNE $7b2a
7b19 a9 00 LDA #$00
7b1b 85 8e STA MagicWallActiveFrameCounter
7b1d e6 8f INC MagicWallActiveSeconds
7b1f a5 8f LDA MagicWallActiveSeconds
7b21 cd 01 24 CMP BufferedLevel_MagicWallMillingTimeOrAmoeba3PercentMax
7b24 d0 04 BNE $7b2a
7b26 a9 02 LDA #$02
7b28 85 8d STA MagicWallActiveState
7b2a 60 RTS
GameIRQActions:7b2b a5 a7 LDA RastIntIsInMarquee
7b2d f0 01 BEQ __GameIRQActions__InBody
7b2f 60 RTS
__GameIRQActions__InBody:7b30 20 58 79 JSR WhiteFlash
7b33 20 a9 77 JSR PlayRevealLevelSoundAndRedefineChar
7b36 20 07 7b JSR HandleMagicWallState
7b39 20 11 71 JSR SubSecondTick
7b3c 20 71 79 JSR SoundFX
7b3f e6 c2 INC AnotherFrameCounter
7b41 20 ad 76 JSR Scroller
7b44 a5 c2 LDA AnotherFrameCounter
7b46 29 01 AND #$01
7b48 d0 0b BNE __GameIRQActions__CopyInflatedCaveToBackBuffer
__GameIRQActions__FlipBuffers:7b4a ad 07 98 LDA BackBufferVICMemControl
7b4d 85 58 STA RastInt_vic_memory_control
7b4f 49 80 EOR #$80
7b51 8d 07 98 STA BackBufferVICMemControl
7b54 60 RTS
__GameIRQActions__CopyInflatedCaveToBackBuffer:7b55 4c 00 9e JMP MOVEDCopyInflatedCaveSubsetToBackBuffer
; Code moved to $9e00 and executed there. Is self-modifying!
; $7b58-$7d57 is moved to $9e00-$9fff. More code than needed is moved.
; The routine occupies $7b58-$7c90.
CopyInflatedCaveSubsetToBackBuffer:7b58 a5 d6 LDA InflatedCaveSubset
7b5a 18 CLC
7b5b 69 20 ADC #$20
7b5d 8d 51 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$51
; Patched byte corresponds to $7ba9.
7b60 a5 d7 LDA InflatedCaveSubset+1
7b62 69 03 ADC #$03
7b64 8d 52 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$52
; Patched byte corresponds to $7baa.
7b67 ad 07 98 LDA BackBufferVICMemControl
7b6a 4a LSR A
7b6b 4a LSR A
7b6c 49 03 EOR #$03
7b6e 18 CLC
7b6f 69 01 ADC #$01
7b71 8d 55 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$55
; Patched byte corresponds to $7bad.
7b74 a9 b8 LDA #$b8
7b76 8d 54 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$54
; Patched byte corresponds to $7bac.
;
; Now clone the patch (with adjustment) for the next 13 entries.
7b79 a2 00 LDX #$00
7b7b bd 51 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$51,X
7b7e 18 CLC
7b7f 69 50 ADC #$50
7b81 9d 57 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$57,X
7b84 bd 52 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$52,X
7b87 69 00 ADC #$00
7b89 9d 58 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$58,X
7b8c bd 54 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$54,X
7b8f 18 CLC
7b90 69 28 ADC #$28
7b92 9d 5a 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$5a,X
7b95 bd 55 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$55,X
7b98 69 00 ADC #$00
7b9a 9d 5b 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$5b,X
7b9d 8a TXA
7b9e 18 CLC
7b9f 69 06 ADC #$06
7ba1 aa TAX
7ba2 e0 4e CPX #$4e
7ba4 90 d5 BCC $7b7b
; Now move the lower 14 lines of the subset to the lower 14 lines
; of the screen back-buffer.
7ba6 a2 27 LDX #$27
7ba8 bd 00 50 LDA TitleCharData,X
7bab 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7bae bd 00 50 LDA TitleCharData,X
7bb1 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7bb4 bd 00 50 LDA TitleCharData,X
7bb7 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7bba bd 00 50 LDA TitleCharData,X
7bbd 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7bc0 bd 00 50 LDA TitleCharData,X
7bc3 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7bc6 bd 00 50 LDA TitleCharData,X
7bc9 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7bcc bd 00 50 LDA TitleCharData,X
7bcf 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7bd2 bd 00 50 LDA TitleCharData,X
7bd5 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7bd8 bd 00 50 LDA TitleCharData,X
7bdb 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7bde bd 00 50 LDA TitleCharData,X
7be1 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7be4 bd 00 50 LDA TitleCharData,X
7be7 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7bea bd 00 50 LDA TitleCharData,X
7bed 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7bf0 bd 00 50 LDA TitleCharData,X
7bf3 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7bf6 bd 00 50 LDA TitleCharData,X
7bf9 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7bfc ca DEX
7bfd 10 a9 BPL $7ba8
;
7bff ad 07 98 LDA BackBufferVICMemControl
7c02 4a LSR A
7c03 4a LSR A
7c04 49 03 EOR #$03
7c06 8d f4 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f4
; Patched byte corresponds to $9ef4
7c09 a9 28 LDA #$28
7c0b 8d f3 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f3
; Patched byte corresponds to $9ef3
7c0e a5 d6 LDA InflatedCaveSubset
7c10 8d f0 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f0
; Patched byte corresponds to $9ef0
7c13 a5 d7 LDA InflatedCaveSubset+1
7c15 8d f1 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f1
; Patched byte corresponds to $9ef1
;
; Now clone the patch (with adjustment) for the next 9 entries.
7c18 a2 00 LDX #$00
7c1a bd f0 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f0,X
7c1d 18 CLC
7c1e 69 50 ADC #$50
7c20 9d f6 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f6,X
7c23 bd f1 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f1,X
7c26 69 00 ADC #$00
7c28 9d f7 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f7,X
7c2b bd f3 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f3,X
7c2e 18 CLC
7c2f 69 28 ADC #$28
7c31 9d f9 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f9,X
7c34 bd f4 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f4,X
7c37 69 00 ADC #$00
7c39 9d fa 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$fa,X
7c3c 8a TXA
7c3d 18 CLC
7c3e 69 06 ADC #$06
7c40 aa TAX
7c41 e0 36 CPX #$36
7c43 90 d5 BCC $7c1a
; Now move the upper 10 lines of the subset to the upper 10 lines
; of the screen back-buffer ***NOT*** including the top line.
7c45 a2 27 LDX #$27
7c47 bd 00 50 LDA TitleCharData,X
7c4a 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7c4d bd 00 50 LDA TitleCharData,X
7c50 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7c53 bd 00 50 LDA TitleCharData,X
7c56 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7c59 bd 00 50 LDA TitleCharData,X
7c5c 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7c5f bd 00 50 LDA TitleCharData,X
7c62 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7c65 bd 00 50 LDA TitleCharData,X
7c68 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7c6b bd 00 50 LDA TitleCharData,X
7c6e 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7c71 bd 00 50 LDA TitleCharData,X
7c74 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7c77 bd 00 50 LDA TitleCharData,X
7c7a 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7c7d bd 00 50 LDA TitleCharData,X
7c80 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
7c83 ca DEX
7c84 10 c1 BPL $7c47
7c86 20 f7 7a JSR Animate
7c89 a5 a8 LDA ExtraLifeFXCounter
7c8b f0 03 BEQ $7c90
7c8d 20 54 74 JSR ExtraLifeFX
7c90 60 RTS
;
InstallRandomCaveObjectForCell:7c91 a2 01 LDX #$01
7c93 20 ed 6c JSR PseudoRandom
7c96 a0 00 LDY #$00
_RandomObjTestLoop:7c98 d9 1c 24 CMP BufferedLevel_ProbabilityOfObject1,Y
7c9b b0 03 BCS _NotThisRandomObject
; BufferedLevel_ProbabilityOfObject1 > AF
7c9d be 18 24 LDX BufferedLevel_RandomObjectNumber1,Y
_NotThisRandomObject:7ca0 c8 INY
7ca1 c0 04 CPY #$04
7ca3 d0 f3 BNE _RandomObjTestLoop
7ca5 8a TXA
7ca6 a0 29 LDY #$29
7ca8 91 32 STA (CaveCurrentCellPtr),Y
7caa 60 RTS
;
FillWithDirtAndRandomObjects:7cab a9 01 LDA #$01
7cad 85 92 STA CaveMatrixY
7caf 20 cd 76 JSR ResetCaveCurrentCellPtr
FillWithDirtAndRandomObjects__NextRow:7cb2 a9 00 LDA #$00
7cb4 85 91 STA CaveMatrixX
FillWithDirtAndRandomObjects__NextColumn:7cb6 20 91 7c JSR InstallRandomCaveObjectForCell
7cb9 20 c6 76 JSR AdvanceCaveCurrentCellPtr
7cbc e6 91 INC CaveMatrixX
7cbe a5 91 LDA CaveMatrixX
7cc0 c9 28 CMP #$28
7cc2 d0 f2 BNE FillWithDirtAndRandomObjects__NextColumn
7cc4 e6 92 INC CaveMatrixY
7cc6 a5 92 LDA CaveMatrixY
7cc8 c9 16 CMP #$16
7cca d0 e6 BNE FillWithDirtAndRandomObjects__NextRow
7ccc 60 RTS
;
GameSpeedsForSublevelsArray:7ccd 0c 06 03 01 00
CaveRowTransitionDelay:7cd2 a4 9c LDY MatrixRowTransitionDelay
7cd4 f0 08 BEQ $7cde
7cd6 a2 10 LDX #$10
7cd8 ca DEX
7cd9 d0 fd BNE $7cd8
7cdb 88 DEY
7cdc d0 f8 BNE $7cd6
7cde 60 RTS
ResetVoice1:7cdf a2 04 LDX #$04
; .Sid_Voice1Ctrl
7ce1 d0 06 BNE $7ce9
ResetVoice2:7ce3 a2 0b LDX #$0b
; .Sid_Voice2Ctrl
7ce5 d0 02 BNE $7ce9
ResetVoice3:7ce7 a2 12 LDX #$12
; .Sid_Voice3Ctrl
7ce9 a9 08 LDA #$08
7ceb 9d 00 d4 STA Sid_Voice1FreqLo,X
7cee a9 00 LDA #$00
7cf0 9d 00 d4 STA Sid_Voice1FreqLo,X
; .Sid_VoiceXCtrl
; 7 Select Random Noise Waveform, 1 = On
; 6 Select Pulse Waveform, 1 = On
; 5 Select Sawtooth Waveform, 1 = On
; 4 Select Triangle Waveform, 1 = On
; 3 Test Bit: 1 = Disable Oscillator
; 2 Ring Modulate Osc. X with Osc. X-1 Output, 1 = On
; 1 Synchronize Osc. X with Osc. X-1 Frequency, 1 = On
; 0 Gate Bit: 1 = Start Att/Dec/Sus, 0 = Start Release
7cf3 60 RTS
ResetSound:7cf4 20 df 7c JSR ResetVoice1
7cf7 20 e3 7c JSR ResetVoice2
7cfa 20 e7 7c JSR ResetVoice3
7cfd a9 4f LDA #$4f
7cff 8d 18 d4 STA Sid_FilterModeAndVolume
; .Sid_FilterModeAndVolume
; Select Filter Mode and Volume
; 7 Cut-Off Voice 3 Output: 1 = Off, 0 = On
; 6 Select Filter High-Pass Mode: 1 = On
; 5 Select Filter Band-Pass Mode: 1 = On
; 4 Select Filter Low-Pass Mode: 1 = On
; 3-0 Select Output Volume: 0-15
7d02 60 RTS
Delay:FourDelays:
7d0c 20 03 7d JSR Delay
7d0f 20 03 7d JSR Delay
7d12 20 03 7d JSR Delay
7d15 20 03 7d JSR Delay
7d18 60 RTS
;
DelaySpaceKeyAborts:7d19 a0 90 LDY #$90
7d1b a2 00 LDX #$00
7d1d a5 fc LDA LastKeyInScanRow7_ScannedMoreThanOnce
7d1f c9 ef CMP #$ef
7d21 d0 01 BNE $7d24
7d23 60 RTS
7d24 ca DEX
7d25 d0 f6 BNE $7d1d
7d27 88 DEY
7d28 d0 f1 BNE $7d1b
7d2a 60 RTS
; While paused we spin in this function until we're unpaused.
PauseLoop:7d2b 20 04 6b JSR BackupTopLine
7d2e a9 58 LDA #<Text__SpaceBarToResume
7d30 85 46 STA LocalVar
7d32 a9 6c LDA #>Text__SpaceBarToResume
7d34 85 47 STA LocalVar+1
7d36 20 16 6b JSR SetTopLineText
7d39 a5 9b LDA SecondsDontPass
7d3b c9 01 CMP #$01
7d3d d0 07 BNE $7d46
7d3f e6 9b INC SecondsDontPass
7d41 20 03 7d JSR Delay
7d44 85 fc STA LastKeyInScanRow7_ScannedMoreThanOnce
7d46 20 19 7d JSR DelaySpaceKeyAborts
7d49 a9 62 LDA #<TopLineBackup
7d4b 85 46 STA LocalVar
7d4d a9 98 LDA #>TopLineBackup
7d4f 85 47 STA LocalVar+1
7d51 20 16 6b JSR SetTopLineText
7d54 20 19 7d JSR DelaySpaceKeyAborts
7d57 20 19 7d JSR DelaySpaceKeyAborts
7d5a 20 19 7d JSR DelaySpaceKeyAborts
7d5d a5 fc LDA LastKeyInScanRow7_ScannedMoreThanOnce
7d5f c9 ef CMP #$ef
7d61 d0 c8 BNE PauseLoop
7d63 20 03 7d JSR Delay
7d66 a9 00 LDA #$00
7d68 85 fc STA LastKeyInScanRow7_ScannedMoreThanOnce
7d6a 60 RTS
;
HandleInGameKeys:7d6b a5 fc LDA LastKeyInScanRow7_ScannedMoreThanOnce
7d6d c9 ef CMP #$ef
7d6f d0 12 BNE $7d83
; Pause game.
__HandleInGameKeys__SpacePressed:7d71 a2 00 LDX #$00
7d73 86 94 STX EnableSomeSFXAndMarqueeUpdates
7d75 20 f4 7c JSR ResetSound
7d78 e6 9b INC SecondsDontPass
7d7a 20 2b 7d JSR PauseLoop
7d7d a9 00 LDA #$00
7d7f 85 9b STA SecondsDontPass
7d81 e6 94 INC EnableSomeSFXAndMarqueeUpdates
7d83 a5 fc LDA LastKeyInScanRow7_ScannedMoreThanOnce
7d85 c9 7f CMP #$7f
7d87 d0 0c BNE $7d95
; Suicide.
__HandleInGameKeys__RunStopPressed:7d89 a5 95 LDA FlashingEntryBoxCountDown
7d8b d0 08 BNE $7d95
7d8d a9 00 LDA #$00
7d8f 85 94 STA EnableSomeSFXAndMarqueeUpdates
7d91 a9 02 LDA #$02
7d93 85 97 STA ExitCaveFlag
7d95 a9 00 LDA #$00
7d97 85 fc STA LastKeyInScanRow7_ScannedMoreThanOnce
7d99 a5 fb LDA LastKeyInScanRow0_ScannedMoreThanOnce
7d9b c9 ef CMP #$ef
7d9d d0 03 BNE $7da2
; Back to title screen.
__HandleInGameKeys_F1Pressed:7d9f 4c b3 8a JMP Main
7da2 60 RTS
; Remember that this runs before the tick so 'ThisTick' refers to the previous one.
;
; In C++ the function looks like this:
;
; if (!AmeobaCouldGrowThisTick && AmoebaIsGrowing)
; {
; AmeobaCouldGrowLastTick = false;
; }
;
; AmoebaIsGrowing = AmeobaCouldGrowThisTick
;
; AmeobaCouldGrowThisTick = false;
; AmoebaCellCountPreviousTick = AmoebaCellCountThisTick;
; AmoebaCellCountThisTick = 0;
PreTickAmoebaProcessing:7da3 a5 42 LDA AmeobaCouldGrowThisTick
7da5 d0 08 BNE $7daf
7da7 a5 43 LDA AmoebaIsGrowing
7da9 f0 04 BEQ $7daf
7dab a9 00 LDA #$00
7dad 85 8c STA AmeobaCouldGrowLastTick
7daf a5 42 LDA AmeobaCouldGrowThisTick
7db1 85 43 STA AmoebaIsGrowing
; Reset variables for next frame.
7db3 a9 00 LDA #$00
7db5 85 42 STA AmeobaCouldGrowThisTick
7db7 ad 02 98 LDA AmoebaCellCountThisTick
7dba 8d 03 98 STA AmoebaCellCountPreviousTick
7dbd a9 00 LDA #$00
7dbf 8d 02 98 STA AmoebaCellCountThisTick
7dc2 60 RTS
; After Rockford has been dead for 16 ticks pressing fire continues.
DeathClick:7dc3 20 69 6b JSR ReadFireButtonCurrentPlayer
7dc6 a5 96 LDA RockfordDeadTicks
7dc8 c9 10 CMP #$10
7dca d0 0c BNE $7dd8
7dcc a5 b8 LDA FireButtonStatus
7dce d0 08 BNE $7dd8
7dd0 a5 af LDA TimeCaveHasRan
7dd2 f0 04 BEQ $7dd8
7dd4 a9 02 LDA #$02
7dd6 85 97 STA ExitCaveFlag
7dd8 60 RTS
;
ProcessCave:7dd9 a9 16 LDA #$16
7ddb 85 02 STA __CoverLevel__LineAddressTable
7ddd a5 5d LDA Cave
7ddf c9 11 CMP #$11
7de1 90 04 BCC __ProcessCave__NotBonusCave
__ProcessCave__BonusCave:7de3 a9 0f LDA #$0f
7de5 85 02 STA __CoverLevel__LineAddressTable
__ProcessCave__NotBonusCave:7de7 a9 01 LDA #$01
7de9 85 92 STA CaveMatrixY
7deb 20 cd 76 JSR ResetCaveCurrentCellPtr
7dee a9 10 LDA #$10
7df0 c5 96 CMP RockfordDeadTicks
7df2 f0 02 BEQ $7df6
7df4 e6 96 INC RockfordDeadTicks
7df6 20 c3 7d JSR DeathClick
7df9 20 a3 7d JSR PreTickAmoebaProcessing
__ProcessCave__NewRow:7dfc a9 00 LDA #$00
7dfe 85 91 STA CaveMatrixX
__ProcessCave__ProcessCurrentCell:7e00 a0 29 LDY #$29
7e02 b1 32 LDA (CaveCurrentCellPtr),Y
7e04 0a ASL A
7e05 aa TAX
7e06 bd 69 5f LDA ObjHandlerVectorTable+1,X
7e09 f0 0a BEQ __ProcessCave__NoObjectHandler
__ProcessCave__ObjectHandler:7e0b 85 39 STA ObjHandlerVector+1
7e0d bd 68 5f LDA ObjHandlerVectorTable,X
7e10 85 38 STA ObjHandlerVector
7e12 6c 38 00 JMP (ObjHandlerVector)
__ProcessCave__NoObjectHandler:7e15 a0 00 LDY #$00
7e17 b1 32 LDA (CaveCurrentCellPtr),Y
7e19 aa TAX
7e1a bd e8 5e LDA ObjCodeFromScannedThisTickCodeTable,X
7e1d f0 02 BEQ __ProcessCave__NextCell
__ProcessCave__TurnTrailerToBaseType:7e1f 91 32 STA (CaveCurrentCellPtr),Y
__ProcessCave__NextCell:7e21 e6 32 INC CaveCurrentCellPtr
7e23 d0 02 BNE __ProcessCave__IncX
__ProcessCave__BumpUpCellPtrHigh:7e25 e6 33 INC CaveCurrentCellPtr+1
__ProcessCave__IncX:7e27 e6 91 INC CaveMatrixX
7e29 a5 91 LDA CaveMatrixX
7e2b c9 28 CMP #$28
7e2d d0 d1 BNE __ProcessCave__ProcessCurrentCell
__ProcessCave__NextRow:7e2f 20 d2 7c JSR CaveRowTransitionDelay
7e32 e6 92 INC CaveMatrixY
7e34 a5 92 LDA CaveMatrixY
7e36 c5 02 CMP __CoverLevel__LineAddressTable
7e38 d0 c2 BNE __ProcessCave__NewRow
7e3a 20 6b 7d JSR HandleInGameKeys
7e3d 60 RTS
_NumTo3DigitDigits__Data_:7e3e 00 00 01
NumTo3DigitDigits:7e41 a2 02 LDX #$02
7e43 a9 00 LDA #$00
NumTo3DigitDigits__ZeroDigit:7e45 95 c3 STA NumTo3DigitDigits__Result,X
7e47 ca DEX
7e48 10 fb BPL NumTo3DigitDigits__ZeroDigit
NumTo3DigitDigits__CheckForTrivialCase:7e4a a5 c6 LDA NumTo3DigitDigits__NumberToConvert
7e4c f0 17 BEQ NumTo3DigitDigits__Exit
NumTo3DigitDigits__NonTrivialCase:7e4e a2 02 LDX #$02
7e50 18 CLC
NumTo3DigitDigits__IncrementResultLoop:7e51 b5 c3 LDA NumTo3DigitDigits__Result,X
7e53 7d 3e 7e ADC _NumTo3DigitDigits__Data_,X
7e56 c9 0a CMP #$0a
7e58 90 02 BCC $7e5c
7e5a e9 0a SBC #$0a
7e5c 95 c3 STA NumTo3DigitDigits__Result,X
7e5e ca DEX
7e5f 10 f0 BPL NumTo3DigitDigits__IncrementResultLoop
NumTo3DigitDigits__CheckIfDone:7e61 c6 c6 DEC NumTo3DigitDigits__NumberToConvert
7e63 d0 e9 BNE NumTo3DigitDigits__NonTrivialCase
NumTo3DigitDigits__Exit:7e65 60 RTS
; 0: Next level
; 1: Is bonus cave
LevelSequenceAndBonusLevelStatusArray:7e66 02 00 03 00 04 00 11 00 06 00 07 00 08 00 12 00
7e76 0a 00 0b 00 0c 00 13 00 0e 00 0f 00 10 00 14 00
7e86 05 01 09 01 0d 01 15 01
;
BufferLevel:7e8e a5 5d LDA Cave
7e90 c5 99 CMP UnpackedCaveNumber
7e92 f0 24 BEQ __BufferLevel__InitRandomSeedAndColours
__BufferLevel__DoBuffer:7e94 85 99 STA UnpackedCaveNumber
7e96 0a ASL A
7e97 aa TAX
7e98 bd 65 7e LDA LevelSequenceAndBonusLevelStatusArray-1,X
7e9b 85 a6 STA IsBonusLevelFlag
7e9d 18 CLC
7e9e a9 2e LDA #<CaveAData
7ea0 7d 04 58 ADC LevelOffsetArray-2,X
7ea3 85 3c STA CurrentLevelDataPtr
7ea5 a9 58 LDA #>CaveAData
7ea7 7d 05 58 ADC LevelOffsetArray-1,X
7eaa 85 3d STA CurrentLevelDataPtr+1
7eac a0 00 LDY #$00
__BufferLevel__CopyElement:7eae b1 3c LDA (CurrentLevelDataPtr),Y
7eb0 99 00 24 STA BufferedLevel_CaveNumber,Y
7eb3 c8 INY
7eb4 c0 f0 CPY #$f0
7eb6 d0 f6 BNE __BufferLevel__CopyElement
__BufferLevel__InitRandomSeedAndColours:7eb8 a6 5e LDX Level
7eba bd 04 24 LDA BufferedLevel_InitialRandomSeedForSublevel1,X
7ebd 85 3e STA RandSeed2
7ebf 85 40 STA OrgRandSeed2_UNUSED_
7ec1 a9 00 LDA #$00
7ec3 85 3f STA RandSeed1
7ec5 85 41 STA OrgRandSeed1_UNUSED_
7ec7 ad 13 24 LDA BufferedLevel_BackgroundColour1
7eca 8d 22 d0 STA Vic_BkgndColour1
7ecd ad 14 24 LDA BufferedLevel_BackgroundColour2
7ed0 8d 23 d0 STA Vic_BkgndColour2
7ed3 a0 28 LDY #$28
7ed5 ad 15 24 LDA BufferedLevel_ForegroundColour
7ed8 20 e3 6a JSR SetupColourRam
7edb 60 RTS
; $
InitGameVariablesFromLevelData:7edc a9 00 LDA #$00
7ede 85 42 STA AmeobaCouldGrowThisTick
7ee0 85 43 STA AmoebaIsGrowing
7ee2 85 96 STA RockfordDeadTicks
7ee4 85 97 STA ExitCaveFlag
7ee6 85 8d STA MagicWallActiveState
7ee8 85 8e STA MagicWallActiveFrameCounter
7eea 85 8f STA MagicWallActiveSeconds
7eec 85 90 STA LevelCompleteFlag
7eee 8d 02 98 STA AmoebaCellCountThisTick
7ef1 85 af STA TimeCaveHasRan
7ef3 85 ae STA SubSecondCounter
7ef5 85 9f STA EnteredOutboxFlag
7ef7 85 9b STA SecondsDontPass
7ef9 8d 78 98 STA $9878
7efc 20 86 7a JSR RedefineMagicWallCharsToNormalWall
7eff a6 5e LDX Level
7f01 bd cd 7c LDA GameSpeedsForSublevelsArray,X
7f04 85 9c STA MatrixRowTransitionDelay
; Set cave time limit.
7f06 bd 0e 24 LDA BufferedLevel_CaveTimeForSublevel1,X
7f09 85 c7 STA CaveTimeLimit
7f0b 85 c6 STA NumTo3DigitDigits__NumberToConvert
7f0d 20 41 7e JSR NumTo3DigitDigits
7f10 a2 02 LDX #$02
7f12 b5 c3 LDA NumTo3DigitDigits__Result,X
7f14 95 ab STA TimeLeft,X
7f16 09 10 ORA #$10
7f18 9d 44 98 STA TimeLeftText,X
7f1b ca DEX
7f1c 10 f4 BPL $7f12
; Set cave diamond quota.
7f1e a6 5e LDX Level
7f20 bd 09 24 LDA BufferedLevel_DiamondsNeededForSublevel1,X
7f23 85 c6 STA NumTo3DigitDigits__NumberToConvert
7f25 20 41 7e JSR NumTo3DigitDigits
7f28 a2 01 LDX #$01
7f2a b5 c4 LDA NumTo3DigitDigits__Result+1,X
7f2c 95 b2 STA DiamondQuotaDigits,X
7f2e ca DEX
7f2f 10 f9 BPL $7f2a
; Set cave diamond diamond values.
7f31 20 44 71 JSR DiamondQuotaDigitsToString
7f34 ad 02 24 LDA BufferedLevel_InitialDiamondValue
7f37 85 c6 STA NumTo3DigitDigits__NumberToConvert
7f39 20 41 7e JSR NumTo3DigitDigits
7f3c a2 02 LDX #$02
7f3e b5 c3 LDA NumTo3DigitDigits__Result,X
7f40 95 51 STA ScoreIncrementDigits+3,X
7f42 ca DEX
7f43 10 f9 BPL $7f3e
7f45 ad 03 24 LDA BufferedLevel_ExtraDiamondValue
7f48 85 c6 STA NumTo3DigitDigits__NumberToConvert
7f4a 20 41 7e JSR NumTo3DigitDigits
7f4d a2 02 LDX #$02
7f4f b5 c3 LDA NumTo3DigitDigits__Result,X
7f51 95 b4 STA ExtraDiamondValue,X
7f53 ca DEX
7f54 10 f9 BPL $7f4f
7f56 20 51 71 JSR ScoreIncrementToString
; Reset diamond count.
7f59 a9 00 LDA #$00
7f5b 85 b0 STA DiamondCountDigits
7f5d 85 b1 STA DiamondCountDigits+1
7f5f 09 10 ORA #$10
7f61 8d 41 98 STA $9841
7f64 8d 42 98 STA $9842
;
7f67 a9 01 LDA #$01
7f69 85 8c STA AmeobaCouldGrowLastTick
7f6b 85 93 STA FlashingEntryBoxFlag
7f6d a9 04 LDA #$04
7f6f 85 95 STA FlashingEntryBoxCountDown
7f71 a5 9f LDA EnteredOutboxFlag
7f73 d0 0c BNE __InitGameVariablesFromLevelData__NotTwoJoysticksOnePlayer
7f75 a5 a4 LDA NumJoysticksMinusOne
7f77 49 01 EOR #$01
7f79 25 9e AND NumPlayerMinusOne
7f7b f0 04 BEQ __InitGameVariablesFromLevelData__NotTwoJoysticksOnePlayer
__InitGameVariablesFromLevelData__TwoJoysticksOnePlayer:; If we've got two players using a single joystick give them a bit more time.
7f7d a9 06 LDA #$06
7f7f 85 95 STA FlashingEntryBoxCountDown
__InitGameVariablesFromLevelData__NotTwoJoysticksOnePlayer:7f81 a5 5d LDA Cave
7f83 c9 02 CMP #$02
7f85 d0 02 BNE __InitGameVariablesFromLevelData__NotCaveB
__InitGameVariablesFromLevelData__CaveB:; Cave B gets a tad more time.
7f87 e6 95 INC FlashingEntryBoxCountDown
__InitGameVariablesFromLevelData__NotCaveB:7f89 a9 7f LDA #$7f
7f8b 85 9a STA AmoebaGrowthProbabilityMask
7f8d a9 07 LDA #$07
7f8f 85 ff STA AnimationEnableFlags
; Bonus caves have all animations enabled and the rest use .LevelActiveAnimations[].
; Why all the logic for enabling animations are not part of the level data is beyond me.
7f91 a6 5d LDX Cave
7f93 e0 11 CPX #$11
7f95 b0 06 BCS $7f9d
__InitGameVariablesFromLevelData__NotBonusCave:7f97 ca DEX
7f98 bd 79 83 LDA LevelActiveAnimations,X
__InitGameVariablesFromLevelData__BonusCave:;
SetTopLineTextToGameOverAndDelay:7f9e a9 f4 LDA #<Text_GameOver
7fa0 85 46 STA LocalVar
7fa2 a9 6b LDA #>Text_GameOver
7fa4 85 47 STA LocalVar+1
7fa6 20 16 6b JSR SetTopLineText
7fa9 20 0c 7d JSR FourDelays
7fac 60 RTS
;
WaitForDelayOrNextPlayersButton:7fad a0 75 LDY #$75
__WaitForDelayOrNextPlayersButton__OuterDelayLoop:7faf a2 80 LDX #$80
__WaitForDelayOrNextPlayersButton__InnerDelayLoop:7fb1 a5 a6 LDA IsBonusLevelFlag
7fb3 d0 07 BNE __WaitForDelayOrNextPlayersButton__IsBonusLevel
__WaitForDelayOrNextPlayersButton__NotBonusLevel:7fb5 a5 9d LDA CurrentPlayer
7fb7 49 01 EOR #$01
7fb9 4c be 7f JMP __WaitForDelayOrNextPlayersButton__ReadButton
__WaitForDelayOrNextPlayersButton__IsBonusLevel:7fbc a5 9d LDA CurrentPlayer
__WaitForDelayOrNextPlayersButton__ReadButton:7fbe 20 6b 6b JSR ReadFireButtonPlayerInA
7fc1 d0 04 BNE __WaitForDelayOrNextPlayersButton__NotPressed
__WaitForDelayOrNextPlayersButton__Pressed:7fc3 a0 01 LDY #$01
7fc5 a2 01 LDX #$01
__WaitForDelayOrNextPlayersButton__NotPressed:7fc7 ca DEX
7fc8 d0 e7 BNE __WaitForDelayOrNextPlayersButton__InnerDelayLoop
7fca 88 DEY
7fcb d0 e2 BNE __WaitForDelayOrNextPlayersButton__OuterDelayLoop
7fcd 60 RTS
;
OutOfTimeLoop:7fce a9 14 LDA #$14
7fd0 8d 06 98 STA __OutOfTimeLoop__Counter
7fd3 20 04 6b JSR BackupTopLine
7fd6 a9 1c LDA #<Text_OutOfTime
7fd8 85 46 STA LocalVar
7fda a9 6c LDA #>Text_OutOfTime
7fdc 85 47 STA LocalVar+1
7fde 20 16 6b JSR SetTopLineText
7fe1 20 ad 7f JSR WaitForDelayOrNextPlayersButton
; Restore top line text.
7fe4 a9 62 LDA #<TopLineBackup
7fe6 85 46 STA LocalVar
7fe8 a9 98 LDA #>TopLineBackup
7fea 85 47 STA LocalVar+1
7fec 20 16 6b JSR SetTopLineText
7fef 20 ad 7f JSR WaitForDelayOrNextPlayersButton
7ff2 20 ad 7f JSR WaitForDelayOrNextPlayersButton
7ff5 20 ad 7f JSR WaitForDelayOrNextPlayersButton
7ff8 ce 06 98 DEC __OutOfTimeLoop__Counter
7ffb d0 04 BNE $8001
7ffd a9 00 LDA #$00
7fff 85 b8 STA FireButtonStatus
8001 a5 b8 LDA FireButtonStatus
8003 d0 ce BNE $7fd3
8005 60 RTS
;
ProcessBonusLevelAndInterLevelInfoDisplay:8006 a5 5d LDA Cave
8008 0a ASL A
8009 aa TAX
800a bd 65 7e LDA NumTo3DigitDigits__Exit,X
800d 85 a6 STA IsBonusLevelFlag
800f f0 11 BEQ $8022
8011 a9 30 LDA #<Text_BonusLife
8013 85 46 STA LocalVar
8015 a9 6c LDA #>Text_BonusLife
8017 85 47 STA LocalVar+1
8019 20 16 6b JSR SetTopLineText
801c 20 39 70 JSR ExtraLife
801f 4c 2d 80 JMP $802d
8022 a9 4e LDA #<CurrentPlayerInfoText
8024 85 46 STA LocalVar
8026 a9 98 LDA #>CurrentPlayerInfoText
8028 85 47 STA LocalVar+1
802a 20 16 6b JSR SetTopLineText
802d 60 RTS
;
PostCaveRunActions:802e a5 af LDA TimeCaveHasRan
8030 c5 c7 CMP CaveTimeLimit
8032 d0 0c BNE __PostRunCaveActions__CheckIfGameOver
__PostRunCaveActions__TimeLimitReached:8034 a9 00 LDA #$00
8036 85 94 STA EnableSomeSFXAndMarqueeUpdates
; Without this the timer never display 000.
; It sets the first character of the third digit to zero.
; Only the first character need be set because BackupTopLine
; only looks at the first and .SetTopLineText takes a string.
8038 a9 10 LDA #$10
803a 8d 18 0c STA GameTileMap1_or_TitleTextTileMap+$18
803d 20 ce 7f JSR OutOfTimeLoop
__PostRunCaveActions__CheckIfGameOver:8040 a5 a0 LDA GameOverFlag
8042 f0 0e BEQ __PostRunCaveActions__NotGameOver
__PostRunCaveActions__GameOver:8044 a9 00 LDA #$00
8046 85 94 STA EnableSomeSFXAndMarqueeUpdates
8048 20 9e 7f JSR SetTopLineTextToGameOverAndDelay
804b a9 02 LDA #$02
804d 85 8d STA MagicWallActiveState
804f 4c 59 80 JMP $8059
__PostRunCaveActions__NotGameOver:8052 a5 5d LDA Cave
8054 f0 03 BEQ $8059
8056 20 06 80 JSR ProcessBonusLevelAndInterLevelInfoDisplay
; Shut down magic walls.
8059 a9 01 LDA #$01
805b 85 bd STA PlayRevealLevelSoundAndRedefineCharFlag
805d 20 f4 7c JSR ResetSound
8060 20 f9 76 JSR CoverLevel
8063 20 db 76 JSR FillInflatedCaveWithScrollingSteelWallChar
8066 a5 a0 LDA GameOverFlag
8068 f0 03 BEQ $806d
806a 20 0c 7d JSR FourDelays
806d 60 RTS
; For level 1:
; >C:0800 -A)}#w2F/C &z5I.B TU -A)}#w2F/C &z5I.B
; >C:0828 0D2F%y3G%y.B4H3G
; >C:0850 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
; >C:0878 GAAAAAA.AATAP.AAAAAPAPAAAAAAA.AAAAPAAAAG
; >C:08a0 GAP%PAAAAAA.AAAAAAAAAPTAAPAAAA.AAAAA.AAG
; >C:08c8 GAAAAAAAAAA.AA.AAAAAPAPAAPAAAAAAAAPAAAAG
; >C:08f0 GPA..AAAAAAAAAPAAAAAAPAAPAAAAPAAAPAAAAAG
; >C:0918 GPAPPAAAAAAAAAPPAAPAAAAAAAAPAAAAAAPAP.AG
; >C:0940 GAAAPAAPAAAAAAAAPAAAAAPA.PAAAAAAAAPAPPAG
; >C:0968 GBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAAAPAAPAG
; >C:0990 GA.AAAPAATA.AAPAPAAAAAAAAAATAP.AAAAAAPAG
; >C:09b8 GAATAAAAAPAAAAA.AAAAAAAAP..PAATAAAAPAAAG
; >C:09e0 GAAAPAAPAPAAAAAAAAAAAAAAPPAPAAPAAAAAAAAG
; >C:0a08 GA.AAAAAPAAAAAAAAPP.AAAAAAAPAAPATAAAA.AG
; >C:0a30 GAPAA.AAPA..AAAAAPAPTAATAAAAPAAAPAATAPAG
; >C:0a58 GATPAAAAAAAAAAAAAAPPPAAPAAAAAAAATAAAAAPG
; >C:0a80 GAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBG
; >C:0aa8 G..AAAAAAAAA.AAATAAAAPAAAAAPAAAPAAAAAAAG
; >C:0ad0 GP.AAAAAAAAAPPAAPAAAAAAAAPAAAAAAPAP.AADG
; >C:0af8 GAPAAPAAAAAAAAPAAAAAPA..AAAATAAAPAPPAAAG
; >C:0b20 GAAAAPTAA.AAAAAAAAPAAAAAAPAPTAAAAAAPAAAG
; >C:0b48 GAAA.AA.APAAPAPPAAAAAAAAAPAPTAAAAAAPAAPG
; >C:0b70 GATAAAAPAAAAA.AAAAAAAAA.APAAPAAAAPAAAPAG
; >C:0b98 GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
DecompressedLevelRowPointerArray:806e | CaveMatrix_or_TitleLogoTileMap | CaveMatrix_or_TitleLogoTileMap+$28 | CaveMatrix_or_TitleLogoTileMap+$50 | CaveMatrix_or_TitleLogoTileMap+$78 |
8076 | CaveMatrix_or_TitleLogoTileMap+$a0 | CaveMatrix_or_TitleLogoTileMap+$c8 | CaveMatrix_or_TitleLogoTileMap+$f0 | CaveMatrix_or_TitleLogoTileMap+$118 |
807e | CaveMatrix_or_TitleLogoTileMap+$140 | CaveMatrix_or_TitleLogoTileMap+$168 | CaveMatrix_or_TitleLogoTileMap+$190 | CaveMatrix_or_TitleLogoTileMap+$1b8 |
8086 | CaveMatrix_or_TitleLogoTileMap+$1e0 | CaveMatrix_or_TitleLogoTileMap+$208 | CaveMatrix_or_TitleLogoTileMap+$230 | CaveMatrix_or_TitleLogoTileMap+$258 |
808e | CaveMatrix_or_TitleLogoTileMap+$280 | CaveMatrix_or_TitleLogoTileMap+$2a8 | CaveMatrix_or_TitleLogoTileMap+$2d0 | CaveMatrix_or_TitleLogoTileMap+$2f8 |
8096 | CaveMatrix_or_TitleLogoTileMap+$320 | CaveMatrix_or_TitleLogoTileMap+$348 | CaveMatrix_or_TitleLogoTileMap+$370 | CaveMatrix_or_TitleLogoTileMap+$398 |
809e a5 dc LDA ObjParam2DuringUnpack
80a0 0a ASL A
80a1 a8 TAY
80a2 18 CLC
80a3 b9 6e 80 LDA DecompressedLevelRowPointerArray,Y
80a6 65 db ADC ObjParam1DuringUnpack
80a8 85 3a STA ExecuteLevelDrawCommands__OutPtr
80aa b9 6f 80 LDA DecompressedLevelRowPointerArray+1,Y
80ad 69 00 ADC #$00
80af 85 3b STA ExecuteLevelDrawCommands__OutPtr+1
80b1 60 RTS
; .ObjTypeDuringUnpack : object
; .ObjParam1DuringUnpack : x
; .ObjParam2DuringUnpack : y
ExecuteLevelDrawCommands__OutputSingle:80b2 20 9e 80 JSR ExecuteLevelDrawCommands__SetOutputPointer
80b5 a5 da LDA ObjTypeDuringUnpack
80b7 a0 00 LDY #$00
80b9 91 3a STA (ExecuteLevelDrawCommands__OutPtr),Y
80bb 60 RTS
;
ExecuteLevelDrawCommands__DrawLine__StepTable:; $ffd8 = -40 --> N
; $ffd9 = -39 --> NE
; $0001 = +1 --> E
; $0029 = +41 --> SE
; $0028 = +40 --> S
; $0027 = +39 --> SW
; $ffff = -1 --> W
; $ffd7 = -41 --> NW
80bc d8 ff d9 ff 01 00 29 00 28 00 27 00 ff ff d7 ff
; A : direction : 0->N, 1->NE, 2->E, 3->SE, 4->S, 5->SW, 6->W, 7->NW
; .ExecuteLevelDrawCommands::LineLength: length
ExecuteLevelDrawCommands__DrawLine:80cc a0 00 LDY #$00
80ce 0a ASL A
80cf aa TAX
80d0 bd bc 80 LDA ExecuteLevelDrawCommands__DrawLine__StepTable,X
80d3 85 c9 STA CaveLineStepValue
80d5 bd bd 80 LDA ExecuteLevelDrawCommands__DrawLine__StepTable+1,X
80d8 85 ca STA CaveLineStepValue+1
__ExecuteLevelDrawCommands__DrawLine__Next:80da c6 c8 DEC ExecuteLevelDrawCommands__LineLength
80dc 30 14 BMI __ExecuteLevelDrawCommands__DrawLine__Finished
80de a5 da LDA ObjTypeDuringUnpack
80e0 91 3a STA (ExecuteLevelDrawCommands__OutPtr),Y
80e2 18 CLC
80e3 a5 3a LDA ExecuteLevelDrawCommands__OutPtr
80e5 65 c9 ADC CaveLineStepValue
80e7 85 3a STA ExecuteLevelDrawCommands__OutPtr
80e9 a5 3b LDA ExecuteLevelDrawCommands__OutPtr+1
80eb 65 ca ADC CaveLineStepValue+1
80ed 85 3b STA ExecuteLevelDrawCommands__OutPtr+1
80ef 4c da 80 JMP __ExecuteLevelDrawCommands__DrawLine__Next
__ExecuteLevelDrawCommands__DrawLine__Finished:80f2 60 RTS
;
ExecuteLevelDrawCommands__OutputLine:80f3 20 9e 80 JSR ExecuteLevelDrawCommands__SetOutputPointer
80f6 a5 dd LDA ObjParam3DuringUnpack
80f8 85 c8 STA ExecuteLevelDrawCommands__LineLength
80fa a5 df LDA ObjParam4DuringUnpack
80fc 20 cc 80 JSR ExecuteLevelDrawCommands__DrawLine
80ff 60 RTS
; .ObjTypeDuringUnpack : object
; .ObjParam1DuringUnpack : x
; .ObjParam2DuringUnpack : y
; .ObjParam3DuringUnpack : width
; .ObjParam4DuringUnpack : height
ExecuteLevelDrawCommands__DrawFilledRect:8100 20 9e 80 JSR ExecuteLevelDrawCommands__SetOutputPointer
8103 a5 df LDA ObjParam4DuringUnpack
8105 85 c8 STA ExecuteLevelDrawCommands__LineLength
;
__ExecuteLevelDrawCommands__DrawFilledRect__NextLine:; In this function .ExecuteLevelDrawCommands::LineLength is the height of the rect.
8107 c6 c8 DEC ExecuteLevelDrawCommands__LineLength
8109 30 1c BMI __ExecuteLevelDrawCommands__DrawFilledRect__Finished
; Draw a horizontal line of .ObjTypeDuringUnpack, length .ObjParam3DuringUnpack.
810b a4 dd LDY ObjParam3DuringUnpack
__ExecuteLevelDrawCommands__DrawFilledRect__NextCell:810d 88 DEY
810e 30 07 BMI __ExecuteLevelDrawCommands__DrawFilledRect__LineFinished
8110 a5 da LDA ObjTypeDuringUnpack
8112 91 3a STA (ExecuteLevelDrawCommands__OutPtr),Y
8114 4c 0d 81 JMP __ExecuteLevelDrawCommands__DrawFilledRect__NextCell
; Next row.
__ExecuteLevelDrawCommands__DrawFilledRect__LineFinished:8117 18 CLC
8118 a5 3a LDA ExecuteLevelDrawCommands__OutPtr
811a 69 28 ADC #$28
811c 85 3a STA ExecuteLevelDrawCommands__OutPtr
811e a5 3b LDA ExecuteLevelDrawCommands__OutPtr+1
8120 69 00 ADC #$00
8122 85 3b STA ExecuteLevelDrawCommands__OutPtr+1
8124 4c 07 81 JMP __ExecuteLevelDrawCommands__DrawFilledRect__NextLine
;
__ExecuteLevelDrawCommands__DrawFilledRect__Finished:8127 60 RTS
; .ObjTypeDuringUnpack : outer object
; .ObjParam1DuringUnpack : x
; .ObjParam2DuringUnpack : y
; .ObjParam3DuringUnpack : width
; .ObjParam4DuringUnpack : height
; .ObjParam5DuringUnpack : inner object
ExecuteLevelDrawCommands__OutputFilledRect:8128 20 00 81 JSR ExecuteLevelDrawCommands__DrawFilledRect
812b a5 e0 LDA ObjParam5DuringUnpack
812d 85 da STA ObjTypeDuringUnpack
812f e6 db INC ObjParam1DuringUnpack
8131 e6 dc INC ObjParam2DuringUnpack
8133 c6 dd DEC ObjParam3DuringUnpack
8135 c6 dd DEC ObjParam3DuringUnpack
8137 c6 df DEC ObjParam4DuringUnpack
8139 c6 df DEC ObjParam4DuringUnpack
813b 20 00 81 JSR ExecuteLevelDrawCommands__DrawFilledRect
813e 60 RTS
; .ObjTypeDuringUnpack : object
; .ObjParam1DuringUnpack : x
; .ObjParam2DuringUnpack : y
; .ObjParam3DuringUnpack : width
; .ObjParam4DuringUnpack : height
ExecuteLevelDrawCommands__OutputRect:813f 20 9e 80 JSR ExecuteLevelDrawCommands__SetOutputPointer
; Draw top edge heading east, length is param3-1.
8142 a5 dd LDA ObjParam3DuringUnpack
8144 85 c8 STA ExecuteLevelDrawCommands__LineLength
8146 c6 c8 DEC ExecuteLevelDrawCommands__LineLength
8148 a9 02 LDA #$02
814a 20 cc 80 JSR ExecuteLevelDrawCommands__DrawLine
; Draw right edge heading south, length is param4-1. This fills the remaining cell of the top edge.
814d a5 df LDA ObjParam4DuringUnpack
814f 85 c8 STA ExecuteLevelDrawCommands__LineLength
8151 c6 c8 DEC ExecuteLevelDrawCommands__LineLength
8153 a9 04 LDA #$04
8155 20 cc 80 JSR ExecuteLevelDrawCommands__DrawLine
; Draw bottom edge heading west, length is param3-1. This fills the remaining cell of the right edge.
8158 a5 dd LDA ObjParam3DuringUnpack
815a 85 c8 STA ExecuteLevelDrawCommands__LineLength
815c c6 c8 DEC ExecuteLevelDrawCommands__LineLength
815e a9 06 LDA #$06
8160 20 cc 80 JSR ExecuteLevelDrawCommands__DrawLine
; Draw left edge heading north, length is param4-1. This fills the remaining cell of the bottom edge.
8163 a5 df LDA ObjParam4DuringUnpack
8165 85 c8 STA ExecuteLevelDrawCommands__LineLength
8167 c6 c8 DEC ExecuteLevelDrawCommands__LineLength
8169 a9 00 LDA #$00
816b 20 cc 80 JSR ExecuteLevelDrawCommands__DrawLine
816e 60 RTS
;
ExecuteLevelDrawCommands__Advance3Bytes:816f c8 INY
8170 c8 INY
8171 c8 INY
8172 84 cb STY CaveUnpackOffset
8174 60 RTS
ExecuteLevelDrawCommands__Advance5Bytes:8175 c8 INY
8176 c8 INY
8177 20 6f 81 JSR ExecuteLevelDrawCommands__Advance3Bytes
817a 60 RTS
ExecuteLevelDrawCommands__Advance6Bytes:817b c8 INY
817c 20 75 81 JSR ExecuteLevelDrawCommands__Advance5Bytes
817f 60 RTS
;
ExecuteLevelDrawCommands:8180 a0 00 LDY #$00
8182 84 cb STY CaveUnpackOffset
__ExecuteLevelDrawCommands__MainLoop:8184 a4 cb LDY CaveUnpackOffset
; .BufferedLevel_Object
; ---------------------------------
; |$80|$40|$20|$10|$08|$04|$02|$01|
; ---------------------------------
; |Command| Object |
; ---------------------------------
;
; Commands:
; $00 : single object : (param1:x, param2:y)
; $40 : line : (param1:x, param2:y, param3:length, param4:direction)
; $80 : filled rectangle : (param1:x, param2:y, param3:width, param4:height, param5:inner object)
; $c0 : rectangle
8186 b9 20 24 LDA BufferedLevel_Object,Y
8189 c9 ff CMP #$ff
818b f0 62 BEQ __ExecuteLevelDrawCommands__Exit
818d 29 3f AND #$3f
818f 85 da STA ObjTypeDuringUnpack
8191 c9 25 CMP #$25
8193 d0 0a BNE __ExecuteLevelDrawCommands__GenericElementProcessing
__ExecuteLevelDrawCommands__IsRockford:8195 b9 21 24 LDA BufferedLevel_Param1,Y
8198 85 44 STA RockfordX
819a b9 22 24 LDA BufferedLevel_Param2,Y
819d 85 45 STA RockfordY
__ExecuteLevelDrawCommands__GenericElementProcessing:819f b9 21 24 LDA BufferedLevel_Param1,Y
81a2 85 db STA ObjParam1DuringUnpack
81a4 b9 22 24 LDA BufferedLevel_Param2,Y
81a7 85 dc STA ObjParam2DuringUnpack
81a9 b9 23 24 LDA BufferedLevel_Param3,Y
81ac 85 dd STA ObjParam3DuringUnpack
81ae b9 24 24 LDA BufferedLevel_Param4,Y
81b1 85 df STA ObjParam4DuringUnpack
81b3 b9 25 24 LDA BufferedLevel_Param5,Y
81b6 85 e0 STA ObjParam5DuringUnpack
__ExecuteLevelDrawCommands__SwitchOnCommand:81b8 b9 20 24 LDA BufferedLevel_Object,Y
81bb 29 c0 AND #$c0
81bd d0 09 BNE _CmdNotSingleObj
__ExecuteLevelDrawCommands__Case_SingleObject:81bf 20 6f 81 JSR ExecuteLevelDrawCommands__Advance3Bytes
81c2 20 b2 80 JSR ExecuteLevelDrawCommands__OutputSingle
81c5 4c ec 81 JMP __ExecuteLevelDrawCommands__NextElement
_CmdNotSingleObj:81c8 c9 40 CMP #$40
81ca d0 09 BNE _CmdNotLine
__ExecuteLevelDrawCommands__Case_Line:81cc 20 75 81 JSR ExecuteLevelDrawCommands__Advance5Bytes
81cf 20 f3 80 JSR ExecuteLevelDrawCommands__OutputLine
81d2 4c ec 81 JMP __ExecuteLevelDrawCommands__NextElement
_CmdNotLine:81d5 c9 80 CMP #$80
81d7 d0 09 BNE _CmdNotFilledRect
__ExecuteLevelDrawCommands__Case_FilledRect:81d9 20 7b 81 JSR ExecuteLevelDrawCommands__Advance6Bytes
81dc 20 28 81 JSR ExecuteLevelDrawCommands__OutputFilledRect
81df 4c ec 81 JMP __ExecuteLevelDrawCommands__NextElement
_CmdNotFilledRect:81e2 c9 c0 CMP #$c0
81e4 d0 06 BNE __ExecuteLevelDrawCommands__NextElement
__ExecuteLevelDrawCommands__Case_Rect:81e6 20 75 81 JSR ExecuteLevelDrawCommands__Advance5Bytes
81e9 20 3f 81 JSR ExecuteLevelDrawCommands__OutputRect
__ExecuteLevelDrawCommands__NextElement:81ec 4c 84 81 JMP __ExecuteLevelDrawCommands__MainLoop
__ExecuteLevelDrawCommands__Exit:81ef 60 RTS
;
TitleScreenFillInPlayerAndJoystick:81f0 a5 a3 LDA TitleScreenInLicenseMode
81f2 d0 1a BNE __TitleScreenFillInPlayerAndJoystick__Exit
81f4 a5 9e LDA NumPlayerMinusOne
81f6 18 CLC
81f7 69 11 ADC #$11
81f9 8d 70 0b STA CaveMatrix_or_TitleLogoTileMap+$370
81fc 69 34 ADC #$34
81fe 8d 71 0b STA CaveMatrix_or_TitleLogoTileMap+$371
8201 a5 a4 LDA NumJoysticksMinusOne
8203 18 CLC
8204 69 11 ADC #$11
8206 8d 84 0b STA CaveMatrix_or_TitleLogoTileMap+$384
8209 69 34 ADC #$34
820b 8d 85 0b STA CaveMatrix_or_TitleLogoTileMap+$385
__TitleScreenFillInPlayerAndJoystick__Exit:820e 60 RTS
;
FrameLevelWithSteelWall:820f a9 07 LDA #$07
8211 85 da STA ObjTypeDuringUnpack
8213 a9 00 LDA #$00
8215 85 db STA ObjParam1DuringUnpack
8217 a9 02 LDA #$02
8219 85 dc STA ObjParam2DuringUnpack
821b a9 28 LDA #$28
821d 85 dd STA ObjParam3DuringUnpack
821f a9 16 LDA #$16
8221 85 df STA ObjParam4DuringUnpack
8223 20 3f 81 JSR ExecuteLevelDrawCommands__OutputRect
8226 60 RTS
;
SetupTitleScreenText:; Top two lines and BD logo (copies too much):
; 66e8-67e7 to 0800-08ff (From line 1 column 1 to line 7 column 16)
; 67e8-68e7 to 0900-09ff (From line 7 column 17 to line 13 column 32)
; 68e8-69e7 to 0a00-0aff (From line 13 column 33 to line 20 column 8)
; License text (starts too early):
; 69d0-6acf to 0ee8-0fe7 (Tilemap @ $0c00: L19 C25 - L25 C40)
8227 a2 00 LDX #$00
8229 bd e8 66 LDA Top2LinesAndBoulderDashLogo,X
822c 9d 00 08 STA CaveMatrix_or_TitleLogoTileMap,X
822f bd e8 67 LDA Top2LinesAndBoulderDashLogo+$100,X
8232 9d 00 09 STA CaveMatrix_or_TitleLogoTileMap+$100,X
8235 bd e8 68 LDA Top2LinesAndBoulderDashLogo+$200,X
8238 9d 00 0a STA CaveMatrix_or_TitleLogoTileMap+$200,X
; .......l-i-c-e-n-s-e-d-..f-r-o-m-.......
; .......c-r-a-c-k-e-d-..b-y-..n-o-v-a-...
; ..............c-..1-9-8-4-..............
; .f-i-r-s-t-..s-t-a-r-..s-o-f-t-w-a-r-e-.
; m-i-c-r-o-..f-u-n-.*-.m-i-c-r-o-..f-u-n-
823b bd d0 69 LDA Top2LinesAndBoulderDashLogo+$2e8,X
823e 9d e8 0e STA GameTileMap1_or_TitleTextTileMap+$2e8,X
8241 e8 INX
8242 d0 e5 BNE $8229
; When we first start the game the license text is shown below the logo.
; Pressing F1 replaces this text with some credits on the upper three lines
; and the lower two with game information such as starting cave and level:
;
; ..by.peter.liepa....
; ..with.chris.grey...
; press.button.to.play
; 1.player..1.joystick
; .cave:.a..level:.1..
;
; After a game has been played or the demo has completed the upper three
; lines are replaced with high and last scores for both players:
;
; .plyr.1......plyr.2.
; .001750.last.000000.
; .001750.high.000000.
; 1.player..1.joystick
; .cave:.a..level:.1..
8244 a5 cc LDA ForceCreditsMode
8246 05 a2 ORA IsDemoMode
8248 f0 48 BEQ __SetupTitleScreenText__ScoresMode
__SetupTitleScreenText__CreditsMode:824a a2 00 LDX #$00
824c a0 00 LDY #$00
__SetupTitleScreenText__ByPeterLiepaLoop:824e b9 7c 6b LDA Text_ByPeterLiepa,Y
8251 9d f8 0a STA CaveMatrix_or_TitleLogoTileMap+$2f8,X
8254 e8 INX
8255 18 CLC
8256 69 34 ADC #$34
8258 9d f8 0a STA CaveMatrix_or_TitleLogoTileMap+$2f8,X
825b e8 INX
825c c8 INY
825d c0 14 CPY #$14
825f d0 ed BNE __SetupTitleScreenText__ByPeterLiepaLoop
8261 a2 00 LDX #$00
8263 a0 00 LDY #$00
__SetupTitleScreenText__WithChrisGreyLoop:8265 b9 90 6b LDA Text__WithChrisGrey,Y
8268 9d 20 0b STA CaveMatrix_or_TitleLogoTileMap+$320,X
826b e8 INX
826c 18 CLC
826d 69 34 ADC #$34
826f 9d 20 0b STA CaveMatrix_or_TitleLogoTileMap+$320,X
8272 e8 INX
8273 c8 INY
8274 c0 14 CPY #$14
8276 d0 ed BNE __SetupTitleScreenText__WithChrisGreyLoop
8278 a2 00 LDX #$00
827a a0 00 LDY #$00
__SetupTitleScreenText__PressButtonToPlayLoop:827c b9 6c 6c LDA Text_PressButtonToPlay,Y
827f 9d 48 0b STA CaveMatrix_or_TitleLogoTileMap+$348,X
8282 e8 INX
8283 18 CLC
8284 69 34 ADC #$34
8286 9d 48 0b STA CaveMatrix_or_TitleLogoTileMap+$348,X
8289 e8 INX
828a c8 INY
828b c0 14 CPY #$14
828d d0 ed BNE __SetupTitleScreenText__PressButtonToPlayLoop
__SetupTitleScreenText__JumpToPart2:828f 4c d7 82 JMP __SetupTitleScreenText__Part2
__SetupTitleScreenText__ScoresMode:8292 a2 00 LDX #$00
8294 a0 00 LDY #$00
__SetupTitleScreenText__Plyr1Ply2Loop:8296 b9 b8 6b LDA Text_Plyr1Ply2,Y
8299 9d f8 0a STA CaveMatrix_or_TitleLogoTileMap+$2f8,X
829c e8 INX
829d 18 CLC
829e 69 34 ADC #$34
82a0 9d f8 0a STA CaveMatrix_or_TitleLogoTileMap+$2f8,X
82a3 e8 INX
82a4 c8 INY
82a5 c0 14 CPY #$14
82a7 d0 ed BNE __SetupTitleScreenText__Plyr1Ply2Loop
82a9 a2 00 LDX #$00
82ab a0 00 LDY #$00
82ad b9 12 98 LDA CurrentHighScoreText,Y
82b0 9d 20 0b STA CaveMatrix_or_TitleLogoTileMap+$320,X
82b3 e8 INX
82b4 18 CLC
82b5 69 34 ADC #$34
82b7 9d 20 0b STA CaveMatrix_or_TitleLogoTileMap+$320,X
82ba e8 INX
82bb c8 INY
82bc c0 14 CPY #$14
82be d0 ed BNE $82ad
82c0 a2 00 LDX #$00
82c2 a0 00 LDY #$00
82c4 b9 26 98 LDA CurrentLastScoreText,Y
82c7 9d 48 0b STA CaveMatrix_or_TitleLogoTileMap+$348,X
82ca e8 INX
82cb 18 CLC
82cc 69 34 ADC #$34
82ce 9d 48 0b STA CaveMatrix_or_TitleLogoTileMap+$348,X
82d1 e8 INX
82d2 c8 INY
82d3 c0 14 CPY #$14
82d5 d0 ed BNE $82c4
__SetupTitleScreenText__Part2:82d7 a2 00 LDX #$00
82d9 a0 00 LDY #$00
__SetupTitleScreenText__F1TextLine5Loop:; .cave?.a..level?.1..
82db b9 44 6c LDA F1Text__Line5,Y
82de 9d 98 0b STA CaveMatrix_or_TitleLogoTileMap+$398,X
82e1 e8 INX
82e2 18 CLC
82e3 69 34 ADC #$34
82e5 9d 98 0b STA CaveMatrix_or_TitleLogoTileMap+$398,X
82e8 e8 INX
82e9 c8 INY
82ea c0 14 CPY #$14
82ec d0 ed BNE __SetupTitleScreenText__F1TextLine5Loop
82ee a2 00 LDX #$00
82f0 a0 00 LDY #$00
__SetupTitleScreenText__F1TextLine4Loop:; 1.player..1.joystick
82f2 b9 a4 6b LDA F1Text__Line4,Y
82f5 9d 70 0b STA CaveMatrix_or_TitleLogoTileMap+$370,X
82f8 e8 INX
82f9 18 CLC
82fa 69 34 ADC #$34
82fc 9d 70 0b STA CaveMatrix_or_TitleLogoTileMap+$370,X
82ff e8 INX
8300 c8 INY
8301 c0 14 CPY #$14
8303 d0 ed BNE __SetupTitleScreenText__F1TextLine4Loop
8305 a2 27 LDX #$27
8307 a9 20 LDA #$20
8309 9d c0 0b STA CaveMatrix_or_TitleLogoTileMap+$3c0,X
830c ca DEX
830d 10 fa BPL $8309
830f 20 f0 81 JSR TitleScreenFillInPlayerAndJoystick
8312 a9 00 LDA #$00
8314 85 cc STA ForceCreditsMode
8316 60 RTS
MusicNoteToFreqTable:8317 dc 02 0a 03 3a 03 6c 03 a0 03 d2 03 12 04 4c 04
8327 92 04 d6 04 20 05 6e 05 b8 05 14 06 74 06 d8 06
8337 40 07 a4 07 24 08 98 08 24 09 ac 09 40 0a dc 0a
8347 70 0b 28 0c e8 0c b0 0d 80 0e 48 0f 48 10 30 11
8357 48 12 58 13 80 14 b8 15 e0 16 50 18 d0 19 60 1b
8367 00 1d 90 1e 90 20 60 22 90 24 b0 26 00 29 70 2b
8377 c0 2d
LevelActiveAnimations:; >=4 : Amoeba
; bit 1 : Butterfly
; bit 0 : Firefly
8379 00 01 00 02 01 01 05 01 00 01 01 01 06 03 01 01
8389 02 01 01 01
;
MakeF1ScreenControlsLightBlue:838d a9 0e LDA #$0e
838f a2 01 LDX #$01
; line 23, column 1
8391 9d 70 db STA C64_ColourRam+$370,X
; line 23, column 21
8394 9d 84 db STA C64_ColourRam+$384,X
; line 24, column 15
8397 9d a6 db STA C64_ColourRam+$3a6,X
; line 24, column 35
839a 9d ba db STA C64_ColourRam+$3ba,X
839d ca DEX
839e 10 f1 BPL $8391
83a0 60 RTS
;
MakeFirstTwoLinesYellow:83a1 a9 07 LDA #$07
83a3 a2 4f LDX #$4f
83a5 9d 00 d8 STA C64_ColourRam,X
83a8 ca DEX
83a9 10 fa BPL $83a5
83ab 60 RTS
;
MusicTickRoutine:83ac a5 c1 LDA TitleScreenFrameCountMod4
83ae 29 01 AND #$01
83b0 d0 01 BNE $83b3
83b2 60 RTS
83b3 ad 0c 98 LDA MusicTickRoutine__Voice1SustainLevel
83b6 c9 a0 CMP #$a0
83b8 d0 43 BNE __MusicTickRoutine__TweakCurrentNote
__MusicTickRoutine__NextNote:; Set voice 1&2 to triangle wave.
83ba a9 10 LDA #$10
83bc 8d 04 d4 STA Sid_Voice1Ctrl
83bf 8d 0b d4 STA Sid_Voice2Ctrl
; Voice 2:
; Attack 10
; Decay 8
83c2 a9 a8 LDA #$a8
83c4 8d 0c d4 STA Sid_Voice2AttackDecay
83c7 8d 0d d4 STA Sid_Voice2SustainRelease
;
83ca ae 00 98 LDX MusicDataIndex
83cd ee 00 98 INC MusicDataIndex
83d0 ee 00 98 INC MusicDataIndex
83d3 bd e9 5f LDA MusicData+1,X
83d6 0a ASL A
83d7 a8 TAY
83d8 b9 03 83 LDA MusicNoteToFreqTable-$14,Y
83db 8d 00 d4 STA Sid_Voice1FreqLo
83de b9 04 83 LDA MusicNoteToFreqTable-$13,Y
83e1 8d 01 d4 STA Sid_Voice1FreqHi
83e4 bd e8 5f LDA MusicData,X
83e7 0a ASL A
83e8 a8 TAY
83e9 b9 03 83 LDA MusicNoteToFreqTable-$14,Y
83ec 8d 07 d4 STA Sid_Voice2FreqLo
83ef b9 04 83 LDA MusicNoteToFreqTable-$13,Y
83f2 8d 08 d4 STA Sid_Voice2FreqHi
83f5 ad 00 98 LDA MusicDataIndex
83f8 d0 03 BNE __MusicTickRoutine__TweakCurrentNote
83fa ee 01 98 INC MusicLoopedCount
__MusicTickRoutine__TweakCurrentNote:83fd ad 0c 98 LDA MusicTickRoutine__Voice1SustainLevel
8400 49 07 EOR #$07
8402 69 04 ADC #$04
8404 0a ASL A
8405 0a ASL A
8406 0a ASL A
8407 0a ASL A
8408 8d 06 d4 STA Sid_Voice1SustainRelease
840b a9 11 LDA #$11
840d 8d 04 d4 STA Sid_Voice1Ctrl
8410 8d 0b d4 STA Sid_Voice2Ctrl
8413 ad 0c 98 LDA MusicTickRoutine__Voice1SustainLevel
8416 18 CLC
8417 69 01 ADC #$01
8419 29 a7 AND #$a7
841b 8d 0c 98 STA MusicTickRoutine__Voice1SustainLevel
841e a5 a2 LDA IsDemoMode
8420 f0 0b BEQ $842d
8422 ad 01 98 LDA MusicLoopedCount
8425 c9 02 CMP #$02
8427 d0 04 BNE $842d
8429 a9 01 LDA #$01
842b 85 cd STA StartGameTrigger
842d 60 RTS
;
ScrollingBGUpdateFillChars:842e a2 07 LDX #$07
8430 bd 30 20 LDA CopiedTitleChar+$30,X
8433 1d 00 20 ORA CopiedTitleChar,X
8436 9d 48 20 STA CopiedTitleChar+$48,X
8439 bd 38 20 LDA CopiedTitleChar+$38,X
843c 1d 00 20 ORA CopiedTitleChar,X
843f 9d 50 20 STA CopiedTitleChar+$50,X
8442 ca DEX
8443 10 eb BPL $8430
8445 60 RTS
TitleIRQActions:8446 a5 cf LDA RastInt_FurthestFromTitleIRQRaceCondition
8448 d0 07 BNE __TitleIRQActions__NotZero
__TitleIRQActions__Zero:844a a9 01 LDA #$01
844c 85 cf STA RastInt_FurthestFromTitleIRQRaceCondition
844e 4c 66 84 JMP __TitleIRQActions__Return
__TitleIRQActions__NotZero:8451 e6 c1 INC TitleScreenFrameCountMod4
8453 a5 c1 LDA TitleScreenFrameCountMod4
8455 c9 04 CMP #$04
8457 90 0a BCC __TitleIRQActions__Lt4
__TitleIRQActions__GtEq4:8459 a9 00 LDA #$00
845b 85 c1 STA TitleScreenFrameCountMod4
845d 20 87 74 JSR ScrollingBGTick
8460 20 2e 84 JSR ScrollingBGUpdateFillChars
__TitleIRQActions__Lt4:8463 20 ac 83 JSR MusicTickRoutine
__TitleIRQActions__Return:8466 60 RTS
HandleNumPlayersAndJoysticks:8467 a5 fb LDA LastKeyInScanRow0_ScannedMoreThanOnce
8469 c9 df CMP #$df
846b d0 2e BNE $849b
__HandleNumPlayersAndJoysticks__F3Pressed:846d a9 00 LDA #$00
846f 8d 01 98 STA MusicLoopedCount
; .NumPlayersAndJoysticksState:
; 1 -> 1 player(s), 1 joystick(s)
; 2 -> 2 player(s), 1 joystick(s)
; 3 -> 2 player(s), 2 joystick(s)
8472 e6 d0 INC NumPlayersAndJoysticksState
8474 a5 d0 LDA NumPlayersAndJoysticksState
8476 c9 04 CMP #$04
8478 d0 0b BNE __HandleNumPlayersAndJoysticks__Not4
__HandleNumPlayersAndJoysticks__Is4:847a a2 01 LDX #$01
847c 86 d0 STX NumPlayersAndJoysticksState
847e ca DEX
847f 86 9e STX NumPlayerMinusOne
8481 86 a4 STX NumJoysticksMinusOne
8483 f0 10 BEQ __HandleNumPlayersAndJoysticks__Not3
__HandleNumPlayersAndJoysticks__Not4:8485 a5 d0 LDA NumPlayersAndJoysticksState
8487 c9 02 CMP #$02
8489 d0 02 BNE __HandleNumPlayersAndJoysticks__Not2
__HandleNumPlayersAndJoysticks__Is2:848b e6 9e INC NumPlayerMinusOne
__HandleNumPlayersAndJoysticks__Not2:848d a5 d0 LDA NumPlayersAndJoysticksState
848f c9 03 CMP #$03
8491 d0 02 BNE __HandleNumPlayersAndJoysticks__Not3
__HandleNumPlayersAndJoysticks__Is3:8493 e6 a4 INC NumJoysticksMinusOne
__HandleNumPlayersAndJoysticks__Not3:8495 20 f0 81 JSR TitleScreenFillInPlayerAndJoystick
8498 20 0c 7d JSR FourDelays
849b a9 00 LDA #$00
849d 85 fb STA LastKeyInScanRow0_ScannedMoreThanOnce
849f 4c f0 81 JMP TitleScreenFillInPlayerAndJoystick
;
HandleCaveAndLevelSecection:84a2 20 5d 6b JSR ReadJoystickDirectionPort1
84a5 c9 0f CMP #$0f
84a7 f0 6b BEQ __HandleCaveAndLevelSecection__Centered
; Any joystick movement resets the music repeat count.
84a9 a2 00 LDX #$00
84ab 8e 01 98 STX MusicLoopedCount
;
84ae c9 0d CMP #$0d
84b0 d0 06 BNE $84b8
__HandleCaveAndLevelSecection__Down:84b2 a6 5e LDX Level
84b4 f0 02 BEQ $84b8
84b6 c6 5e DEC Level
84b8 c9 0e CMP #$0e
84ba d0 12 BNE $84ce
__HandleCaveAndLevelSecection__Up:84bc a9 04 LDA #$04
84be c5 5e CMP Level
84c0 f0 02 BEQ $84c4
84c2 e6 5e INC Level
; If .Level is 3 (4 in game) set .Cave to 1 (A).
84c4 a5 5e LDA Level
84c6 c9 03 CMP #$03
84c8 d0 04 BNE $84ce
84ca a9 01 LDA #$01
84cc 85 5d STA Cave
;
84ce 20 5d 6b JSR ReadJoystickDirectionPort1
84d1 c9 0b CMP #$0b
84d3 d0 0a BNE $84df
__HandleCaveAndLevelSecection__Left:84d5 a5 5d LDA Cave
84d7 c9 05 CMP #$05
84d9 90 04 BCC $84df
; .Cave >= 5. Four caves back.
84db e9 04 SBC #$04
84dd 85 5d STA Cave
84df 20 5d 6b JSR ReadJoystickDirectionPort1
84e2 c9 07 CMP #$07
84e4 d0 10 BNE $84f6
__HandleCaveAndLevelSecection__Right:; If .Level >=3 (>=4 as shown in game) the you can't select any Cave but A.
84e6 a5 5e LDA Level
84e8 c9 03 CMP #$03
84ea b0 0a BCS $84f6
; .Level < 3 (< 4 in game)
84ec a5 5d LDA Cave
84ee c9 0d CMP #$0d
84f0 b0 04 BCS $84f6
; Skip four caves.
84f2 69 04 ADC #$04
84f4 85 5d STA Cave
; Skip writing to screen if we're in license mode.
; Interestingly the cave and level can still be adjusted.
84f6 a5 a3 LDA TitleScreenInLicenseMode
84f8 d0 1a BNE __HandleCaveAndLevelSecection__Centered
; Write cave and level to screen.
84fa a5 5e LDA Level
84fc 18 CLC
84fd 69 11 ADC #$11
84ff 8d ba 0b STA CaveMatrix_or_TitleLogoTileMap+$3ba
8502 69 34 ADC #$34
8504 8d bb 0b STA CaveMatrix_or_TitleLogoTileMap+$3bb
8507 a5 5d LDA Cave
8509 18 CLC
850a 69 20 ADC #$20
850c 8d a6 0b STA CaveMatrix_or_TitleLogoTileMap+$3a6
850f 69 34 ADC #$34
8511 8d a7 0b STA CaveMatrix_or_TitleLogoTileMap+$3a7
__HandleCaveAndLevelSecection__Centered:8514 20 03 7d JSR Delay
8517 60 RTS
;
TitleScreenLoop:8518 20 67 84 JSR HandleNumPlayersAndJoysticks
851b 20 a2 84 JSR HandleCaveAndLevelSecection
851e a5 a3 LDA TitleScreenInLicenseMode
8520 f0 21 BEQ TitleScreenLoop__NotLicenseMode
;
__TitleScreenLoop__LicenseMode:; Make lines 1 and 24 yellow.
8522 a9 07 LDA #$07
8524 a2 27 LDX #$27
; Line 24, column 1
8526 9d 98 db STA C64_ColourRam+$398,X
; Line 1, column 1
8529 9d 00 d8 STA C64_ColourRam,X
852c ca DEX
852d 10 f7 BPL $8526
; Is F1 pressed?
852f a5 fb LDA LastKeyInScanRow0_ScannedMoreThanOnce
8531 c9 ef CMP #$ef
8533 d0 4f BNE __TitleScreenLoop__F1NotPressed
__TitleScreenLoop__F1Pressed:8535 a9 01 LDA #$01
8537 85 cc STA ForceCreditsMode
8539 20 27 82 JSR SetupTitleScreenText
; Set lower 23 lines of colour RAM to MCM-white.
853c a9 09 LDA #$09
853e a0 50 LDY #$50
8540 20 e3 6a JSR SetupColourRam
TitleScreenLoop__NotLicenseMode:8543 20 8d 83 JSR MakeF1ScreenControlsLightBlue
8546 20 a1 83 JSR MakeFirstTwoLinesYellow
8549 a9 01 LDA #$01
854b a2 0d LDX #$0d
; Line 24 column 1
854d 9d 98 db STA C64_ColourRam+$398,X
; Line 24 column 29
8550 9d aa db STA C64_ColourRam+$3aa,X
8553 ca DEX
8554 10 f7 BPL $854d
; Fill in level and cave.
8556 a5 5e LDA Level
8558 18 CLC
8559 69 11 ADC #$11
; line 24, column 35
855b 8d ba 0b STA CaveMatrix_or_TitleLogoTileMap+$3ba
855e 69 34 ADC #$34
8560 8d bb 0b STA CaveMatrix_or_TitleLogoTileMap+$3bb
8563 a5 5d LDA Cave
8565 18 CLC
8566 69 20 ADC #$20
; line 24, column 15
8568 8d a6 0b STA CaveMatrix_or_TitleLogoTileMap+$3a6
856b 69 34 ADC #$34
856d 8d a7 0b STA CaveMatrix_or_TitleLogoTileMap+$3a7
; The number of joysticks and players is handled in .HandleNumPlayersAndJoysticks.
; This is lucky as this code only fills in the first character of the number of players.
8570 a5 9e LDA NumPlayerMinusOne
8572 c9 ff CMP #$ff
8574 d0 02 BNE $8578
8576 e6 9e INC NumPlayerMinusOne
8578 a5 9e LDA NumPlayerMinusOne
857a 18 CLC
857b 69 11 ADC #$11
; line 23, column 1
857d 8d 70 0b STA CaveMatrix_or_TitleLogoTileMap+$370
;
8580 a9 00 LDA #$00
8582 85 a3 STA TitleScreenInLicenseMode
__TitleScreenLoop__F1NotPressed:8584 a5 a3 LDA TitleScreenInLicenseMode
8586 d0 0b BNE $8593
8588 20 74 6b JSR ReadFireButtonPort1
858b d0 06 BNE $8593
858d 85 a2 STA IsDemoMode
858f a9 01 LDA #$01
8591 85 cd STA StartGameTrigger
8593 a5 cd LDA StartGameTrigger
8595 d0 03 BNE $859a
8597 4c 18 85 JMP TitleScreenLoop
859a 60 RTS
;
RunTitleScreen:; Reset scrolling background character.
859b a2 00 LDX #$00
859d bd 58 20 LDA CopiedTitleChar+$58,X
85a0 9d 00 20 STA CopiedTitleChar,X
85a3 e8 INX
85a4 e0 08 CPX #$08
85a6 d0 f5 BNE $859d
;
85a8 a9 01 LDA #$01
85aa 85 5d STA Cave
85ac 85 a2 STA IsDemoMode
85ae 20 18 85 JSR TitleScreenLoop
; When we get here a game has started (this includes demo mode).
85b1 a9 01 LDA #$01
85b3 85 bd STA PlayRevealLevelSoundAndRedefineCharFlag
85b5 85 c2 STA AnotherFrameCounter
; Retool raster interrupts for in-game mode.
85b7 78 SEI
85b8 a2 07 LDX #$07
85ba bd 13 86 LDA RastIntGameModeVICRegs,X
85bd 95 54 STA RastInt_vic_control1,X
85bf ca DEX
85c0 10 f8 BPL $85ba
85c2 58 CLI
85c3 a9 00 LDA #$00
85c5 85 ce STA RastInt_IntroScreenFlag
;
85c7 85 c1 STA TitleScreenFrameCountMod4
85c9 85 fb STA LastKeyInScanRow0_ScannedMoreThanOnce
85cb 85 fc STA LastKeyInScanRow7_ScannedMoreThanOnce
85cd 20 f4 7c JSR ResetSound
85d0 a5 a2 LDA IsDemoMode
85d2 f0 07 BEQ __RunTitleScreen__GameMode
__RunTitleScreen__DemoMode:85d4 a2 00 LDX #$00
85d6 86 5e STX Level
85d8 e8 INX
85d9 86 5d STX Cave
__RunTitleScreen__GameMode:; $984e: player.1,.2.men.a/1.
; .................|
; Men left----->---/
85db a9 13 LDA #$13
85dd 8d 58 98 STA $9858
85e0 85 95 STA FlashingEntryBoxCountDown
; $984e: player.1,.2.men.a/1.
; .......................|
; Cave--------->---------/
85e2 a5 5d LDA Cave
85e4 18 CLC
85e5 69 20 ADC #$20
85e7 8d 5e 98 STA $985e
; $984e: player.1,.2.men.a/1.
; .........................|
; Level---------->---------/
85ea a5 5e LDA Level
85ec 18 CLC
85ed 69 11 ADC #$11
85ef 8d 60 98 STA $9860
; Set top line text to player into display.
85f2 a9 00 LDA #$00
85f4 85 94 STA EnableSomeSFXAndMarqueeUpdates
85f6 a9 4e LDA #<CurrentPlayerInfoText
85f8 85 46 STA LocalVar
85fa a9 98 LDA #>CurrentPlayerInfoText
85fc 85 47 STA LocalVar+1
85fe 20 16 6b JSR SetTopLineText
; Start.
8601 a9 02 LDA #$02
8603 85 97 STA ExitCaveFlag
8605 60 RTS
;
TitleModeVICColourRegs:8606 00 00 06 0e 09
; struct RastIntVicRegs
; {
; BYTE Vic_Control1[2]; // $d011
; BYTE Vic_Control2[2]; // $d016
; BYTE Vic_MemCtrl[2]; // $d018
; BYTE Vic_Raster[2]; // $d012
; };
;
; Vic_Control1 0x1b =
; ECM: off,
; Bitmap: off,
; Blank: off,
; 25 rows,
; Y Position: 3
;
; Vic_Control2 0x18 =
; MCM: on,
; 40 cols,
; X Pos: 0
;
; Vic_MemCtrl 0x38 =
; Charset 0x2000
; Tilemap 0x0c00
;
; Vic_MemCtrl 0x28 =
; Charset 0x2000
; Tilemap 0x0800
RastIntTitleModeVICRegs:860b 1b 1b 18 18 38 28 28 c2
; struct RastIntVicRegs
; {
; BYTE Vic_Control1[2]; // $d011
; BYTE Vic_Control2[2]; // $d016
; BYTE Vic_MemCtrl[2]; // $d018
; BYTE Vic_Raster[2]; // $d012
; };
;
; Vic_Control1 0x10 =
; ECM: off,
; Bitmap: off,
; Blank: off,
; 24 rows,
; Y Position: 0
;
; Vic_Control1 0x1b =
; ECM: off,
; Bitmap: off,
; Blank: off,
; 25 rows,
; Y Position: 3
;
; Vic_Control2 0x10 =
; MCM: on,
; 38 cols,
; X Pos: 0
;
; Vic_Control2 0x18 =
; MCM: on,
; 40 cols,
; X Pos: 0
;
; Vic_MemCtrl 0x3c =
; Charset 0x3000
; Tilemap 0x0c00
;
; Vic_MemCtrl 0x38 =
; Charset 0x2000
; Tilemap 0x0c00
RastIntGameModeVICRegs:8613 10 1b 10 18 3c 38 28 3b
;
SetupTitleScreen:861b a9 00 LDA #$00
861d 85 cd STA StartGameTrigger
; Tile map: $0800
; Charset : $2000
861f a9 28 LDA #$28
8621 8d 18 d0 STA Vic_MemCtrl
; Setup VIC colour registers.
8624 a2 04 LDX #$04
8626 bd 06 86 LDA TitleModeVICColourRegs,X
8629 9d 20 d0 STA Vic_BorderColour,X
862c ca DEX
862d 10 f7 BPL $8626
;
862f a9 09 LDA #$09
8631 a0 00 LDY #$00
8633 20 e3 6a JSR SetupColourRam
8636 e6 46 INC LocalVar
8638 c6 47 DEC LocalVar+1
863a a9 01 LDA #$01
863c 91 46 STA (LocalVar),Y
863e c8 INY
863f d0 fb BNE $863c
8641 20 a1 83 JSR MakeFirstTwoLinesYellow
8644 a5 a3 LDA TitleScreenInLicenseMode
8646 d0 03 BNE $864b
8648 20 8d 83 JSR MakeF1ScreenControlsLightBlue
864b 20 27 82 JSR SetupTitleScreenText
864e a9 00 LDA #$00
8650 85 cf STA RastInt_FurthestFromTitleIRQRaceCondition
8652 a9 01 LDA #$01
8654 85 ce STA RastInt_IntroScreenFlag
8656 a5 cf LDA RastInt_FurthestFromTitleIRQRaceCondition
8658 f0 fc BEQ $8656
865a a9 00 LDA #$00
865c 8d 00 98 STA MusicDataIndex
865f 8d 01 98 STA MusicLoopedCount
8662 8d 0b 98 STA PlayRevealLevelSoundAndRedefineChar__SFXPhase
8665 8d 0e 98 STA $980e
8668 8d 0f 98 STA $980f
866b 8d 09 98 STA $9809
866e 8d 08 98 STA $9808
8671 8d 11 98 STA $9811
8674 60 RTS
IRQHandler:8675 ad 19 d0 LDA Vic_IntReq
8678 8d 19 d0 STA Vic_IntReq
867b 29 01 AND #$01
867d f0 1e BEQ __IRQHandler__Mandatory_Processing
__IRQHandler__Raster:867f c6 a7 DEC RastIntIsInMarquee
8681 10 04 BPL __IRQHandler__InBody
__IRQHandler__InMarquee:8683 a9 01 LDA #$01
8685 85 a7 STA RastIntIsInMarquee
__IRQHandler__InBody:8687 a6 a7 LDX RastIntIsInMarquee
8689 b5 54 LDA RastInt_vic_control1,X
868b 8d 11 d0 STA Vic_Control1
868e b5 56 LDA RastInt_vic_control2,X
8690 8d 16 d0 STA Vic_Control2
8693 b5 58 LDA RastInt_vic_memory_control,X
8695 8d 18 d0 STA Vic_MemCtrl
8698 b5 5a LDA RastInt_vic_raster_pos,X
869a 8d 12 d0 STA Vic_Raster
__IRQHandler__Mandatory_Processing:869d 20 04 87 JSR Sneaky_Returns_if_no_joystick_action_ELSE_Returns_to_IRQHandler_at_IRQHandler__SneakyEntryPoint
__IRQHandler__ScanKeyboardRow0:86a0 a9 fe LDA #$fe
86a2 8d 00 dc STA Cia1_DataA
86a5 ad 01 dc LDA Cia1_DataB
86a8 c9 ff CMP #$ff
86aa f0 0a BEQ __IRQHandler__ScanKeyboardRow7
__IRQHandler__KeyInScanRow0:86ac c5 fd CMP LastKeyInScanRow0
86ae d0 04 BNE __IRQHandler__KeyInScanRow0ScannedFirstTime
__IRQHandler__KeyInScanRow0ScannedMoreThanOnce:86b0 85 fb STA LastKeyInScanRow0_ScannedMoreThanOnce
86b2 f0 02 BEQ __IRQHandler__ScanKeyboardRow7
__IRQHandler__KeyInScanRow0ScannedFirstTime:86b4 85 fd STA LastKeyInScanRow0
__IRQHandler__ScanKeyboardRow7:86b6 a9 7f LDA #$7f
86b8 8d 00 dc STA Cia1_DataA
86bb ad 01 dc LDA Cia1_DataB
86be c9 ff CMP #$ff
86c0 f0 0a BEQ __IRQHandler__DoneKeyScan
__IRQHandler__KeyInScanRow7:86c2 c5 fe CMP LastKeyInScanRow7
86c4 d0 04 BNE __IRQHandler__KeyInScanRow7ScannedFirstTime
__IRQHandler__KeyInScanRow7ScannedMoreThanOnce:86c6 85 fc STA LastKeyInScanRow7_ScannedMoreThanOnce
86c8 f0 02 BEQ __IRQHandler__DoneKeyScan
__IRQHandler__KeyInScanRow7ScannedFirstTime:86ca 85 fe STA LastKeyInScanRow7
__IRQHandler__DoneKeyScan:86cc 20 04 87 JSR Sneaky_Returns_if_no_joystick_action_ELSE_Returns_to_IRQHandler_at_IRQHandler__SneakyEntryPoint
__IRQHandler__SneakyEntryPoint:86cf a5 ce LDA RastInt_IntroScreenFlag
86d1 c9 01 CMP #$01
86d3 d0 18 BNE $86ed
__IRQHandler__InTitleScreen:86d5 a5 a3 LDA TitleScreenInLicenseMode
86d7 d0 04 BNE $86dd
86d9 a9 28 LDA #$28
86db 85 58 STA RastInt_vic_memory_control
86dd a9 00 LDA #$00
86df 8d 15 d0 STA Vic_SpriteEnable
86e2 a9 18 LDA #$18
86e4 85 56 STA RastInt_vic_control2
86e6 a9 1b LDA #$1b
86e8 85 54 STA RastInt_vic_control1
86ea 20 46 84 JSR TitleIRQActions
86ed a5 ce LDA RastInt_IntroScreenFlag
86ef d0 08 BNE $86f9
__IRQHandler__InGame:86f1 a9 7f LDA #$7f
86f3 8d 15 d0 STA Vic_SpriteEnable
86f6 20 2b 7b JSR GameIRQActions
86f9 a9 00 LDA #$00
86fb 8d 1b d0 STA Vic_SpritePriority
86fe 68 PLA
86ff a8 TAY
8700 68 PLA
8701 aa TAX
8702 68 PLA
8703 40 RTI
Sneaky_Returns_if_no_joystick_action_ELSE_Returns_to_IRQHandler_at_IRQHandler__SneakyEntryPoint:8704 a9 ff LDA #$ff
8706 8d 00 dc STA Cia1_DataA
8709 ad 01 dc LDA Cia1_DataB
870c 29 1f AND #$1f
870e c9 1f CMP #$1f
8710 f0 0f BEQ Sneaky__NoJoystickAction
8712 a9 ff LDA #$ff
8714 85 fb STA LastKeyInScanRow0_ScannedMoreThanOnce
8716 85 fc STA LastKeyInScanRow7_ScannedMoreThanOnce
8718 85 fd STA LastKeyInScanRow0
871a 85 fe STA LastKeyInScanRow7
Sneaky__MessWithStack:871c 68 PLA
871d 68 PLA
871e 4c cf 86 JMP __IRQHandler__SneakyEntryPoint
Sneaky__NoJoystickAction:8721 60 RTS
SetLevel:8722 20 8e 7e JSR BufferLevel
8725 20 ab 7c JSR FillWithDirtAndRandomObjects
8728 20 0f 82 JSR FrameLevelWithSteelWall
872b 20 80 81 JSR ExecuteLevelDrawCommands
872e 20 dc 7e JSR InitGameVariablesFromLevelData
8731 a9 00 LDA #$00
8733 85 ed STA FineScrollDirY
8735 85 ee STA ScrollDirectionY
8737 85 e9 STA FineScrollDirX
8739 85 ea STA ScrollDirectionX
873b 20 fe 77 JSR UncoverCaveScreen
873e a9 00 LDA #$00
8740 85 bd STA PlayRevealLevelSoundAndRedefineCharFlag
8742 20 f4 7c JSR ResetSound
8745 60 RTS
;
InitPlayers:8746 a9 00 LDA #$00
8748 85 9d STA CurrentPlayer
874a 85 a0 STA GameOverFlag
874c a2 05 LDX #$05
874e 95 5f STA ScoreDigits,X
8750 95 4e STA ScoreIncrementDigits,X
8752 ca DEX
8753 10 f9 BPL $874e
8755 a9 03 LDA #$03
8757 85 5c STA Lives
8759 a2 08 LDX #$08
875b b5 5c LDA Lives,X
875d 95 6b STA Player1_Lives,X
875f 95 7a STA Player2_Lives,X
8761 ca DEX
8762 10 f7 BPL $875b
8764 a2 05 LDX #$05
8766 b5 74 LDA Player1_HighScoreChars,X
8768 95 65 STA HighScoreChars,X
876a ca DEX
876b 10 f9 BPL $8766
876d 60 RTS
;
LoseLife:876e c6 5c DEC Lives
8770 a5 9d LDA CurrentPlayer
8772 d0 0b BNE __LoseLife__BackupPlayer2__
__LoseLife__BackupPlayer1__:; $5c-$6a to $6b-$79
8774 a2 0e LDX #$0e
8776 b5 5c LDA Lives,X
8778 95 6b STA Player1_Lives,X
877a ca DEX
877b 10 f9 BPL $8776
877d 30 09 BMI __LoseLife__NextPlayer__
; NOTE: Branch above always taken.
__LoseLife__BackupPlayer2__:; $5c-$6a to $7a-$88
877f a2 0e LDX #$0e
8781 b5 5c LDA Lives,X
8783 95 7a STA Player2_Lives,X
8785 ca DEX
8786 10 f9 BPL $8781
__LoseLife__NextPlayer__:; Player switched if multiplayer game and other player has lives left.
8788 a5 9e LDA NumPlayerMinusOne
878a f0 13 BEQ __LoseLife__RestoreNewPlayer__
878c a5 9d LDA CurrentPlayer
878e d0 09 BNE $8799
8790 a5 7a LDA Player2_Lives
8792 f0 0b BEQ __LoseLife__RestoreNewPlayer__
8794 e6 9d INC CurrentPlayer
8796 4c 9f 87 JMP __LoseLife__RestoreNewPlayer__
8799 a5 6b LDA Player1_Lives
879b f0 02 BEQ __LoseLife__RestoreNewPlayer__
879d c6 9d DEC CurrentPlayer
__LoseLife__RestoreNewPlayer__:879f a5 9d LDA CurrentPlayer
87a1 d0 0b BNE __LoseLife__RestorePlayer2__
__LoseLife__RestorePlayer1__:87a3 a2 0e LDX #$0e
87a5 b5 6b LDA Player1_Lives,X
87a7 95 5c STA Lives,X
87a9 ca DEX
87aa 10 f9 BPL $87a5
87ac 30 09 BMI __LoseLife__CheckIfGameOver__
; NOTE: Branch above always taken.
__LoseLife__RestorePlayer2__:87ae a2 0e LDX #$0e
87b0 b5 7a LDA Player2_Lives,X
87b2 95 5c STA Lives,X
87b4 ca DEX
87b5 10 f9 BPL $87b0
__LoseLife__CheckIfGameOver__:; Since we only switch to a player that has a non-zero life count a count
; of zero means all players are dead.
87b7 a5 5c LDA Lives
87b9 d0 0c BNE __LoseLife__Exit__
87bb a9 01 LDA #$01
87bd 85 a0 STA GameOverFlag
87bf a9 03 LDA #$03
87c1 85 5c STA Lives
87c3 a9 00 LDA #$00
87c5 85 9d STA CurrentPlayer
__LoseLife__Exit__:87c7 60 RTS
;
ScoreTimeRemainingSound:87c8 c6 03 DEC __CoverLevel__LineAddressTable+1
87ca a2 0f LDX #$0f
;
__ScoreTimeRemainingSound__Loop:; Voice 3: Triangle waveform, Gate bit off.
87cc a9 10 LDA #$10
87ce 8d 12 d4 STA Sid_Voice3Ctrl
;
87d1 86 02 STX __CoverLevel__LineAddressTable
87d3 06 02 ASL __CoverLevel__LineAddressTable
87d5 a5 03 LDA __CoverLevel__LineAddressTable+1
87d7 38 SEC
87d8 e5 02 SBC __CoverLevel__LineAddressTable
87da 8d 0f d4 STA Sid_Voice3FreqHi
87dd a9 a0 LDA #$a0
87df 8d 14 d4 STA Sid_Voice3SustainRelease
87e2 a9 00 LDA #$00
87e4 8d 13 d4 STA Sid_Voice3AttackDecay
; Voice 3: Triangle waveform, Gate bit ON.
87e7 a9 11 LDA #$11
87e9 8d 12 d4 STA Sid_Voice3Ctrl
;
87ec a0 c0 LDY #$c0
87ee 88 DEY
87ef d0 fd BNE $87ee
87f1 ca DEX
87f2 d0 d8 BNE __ScoreTimeRemainingSound__Loop
; Voice 3: Triangle waveform, Gate bit off.
87f4 a9 10 LDA #$10
87f6 8d 12 d4 STA Sid_Voice3Ctrl
;
87f9 60 RTS
;
UpdateHighScoreIfNeeded:87fa a9 00 LDA #$00
87fc aa TAX
87fd 85 a1 STA UpdateHighScoreIfNeeded_NeedsUpdating
87ff b5 65 LDA HighScoreChars,X
8801 dd 48 98 CMP ScoreChars,X
8804 f0 08 BEQ $880e
8806 a2 05 LDX #$05
8808 b0 04 BCS $880e
880a a9 01 LDA #$01
880c 85 a1 STA UpdateHighScoreIfNeeded_NeedsUpdating
880e e8 INX
880f e0 06 CPX #$06
8811 d0 ec BNE $87ff
8813 a5 a1 LDA UpdateHighScoreIfNeeded_NeedsUpdating
8815 f0 0a BEQ $8821
8817 a2 05 LDX #$05
8819 bd 48 98 LDA ScoreChars,X
881c 95 65 STA HighScoreChars,X
881e ca DEX
881f 10 f8 BPL $8819
8821 60 RTS
;
StashScores:8822 a2 05 LDX #$05
8824 b5 74 LDA Player1_HighScoreChars,X
8826 9d 27 98 STA $9827,X
8829 b5 83 LDA Player2_HighScoreChars,X
882b 9d 33 98 STA $9833,X
882e b5 6e LDA Player1_ScoreDigits,X
8830 18 CLC
8831 69 10 ADC #$10
8833 9d 13 98 STA $9813,X
8836 b5 7d LDA Player2_ScoreDigits,X
8838 69 10 ADC #$10
883a 9d 1f 98 STA $981f,X
883d ca DEX
883e 10 e4 BPL $8824
8840 60 RTS
;
NextCave:8841 a5 5d LDA Cave
8843 0a ASL A
8844 aa TAX
8845 bd 64 7e LDA LevelSequenceAndBonusLevelStatusArray-2,X
8848 c9 15 CMP #$15
884a d0 0a BNE $8856
884c a5 5e LDA Level
884e c9 04 CMP #$04
8850 f0 02 BEQ $8854
8852 e6 5e INC Level
8854 a9 01 LDA #$01
8856 85 5d STA Cave
8858 60 RTS
;
CaveComplete:; Set the score increment to zero.
8859 a2 00 LDX #$00
885b a9 00 LDA #$00
885d 95 4e STA ScoreIncrementDigits,X
885f e8 INX
8860 e0 06 CPX #$06
8862 d0 f9 BNE $885d
; .Level is one less than the actual level as displayed in the game.
; We add one to compensate for this discrepancy and store the result
; in the last digit of .ScoreIncrementDigits.
8864 a5 5e LDA Level
8866 18 CLC
8867 69 01 ADC #$01
8869 85 53 STA ScoreIncrementDigits+5
886b a9 00 LDA #$00
886d 85 97 STA ExitCaveFlag
886f 85 02 STA __CoverLevel__LineAddressTable
8871 a9 d0 LDA #$d0
8873 85 03 STA __CoverLevel__LineAddressTable+1
8875 20 8c 70 JSR CheckIfLevelTimeIsUp
8878 20 f4 7c JSR ResetSound
; When you complete a cave you get .Level+1 (.Level is 0 for level 1)
; points for every second remaining.
__CaveComplete__ScoreTimeRemainingLoop:887b a5 97 LDA ExitCaveFlag
887d d0 0b BNE $888a
887f 20 c5 70 JSR GameSecondTick
8882 20 5d 70 JSR IncrementScore
8885 20 c8 87 JSR ScoreTimeRemainingSound
; Branch always taken!
8888 d0 f1 BNE __CaveComplete__ScoreTimeRemainingLoop
;
888a 20 9d 70 JSR TimeRunningOutFX
888d 20 0c 7d JSR FourDelays
8890 20 f4 7c JSR ResetSound
8893 20 41 88 JSR NextCave
8896 60 RTS
;
KillPlayer:8897 20 fa 87 JSR UpdateHighScoreIfNeeded
889a 20 6e 87 JSR LoseLife
889d a5 a0 LDA GameOverFlag
889f f0 09 BEQ $88aa
88a1 a9 00 LDA #$00
88a3 85 5d STA Cave
88a5 85 5e STA Level
88a7 20 22 88 JSR StashScores
88aa 60 RTS
; Exiting a cave happens when the player is killed, when time runs out
; or when the level is completed.
PerformCaveExitAction:88ab a2 01 LDX #$01
88ad 86 9b STX SecondsDontPass
88af a5 9f LDA EnteredOutboxFlag
88b1 f0 06 BEQ __PerformCaveExitAction__NotComplete
__PerformCaveExitAction__Complete:88b3 20 59 88 JSR CaveComplete
88b6 4c c6 88 JMP __PerformCaveExitAction__CaveExitActions
__PerformCaveExitAction__NotComplete:88b9 a5 a6 LDA IsBonusLevelFlag
88bb f0 06 BEQ __PerformCaveExitAction__NotBonusLevel
__PerformCaveExitAction__BonusLevel:88bd 20 41 88 JSR NextCave
88c0 4c c6 88 JMP __PerformCaveExitAction__CaveExitActions
__PerformCaveExitAction__NotBonusLevel:88c3 20 97 88 JSR KillPlayer
__PerformCaveExitAction__CaveExitActions:88c6 a5 a2 LDA IsDemoMode
88c8 d0 2c BNE __PerformCaveExitAction__DemoMode
__PerformCaveExitAction__NotDemoMode:; .CurrentPlayer is updated via the call to .KillPlayer above.
88ca a5 9d LDA CurrentPlayer
88cc 18 CLC
88cd 69 11 ADC #$11
88cf 8d 55 98 STA $9855
; .Lives is updated via the call to .KillPlayer above.
88d2 a5 5c LDA Lives
88d4 18 CLC
88d5 69 10 ADC #$10
88d7 8d 58 98 STA $9858
88da aa TAX
; $25 is the letter 'e'.
88db a9 25 LDA #$25
88dd e0 11 CPX #$11
88df d0 02 BNE $88e3
__PerformCaveExitAction__OneLifeLeft:; $21 is the letter 'a'.
88e1 a9 21 LDA #$21
; Patch the play info buffer: 'man' for one life and 'men' for more.
88e3 8d 5b 98 STA $985b
; Cave and level, .Cave is updated in call the .NextCave above.
88e6 a5 5d LDA Cave
88e8 18 CLC
88e9 69 20 ADC #$20
88eb 8d 5e 98 STA $985e
88ee a5 5e LDA Level
88f0 18 CLC
88f1 69 11 ADC #$11
88f3 8d 60 98 STA $9860
__PerformCaveExitAction__DemoMode:88f6 a9 00 LDA #$00
88f8 85 94 STA EnableSomeSFXAndMarqueeUpdates
88fa 60 RTS
;
RunCave:88fb 20 d9 7d JSR ProcessCave
88fe a5 97 LDA ExitCaveFlag
8900 f0 f9 BEQ RunCave
8902 20 f4 7c JSR ResetSound
8905 20 ab 88 JSR PerformCaveExitAction
8908 a5 a8 LDA ExtraLifeFXCounter
890a d0 fc BNE $8908
890c 8d 08 98 STA $9808
890f 8d 11 98 STA $9811
8912 60 RTS
;
DemoModeRunCave:8913 a9 00 LDA #$00
8915 85 d3 STA DemoMoveDataIndex
8917 85 d4 STA ExitDemoModeFlag
8919 85 d2 STA DemoMoveRepeatCount
__DemoModeRunCave__Loop:891b a5 d2 LDA DemoMoveRepeatCount
891d d0 1b BNE __DemoModeRunCave__RepeatMove
891f a6 d3 LDX DemoMoveDataIndex
8921 bd a8 5e LDA DemoMoveData,X
8924 85 d2 STA DemoMoveRepeatCount
8926 29 0f AND #$0f
8928 85 8b STA JoystickStatus
892a d0 04 BNE $8930
892c a9 01 LDA #$01
892e 85 d4 STA ExitDemoModeFlag
8930 46 d2 LSR DemoMoveRepeatCount
8932 46 d2 LSR DemoMoveRepeatCount
8934 46 d2 LSR DemoMoveRepeatCount
8936 46 d2 LSR DemoMoveRepeatCount
8938 e6 d3 INC DemoMoveDataIndex
__DemoModeRunCave__RepeatMove:893a 20 74 6b JSR ReadFireButtonPort1
893d d0 04 BNE $8943
893f a9 01 LDA #$01
8941 85 d4 STA ExitDemoModeFlag
8943 a5 d4 LDA ExitDemoModeFlag
8945 d0 08 BNE __DemoModeRunCave__Exit
8947 20 d9 7d JSR ProcessCave
894a c6 d2 DEC DemoMoveRepeatCount
894c 4c 1b 89 JMP __DemoModeRunCave__Loop
__DemoModeRunCave__Exit:894f 20 f4 7c JSR ResetSound
8952 a5 9f LDA EnteredOutboxFlag
8954 f0 03 BEQ $8959
8956 20 ab 88 JSR PerformCaveExitAction
8959 a9 00 LDA #$00
895b 85 5d STA Cave
895d 60 RTS
;
ResetLastAndHighScoresAndPlayerInfoText:895e a2 13 LDX #$13
__ResetLastAndHighScoresAndPlayerInfoText__Loop:8960 bd cc 6b LDA Text_LastScores,X
8963 9d 12 98 STA CurrentHighScoreText,X
8966 bd e0 6b LDA Text_HighScores,X
8969 9d 26 98 STA CurrentLastScoreText,X
; $20 is a space.
; Here's an example of contents during game: .12?10.00.147.000010
896c a9 20 LDA #$20
896e 9d 3a 98 STA CurrentPlayerScoresText,X
8971 ca DEX
8972 10 ec BPL __ResetLastAndHighScoresAndPlayerInfoText__Loop
; $3c is a diamond.
8974 a9 3c LDA #$3c
8976 8d 3d 98 STA $983d
8979 60 RTS
;
InitAll:; $0c00-$0c27 = 0x20
; Set the first line of the 1st in-game tilemap to spaces.
897a a2 28 LDX #$28
897c a9 20 LDA #$20
_InitBlankTopLine:897e 9d ff 0b STA $0bff,X
8981 ca DEX
8982 d0 fa BNE _InitBlankTopLine
;
8984 a9 60 LDA #$60
_InitBlankRestOfScreen:8986 9d 28 0c STA GameTileMap1_or_TitleTextTileMap+$28,X
8989 9d 00 0d STA GameTileMap1_or_TitleTextTileMap+$100,X
898c 9d 00 0e STA GameTileMap1_or_TitleTextTileMap+$200,X
898f 9d 00 0f STA GameTileMap1_or_TitleTextTileMap+$300,X
8992 9d 00 2c STA GameTileMap2,X
8995 9d 00 2d STA GameTileMap2+$100,X
8998 9d 00 2e STA GameTileMap2+$200,X
899b 9d 00 2f STA GameTileMap2+$300,X
899e e8 INX
899f d0 e5 BNE _InitBlankRestOfScreen
_InitCopyCharsAndTheme:89a1 bd 00 50 LDA TitleCharData,X
89a4 9d 00 20 STA CopiedTitleChar,X
89a7 bd 00 51 LDA TitleCharData+$100,X
89aa 9d 00 21 STA CopiedTitleChar+$100,X
89ad bd 00 52 LDA TitleCharData+$200,X
89b0 9d 00 22 STA CopiedTitleChar+$200,X
89b3 bd 00 53 LDA TitleCharData+$300,X
89b6 9d 00 23 STA CopiedTitleChar+$300,X
; MusicData $5fe8-$60e7 copied to $3000-$30ff
; GameCharData $60e8-$63e7 copied to $3100-$33ff
; That's a combined total of 1k
89b9 bd e8 5f LDA MusicData,X
89bc 9d 00 30 STA CopiedMusicData,X
89bf bd e8 60 LDA GameCharData,X
89c2 9d 00 31 STA CopiedGameCharData,X
89c5 bd e8 61 LDA GameCharData+$100,X
89c8 9d 00 32 STA CopiedGameCharData+$100,X
89cb bd e8 62 LDA GameCharData+$200,X
89ce 9d 00 33 STA CopiedGameCharData+$200,X
89d1 e8 INX
89d2 d0 cd BNE _InitCopyCharsAndTheme
; $3770-$3797 to $ff
; $3798-$37bf to $00
; Sprite data is at $3780-$37be
; Sets the first 8 lines to solid & and last 13 transparent.
; NOTE: Writes both before and after the sprite data.
89d4 a2 27 LDX #$27
89d6 a9 ff LDA #$ff
89d8 9d 70 37 STA $3770,X
89db a9 00 LDA #$00
89dd 9d 98 37 STA $3798,X
89e0 ca DEX
89e1 10 f3 BPL $89d6
; Set all sprite pointers in both tilemaps to $3780.
89e3 a2 07 LDX #$07
89e5 a9 de LDA #$de
89e7 9d f8 0f STA $0ff8,X
89ea 9d f8 2f STA $2ff8,X
89ed a9 00 LDA #$00
89ef 9d 27 d0 STA Vic_SpriteColour0,X
89f2 ca DEX
89f3 10 f0 BPL $89e5
; Position the sprites.
; NOTE: Note sprite Y position is raster line minus 1.
89f5 a0 0c LDY #$0c
89f7 a9 37 LDA #$37
89f9 99 00 d0 STA Vic_Sprite0X,Y
89fc aa TAX
89fd a9 3a LDA #$3a
89ff 99 01 d0 STA Vic_Sprite0Y,Y
8a02 8a TXA
8a03 38 SEC
8a04 e9 30 SBC #$30
8a06 88 DEY
8a07 88 DEY
8a08 10 ef BPL $89f9
8a0a a9 ff LDA #$ff
8a0c 8d 1d d0 STA Vic_SpriteExpandX
8a0f a9 60 LDA #$60
8a11 8d 10 d0 STA Vic_SpriteMsbX
8a14 60 RTS
;
InitGameState:8a15 20 f4 7c JSR ResetSound
8a18 a2 ff LDX #$ff
8a1a 86 99 STX UnpackedCaveNumber
8a1c 86 ce STX RastInt_IntroScreenFlag
8a1e 86 fb STX LastKeyInScanRow0_ScannedMoreThanOnce
8a20 86 fc STX LastKeyInScanRow7_ScannedMoreThanOnce
8a22 86 fd STX LastKeyInScanRow0
8a24 86 fe STX LastKeyInScanRow7
8a26 e8 INX
; X=0
8a27 86 e7 STX FineScrollX
8a29 86 e8 STX ScreenLeft
8a2b 86 eb STX FineScrollY
8a2d 86 ec STX ScreenTop
8a2f 86 a5 STX WhiteFlashWhiteCount
8a31 86 5d STX Cave
8a33 86 5e STX Level
8a35 86 c0 STX AnimationFrameTimes8
8a37 86 c1 STX TitleScreenFrameCountMod4
8a39 86 e3 STX YScrollTableIndex
8a3b 86 e4 STX YCoarseScrollDirFlag
8a3d 86 e1 STX XScrollTableIndex
8a3f 86 e2 STX XCoarseScrollDirFlag
8a41 86 d8 STX SFXTrigger_DiamondQuotaReachedOrEntryBoxExplode
8a43 86 d9 STX SFXTimer_DiamondQuotaReachedOrEntryBoxExplode
8a45 e8 INX
; X=1
8a46 86 cc STX ForceCreditsMode
8a48 86 a2 STX IsDemoMode
8a4a 86 a3 STX TitleScreenInLicenseMode
; Clumsily .InitGameState::DoOneTimeInit is not initialised by
; the game. BD relies on the fact that the C64's OS uses this
; as the current line length minus one and thus when the game
; starts it is never zero.
8a4c a5 d5 LDA InitGameState__DoOneTimeInit
8a4e f0 30 BEQ __InitGameState__Exit
__InitGameState__OneTimeInit:8a50 a2 04 LDX #$04
8a52 a9 00 LDA #$00
8a54 9d 20 d0 STA Vic_BorderColour,X
8a57 ca DEX
8a58 10 fa BPL $8a54
8a5a a2 00 LDX #$00
8a5c a9 10 LDA #$10
8a5e 95 74 STA Player1_HighScoreChars,X
8a60 95 83 STA Player2_HighScoreChars,X
8a62 95 65 STA HighScoreChars,X
8a64 e8 INX
8a65 e0 06 CPX #$06
8a67 d0 f5 BNE $8a5e
8a69 a9 00 LDA #$00
8a6b 85 d5 STA InitGameState__DoOneTimeInit
8a6d 85 a4 STA NumJoysticksMinusOne
8a6f 85 9e STA NumPlayerMinusOne
8a71 85 a8 STA ExtraLifeFXCounter
8a73 20 39 74 JSR BlankLines0and4ofSpaceChars
8a76 a9 01 LDA #$01
8a78 85 d0 STA NumPlayersAndJoysticksState
8a7a 20 5e 89 JSR ResetLastAndHighScoresAndPlayerInfoText
8a7d 20 7a 89 JSR InitAll
__InitGameState__Exit:8a80 60 RTS
;
RasterSetTitleMode:8a81 a9 3c LDA #$3c
8a83 8d 07 98 STA BackBufferVICMemControl
8a86 20 db 76 JSR FillInflatedCaveWithScrollingSteelWallChar
8a89 78 SEI
8a8a a2 07 LDX #$07
8a8c bd 0b 86 LDA RastIntTitleModeVICRegs,X
8a8f 95 54 STA RastInt_vic_control1,X
8a91 ca DEX
8a92 10 f8 BPL $8a8c
8a94 a2 01 LDX #$01
8a96 8e 1a d0 STX Vic_IntMask
8a99 e8 INX
8a9a 86 a7 STX RastIntIsInMarquee
8a9c a9 28 LDA #$28
8a9e 8d 12 d0 STA Vic_Raster
; Extended Color Text Mode : Off
; Bit Map Mode : Off
; 25 rows : On
8aa1 a9 18 LDA #$18
8aa3 8d 11 d0 STA Vic_Control1
;
8aa6 a9 75 LDA #<IRQHandler
8aa8 8d 14 03 STA Krnl_IrqLo
8aab a9 86 LDA #>IRQHandler
8aad 8d 15 03 STA Krnl_IrqHi
8ab0 58 CLI
8ab1 60 RTS
NMIHandler:8ab2 58 CLI
; Main entry point.
Main:; Setup stack.
8ab3 a2 ff LDX #$ff
8ab5 9a TXS
; Turn off all CIA interrupts.
8ab6 a9 7f LDA #$7f
8ab8 8d 0d dc STA Cia1_IntCtrl
8abb 8d 0d dd STA Cia2_IntCtrl
;
8abe a9 ff LDA #$ff
8ac0 8d 04 dc STA Cia1_TimerALo
8ac3 8d 05 dc STA Cia1_TimerAHi
8ac6 a9 a0 LDA #$a0
8ac8 8d 04 dd STA Cia2_TimerALo
8acb 8d 05 dd STA Cia2_TimerAHi
8ace a9 68 LDA #$68
8ad0 8d 06 dd STA Cia2_TimerBLo
8ad3 8d 07 dd STA Cia2_TimerBHi
8ad6 a9 17 LDA #$17
8ad8 8d 0e dd STA Cia2_CtrlA
8adb 8d 0f dd STA Cia2_CtrlB
; Make NMI (RUN-STOP+RESTORE or cartridge) restart game.
8ade 78 SEI
8adf a9 b2 LDA #<NMIHandler
8ae1 8d 18 03 STA Krnl_NmiLo
8ae4 a9 8a LDA #>NMIHandler
8ae6 8d 19 03 STA Krnl_NmiHi
8ae9 58 CLI
; I/O area visible at $D000-$DFFF
; RAM visible at $A000-$BFFF
; KERNAL ROM visible at $E000-$FFFF
8aea a9 36 LDA #$36
8aec 85 01 STA Zp_6510IO
;
8aee 20 15 8a JSR InitGameState
8af1 a9 08 LDA #$08
8af3 8d 0a 98 STA $980a
; Move 7b58-7d57 to 9e00-9fff.
8af6 a0 00 LDY #$00
8af8 a2 58 LDX #<CopyInflatedCaveSubsetToBackBuffer
8afa 86 02 STX __CoverLevel__LineAddressTable
8afc 86 04 STX __CoverLevel__LineAddressTable+2
8afe a2 7b LDX #>CopyInflatedCaveSubsetToBackBuffer
8b00 86 03 STX __CoverLevel__LineAddressTable+1
8b02 e8 INX
8b03 86 05 STX __CoverLevel__LineAddressTable+3
8b05 b1 02 LDA (__CoverLevel__LineAddressTable),Y
8b07 99 00 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer,Y
8b0a b1 04 LDA (__CoverLevel__LineAddressTable+2),Y
8b0c 99 00 9f STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$100,Y
8b0f c8 INY
8b10 d0 f3 BNE $8b05
;
8b12 a9 03 LDA #<InflatedCave
8b14 85 d6 STA InflatedCaveSubset
8b16 a9 40 LDA #>InflatedCave
8b18 85 d7 STA InflatedCaveSubset+1
; Moves 20 bytes from .Pre_level_Marquee_Text to $984e ($6c08-$6c1b to $984e-$9861).
8b1a a2 13 LDX #$13
8b1c bd 08 6c LDA Pre_level_Marquee_Text,X
8b1f 9d 4e 98 STA CurrentPlayerInfoText,X
8b22 ca DEX
8b23 10 f7 BPL $8b1c
;
8b25 a9 10 LDA #$10
8b27 a2 05 LDX #$05
8b29 9d 48 98 STA ScoreChars,X
8b2c ca DEX
8b2d 10 fa BPL $8b29
;
Main__BEGIN__Is_Level_Zero:8b2f a5 5d LDA Cave
8b31 d0 27 BNE Main__Level_Not_Zero
Main__Level_Is_Zero:8b33 a9 a0 LDA #$a0
8b35 8d 0c 98 STA MusicTickRoutine__Voice1SustainLevel
8b38 20 81 8a JSR RasterSetTitleMode
8b3b 20 1b 86 JSR SetupTitleScreen
8b3e 20 9b 85 JSR RunTitleScreen
8b41 a2 00 LDX #$00
8b43 a9 7c LDA #$7c
8b45 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
8b48 9d 00 0d STA GameTileMap1_or_TitleTextTileMap+$100,X
8b4b 9d 00 0e STA GameTileMap1_or_TitleTextTileMap+$200,X
8b4e 9d f8 0e STA GameTileMap1_or_TitleTextTileMap+$2f8,X
8b51 e8 INX
8b52 d0 f1 BNE $8b45
8b54 20 46 87 JSR InitPlayers
8b57 4c 7a 8b JMP Main__ClearSpaceChar
Main__Level_Not_Zero:8b5a 20 22 87 JSR SetLevel
8b5d a9 11 LDA #$11
8b5f 8d 7c 98 STA $987c
8b62 a5 a2 LDA IsDemoMode
8b64 f0 0a BEQ $8b70
8b66 20 13 89 JSR DemoModeRunCave
8b69 a9 00 LDA #$00
8b6b 85 a3 STA TitleScreenInLicenseMode
8b6d 4c 77 8b JMP $8b77
8b70 20 fb 88 JSR RunCave
8b73 a9 00 LDA #$00
8b75 85 42 STA AmeobaCouldGrowThisTick
8b77 20 2e 80 JSR PostCaveRunActions
Main__ClearSpaceChar:8b7a a2 07 LDX #$07
8b7c a9 00 LDA #$00
Main__ClearSpaceCharLoop:8b7e 9d 00 20 STA CopiedTitleChar,X
8b81 ca DEX
8b82 10 fa BPL Main__ClearSpaceCharLoop
8b84 30 a9 BMI Main__BEGIN__Is_Level_Zero
PartialSymbolTable:8b86 20 20 a8 00 d5 81 79 00 3a 53 4b 34 20 20 a8 00
8b96 e2 81 79 00 3a 4c 50 58 20 20 a8 00 ec 81 79 00
8ba6 3a 45 58 49 54 20 a8 00 ef 81 79 00 4f 50 54 49
8bb6 4f 4e a8 00 f0 81 00 00 3a 45 58 49 54 20 a8 00
8bc6 0e 82 7a 00 4f 55 54 57 41 4c a8 00 0f 82 00 00
8bd6 54 54 53 43 45 4e a8 00 27 82 00 00 3a 4c 4f 4f
8be6 50 31 a8 00 29 82 7c 00 3a 4c 4f 4f 50 34 a8 00
8bf6 4e 82 7c 00 3a 4c 4f 4f 50 35 a8 00 65 82 7c 00
8c06 3a 4c 4f 4f 50 36 a8 00 7c 82 7c 00 3a 53 4b 31
8c16 20 20 a8 00 92 82 7c 00 3a 4c 4f 4f 50 37 a8 00
8c26 96 82 7c 00 3a 4c 4f 4f 50 38 a8 00 ad 82 7c 00
8c36 3a 4c 4f 4f 50 39 a8 00 c4 82 7c 00 3a 53 4b 32
8c46 20 20 a8 00 d7 82 7c 00 3a 4c 4f 4f 50 41 a8 00
8c56 db 82 7c 00 3a 4c 4f 4f 50 42 a8 00 f2 82 7c 00
8c66 46 52 45 51 20 20 a8 00 03 83 00 00 3a 4c 4f 4f
8c76 50 43 a8 00 09 83 7c 00 42 4c 55 45 20 20 a8 00
8c86 8d 83 00 00 3a 53 4b 30 20 20 a8 00 91 83 7d 00
8c96 59 45 4c 4c 4f 57 a8 00 a1 83 00 00 3a 53 4b 30
8ca6 20 20 a8 00 a5 83 7e 00 4d 55 53 50 4c 59 a8 00
8cb6 ac 83 00 00 3a 53 4b 30 20 20 a8 00 b3 83 7f 00
8cc6 3a 53 4b 31 20 20 a8 00 fd 83 7f 00 3a 45 58 49
8cd6 54 20 a8 00 2d 84 7f 00 4d 41 53 51 55 45 a8 00
8ce6 2e 84 00 00 3a 4c 4f 4f 50 20 a8 00 23 55 31 3a
8cf6 35 2c 30 2c 31 38 2c 31 38 20 e7 ff a9 00 20 bd
8d06 ff a9 0f a2 08 a0 0f 20 ba ff 20 c0 ff a9 01 a2
8d16 f2 a0 8c 20 bd ff a9 05 a2 08 a0 05 20 ba ff 20
8d26 c0 ff a2 0f 20 c9 ff a2 00 bd f3 8c 20 d2 ff e8
8d36 e0 0c d0 f5 20 cc ff a2 0f 20 c6 ff a2 00 20 cf
8d46 ff c9 32 d0 1f 20 cf ff c9 33 d0 18 a0 14 20 cf
8d56 ff 88 d0 fa a9 05 20 c3 ff a9 0f 20 c3 ff 20 cc
8d66 ff 4c b3 8a a9 70 85 fb a9 00 85 fa aa a8 91 fa
8d76 c8 d0 fb e8 e0 20 d0 f6 4c b3 8a 55 00 ff 00 50
8d86 00 ff ef ff 00 ff 00 ff 00 00 00 00 00 00 00 00
8d96 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8da6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8db6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8dc6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8dd6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8de6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8df6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8e06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8e16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8e26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8e36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8e46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8e56 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8e66 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8e76 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8e86 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8e96 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8ea6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8eb6 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff
8ec6 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
8ed6 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
8ee6 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
8ef6 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00
8f06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8f16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8f26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8f36 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff
8f46 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
8f56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
8f66 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
8f76 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00
8f86 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8f96 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8fa6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8fb6 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff
8fc6 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
8fd6 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
8fe6 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
8ff6 ff ff ff ff ff ff ff ff ff ff
MOVEDCopyInflatedCaveSubsetToBackBuffer:9e00 a5 d6 LDA InflatedCaveSubset
9e02 18 CLC
9e03 69 20 ADC #$20
9e05 8d 51 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$51
9e08 a5 d7 LDA InflatedCaveSubset+1
9e0a 69 03 ADC #$03
9e0c 8d 52 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$52
9e0f ad 07 98 LDA BackBufferVICMemControl
9e12 4a LSR A
9e13 4a LSR A
9e14 49 03 EOR #$03
9e16 18 CLC
9e17 69 01 ADC #$01
9e19 8d 55 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$55
9e1c a9 b8 LDA #$b8
9e1e 8d 54 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$54
9e21 a2 00 LDX #$00
9e23 bd 51 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$51,X
9e26 18 CLC
9e27 69 50 ADC #$50
9e29 9d 57 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$57,X
9e2c bd 52 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$52,X
9e2f 69 00 ADC #$00
9e31 9d 58 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$58,X
9e34 bd 54 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$54,X
9e37 18 CLC
9e38 69 28 ADC #$28
9e3a 9d 5a 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$5a,X
9e3d bd 55 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$55,X
9e40 69 00 ADC #$00
9e42 9d 5b 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$5b,X
9e45 8a TXA
9e46 18 CLC
9e47 69 06 ADC #$06
9e49 aa TAX
9e4a e0 4e CPX #$4e
9e4c 90 d5 BCC MOVEDCopyInflatedCaveSubsetToBackBuffer+$23
9e4e a2 27 LDX #$27
9e50 bd 00 50 LDA TitleCharData,X
9e53 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9e56 bd 00 50 LDA TitleCharData,X
9e59 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9e5c bd 00 50 LDA TitleCharData,X
9e5f 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9e62 bd 00 50 LDA TitleCharData,X
9e65 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9e68 bd 00 50 LDA TitleCharData,X
9e6b 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9e6e bd 00 50 LDA TitleCharData,X
9e71 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9e74 bd 00 50 LDA TitleCharData,X
9e77 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9e7a bd 00 50 LDA TitleCharData,X
9e7d 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9e80 bd 00 50 LDA TitleCharData,X
9e83 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9e86 bd 00 50 LDA TitleCharData,X
9e89 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9e8c bd 00 50 LDA TitleCharData,X
9e8f 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9e92 bd 00 50 LDA TitleCharData,X
9e95 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9e98 bd 00 50 LDA TitleCharData,X
9e9b 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9e9e bd 00 50 LDA TitleCharData,X
9ea1 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9ea4 ca DEX
9ea5 10 a9 BPL MOVEDCopyInflatedCaveSubsetToBackBuffer+$50
9ea7 ad 07 98 LDA BackBufferVICMemControl
9eaa 4a LSR A
9eab 4a LSR A
9eac 49 03 EOR #$03
9eae 8d f4 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f4
9eb1 a9 28 LDA #$28
9eb3 8d f3 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f3
9eb6 a5 d6 LDA InflatedCaveSubset
9eb8 8d f0 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f0
9ebb a5 d7 LDA InflatedCaveSubset+1
9ebd 8d f1 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f1
9ec0 a2 00 LDX #$00
9ec2 bd f0 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f0,X
9ec5 18 CLC
9ec6 69 50 ADC #$50
9ec8 9d f6 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f6,X
9ecb bd f1 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f1,X
9ece 69 00 ADC #$00
9ed0 9d f7 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f7,X
9ed3 bd f3 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f3,X
9ed6 18 CLC
9ed7 69 28 ADC #$28
9ed9 9d f9 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f9,X
9edc bd f4 9e LDA MOVEDCopyInflatedCaveSubsetToBackBuffer+$f4,X
9edf 69 00 ADC #$00
9ee1 9d fa 9e STA MOVEDCopyInflatedCaveSubsetToBackBuffer+$fa,X
9ee4 8a TXA
9ee5 18 CLC
9ee6 69 06 ADC #$06
9ee8 aa TAX
9ee9 e0 36 CPX #$36
9eeb 90 d5 BCC MOVEDCopyInflatedCaveSubsetToBackBuffer+$c2
9eed a2 27 LDX #$27
9eef bd 00 50 LDA TitleCharData,X
9ef2 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9ef5 bd 00 50 LDA TitleCharData,X
9ef8 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9efb bd 00 50 LDA TitleCharData,X
9efe 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9f01 bd 00 50 LDA TitleCharData,X
9f04 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9f07 bd 00 50 LDA TitleCharData,X
9f0a 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9f0d bd 00 50 LDA TitleCharData,X
9f10 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9f13 bd 00 50 LDA TitleCharData,X
9f16 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9f19 bd 00 50 LDA TitleCharData,X
9f1c 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9f1f bd 00 50 LDA TitleCharData,X
9f22 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9f25 bd 00 50 LDA TitleCharData,X
9f28 9d 50 0c STA GameTileMap1_or_TitleTextTileMap+$50,X
9f2b ca DEX
9f2c 10 c1 BPL MOVEDCopyInflatedCaveSubsetToBackBuffer+$ef
9f2e 20 f7 7a JSR Animate
9f31 a5 a8 LDA ExtraLifeFXCounter
9f33 f0 03 BEQ MOVEDCopyInflatedCaveSubsetToBackBuffer+$138
9f35 20 54 74 JSR ExtraLifeFX
9f38 60 RTS