1 some notes about the internal workings of the original games.
7 Boulder dash 1 engine on atari:
9 second cave from 0x3559 delta=0x31
10 third from 35b2 delta=8a
12 CAVE POINTERS (relative to 0x3528) at 0x3500
13 There is no animaion switch table.
16 $16 amoeba color (couldn't set in c64 - so there unused)
17 $17 background color (was always black in c64 - so there unused)
20 Boulder dash 2 engine on atari:
21 cavepointers at 0x86b0
22 color pointers at 0x86d8
24 colors: 5 bytes for each, color1, 2, 3, amoeba, background.
29 construction kit: works the same way as on c64.
32 in atari plck, slime and amoeba could not coexist in the same cave.
33 if amoeba was used, the graphics turned to green, and data at 0x1e1 was set to 0xd4.
34 if slime was used, graphics to blue, and data at 0x1e1 was set to 0x72.
35 these two colors could not be changed in the editor at all.
36 (maybe they could have been changed in a hex editor)
40 6FE0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
41 6FF0: AB AB AB AB 4A 41 49 4C 2E 43 41 56 9B 20 20 20 ....JAIL.CAV.
42 7000: 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 DDDDDDDDDDDDDDDD
43 7010: 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 DDDDDDDDDDDDDDDD
44 7020: 44 44 44 44 44 44 44 44 4E 77 77 77 77 77 77 77 DDDDDDDDNwwwwwww
45 7030: 77 77 77 77 77 77 77 77 77 77 77 74 47 77 77 77 wwwwwwwwwwwtGwww
46 always there is the name before it.
47 also 0xAB sequences seem to be fixed.
51 if it has a selection table:
52 6030: E6 1E E8 18 69 34 9D E6 1E E8 C8 C0 08 D0 E6 A4 ....i4..........
53 6040: 66 60 4A 41 49 4C 20 20 20 20 2E 43 41 56 59 53 f.JAIL .CAVYS
54 6050: 41 46 45 20 20 20 20 2E 43 41 56 59 52 41 49 4E AFE .CAVYRAIN
55 6060: 20 20 20 20 2E 43 41 56 59 45 53 43 41 50 41 44 .CAVYESCAPAD
56 6070: 45 2E 43 41 56 59 43 48 41 53 45 20 20 20 2E 49 E.CAVYCHASE .I
57 6080: 4E 54 4E 52 45 53 43 55 45 20 20 2E 43 41 56 59 NTNRESCUE .CAVY
58 6090: 47 59 52 4F 20 20 20 20 2E 43 41 56 59 50 55 53 GYRO .CAVYPUS
59 60A0: 48 20 20 20 20 2E 43 41 56 59 52 41 4D 42 4F 20 H .CAVYRAMBO
60 60B0: 20 20 2E 43 41 56 59 44 52 4F 50 20 20 20 20 2E .CAVYDROP .
61 0x604e+13*i = selectable 'Y' or not 'N'
69 cave selectable = 0x1e, stands for Y in petscii
70 not selectable = 0x09, stands for N in petscii
76 the top row is always stored.
77 before that, there is a row filled with $44, steel walls.
78 it is not used in any game, yet.
79 the bottom row is always filled with steel wall, as
80 LogicDeLuxe pointed out:
81 .C:5dce A9 07 LDA #$07
82 .C:5dd0 A0 27 LDY #$27
83 .C:5dd2 99 98 0B STA $0B98,Y
85 .C:5dd6 10 FA BPL $5DD2
89 dlp 1.55 is changed so it supports elements on the bottom row,
90 too. the very first row (data[0..19]) is copied to the bottom row.
94 crazy dream object codes
95 ------------------------
96 object code 6: copy x1 y1 width height
97 object code 7: paste x1 y1
102 right after cave objects delimiter 0xff:
103 not really important for any current engine, but
104 1=firefly, 2=butterfly, 4=amoeba, 8=slime.
108 in bd1, explosions have four stages, for example, firefly hit
109 by a boulder, graphics for each game cycles are:
110 explosion 2, explosion 3, explosion 2, explosion 1, space.
112 but in 1stb, the same:
113 explosion 1, explosion 2, explosion 3, explosion 2, explosion 1, space.
114 (or: explosion 1, 2, 3, 4, 5, diamond.)
125 As documented by Peter Broadribb:
152 predictable slime in plck
153 -------------------------
154 This is taken from afl boulder dash:
156 * .C:43dd 20 E6 41 JSR $41E6 ; predictable random
157 * .C:43e0 25 93 AND $93 ; & slime_permeability
158 * .C:43e2 D0 25 BNE $4409 ; slime works if result is 0
160 and at the start of the game, predictable random generator is
164 this is required for afl bd cave 15, for example.
166 the following routine explicitly sets randseed1 and randseed2:
167 .C:4b6f A9 00 LDA #$00
169 .C:4b91 8D 42 3D STA $3D42
170 .C:4b94 8D 43 3D STA $3D43
171 .C:4b97 8D 44 3D STA $3D44
172 .C:4b9a A9 1E LDA #$1E
173 .C:4b9c 8D 41 3D STA $3D41
175 so no worry about random values in memory.
181 slime permeability in plck
182 --------------------------
184 slime permeability is stored in $93, which is set at $4f59 in plck.
186 .C:4f59 AD 0B 41 LDA $410B
187 .C:4f5c 85 93 STA $93 ; store slime permeability
189 the code which creates 410b is
190 .C:7721 AE B5 77 LDX $77B5
191 .C:7724 BD 5A 77 LDA $775A,X
192 .C:7727 8D 0B 41 STA $410B
194 so slime permeability values are stored at 775a, which are
195 >C:775a 00 10 18 38 3c 7c 7e fe ff
198 slime permeability in bd2
199 -------------------------
201 stored at $99, used at a059:
202 .C:a059 20 81 9E JSR $9E81
203 .C:a05c 25 99 AND $99
204 .C:a05e D0 25 BNE $A085
205 .C:a060 A0 51 LDY #$51
206 .C:a062 B1 32 LDA ($32),Y
207 .C:a064 D0 1F BNE $A085
212 .C:4e65 A5 DA LDA $DA
213 .C:4e67 85 99 STA $99
224 predictable slime in bd2
225 ------------------------
226 randomseed1 and 2 are values left there after cave initialization.
227 remember that during generating random elements, the upper and lower border ARE NOT
234 taken from a first boulder game:
235 jsr $2500 ; unpredictable random
236 and $94 ; bitwise AND to amoeba speed
237 cmp #$04 ; compare to 4
238 bcs xxx ; branch if carry, eg. result was smaller than 4
240 this is where the 4/128 and 32/128 spread probabilities come from. memory
241 at $94 if set to 01111111 and 00001111, so a random number between 0..127 or
242 0..15 is checked to see if it lower than 4.
244 So the probability is used as a bit pattern. The lower 2 bits do not really
245 count. For the result to be >=4, any of the upper 6 bits must be non-zero.
246 The number of non-zero bits is important, not their order.
248 Probability values that could be exactly expressed using
249 the c64 6-bit scheme:
266 acid spreads, if random <= ratio.
270 boulder dash 2 engine colors
271 ----------------------------
272 not itself the colors, but memory pointers are stored from 89d8, 2 bytes
273 each for all caves. the routine which processes them:
274 .C:ab38 BD D8 89 LDA $89D8,X ; first byte of pointer (lsb)
275 .C:ab3b 85 3C STA $3C
276 .C:ab3d BD D9 89 LDA $89D9,X ; second byte (msb)
277 .C:ab40 85 3D STA $3D
278 .C:ab42 A0 00 LDY #$00
279 .C:ab44 B1 3C LDA ($3C),Y ; copy 5 bytes from pointer
280 .C:ab46 99 FA 24 STA $24FA,Y ; to $24fa
282 .C:ab4a C0 05 CPY #$05
283 .C:ab4c D0 F6 BNE $AB44 ; ^^^^
284 .C:ab4e A6 5E LDX $5E ; vvv dunno this part
285 .C:ab50 BD 0D 24 LDA $240D,X
286 .C:ab53 85 3E STA $3E
287 .C:ab55 85 40 STA $40
288 .C:ab57 A9 00 LDA #$00
289 .C:ab59 85 3F STA $3F
290 .C:ab5b 85 41 STA $41 ; ^^^ dunno but not important now
291 .C:ab5d A9 00 LDA #$00 ; border color 0
292 .C:ab5f 8D 21 D0 STA $D021
293 .C:ab62 AD FA 24 LDA $24FA ; foreground 1
294 .C:ab65 8D 22 D0 STA $D022
295 .C:ab68 AD FB 24 LDA $24FB ; foreground 2
296 .C:ab6b 8D 23 D0 STA $D023
297 .C:ab6e A0 28 LDY #$28
298 .C:ab70 AD FC 24 LDA $24FC ; foreground 3
299 .C:ab73 20 73 9D JSR $9D73 ; fill vic color map
302 so for importing, check pointer at 89d8+2*cavenumber, and read three bytes
303 from the memory area specified by the pointer found there.
306 internal character codes
307 ------------------------
308 BD1: 0x18=acid, 0x19=acid delayed
309 found in crazy dream 3.
311 1stB: 0x29=clock, found in cool dash 1.
315 number of diamonds required
316 ---------------------------
317 take care of required diamonds values==0 or >100.
318 in original bd, the counter was only two-digit. so bd3 cave f
319 says 150 diamonds required, but you only had to collect 50.
320 also, gate opening is triggered by incrementing diamond
321 count and THEN checking if more required; so if required was
322 0, you had to collect 100. also check crazy light 8 cave
324 ref: http://www.boulder-dash.nl/forum/viewtopic.php?t=88
327 butterflies in 1stb, crli
328 -------------------------
329 $30=facing left, $31=up, ... same order as fireflies in BD1,
330 but spinning the other way. fireflies counterclockwise, butterflies
338 01ea 0001 00-3F A Bouncing Boulder converts to this element
339 01eb 0001 00-3F A Falling Diamonds converts to this element
340 01ec 0001 00-3F An Explosion converts to this element
341 01ed 0001 Pointer to Dirt graphic
342 01ee 0001 Pointer to Growing Wall graphic
345 >C:3b00 00 01 02 03 04 05 06 07 08 09 0a 0b 08 09 0a 0b ................
346 >C:3b10 10 10 12 12 14 14 16 16 18 19 1a 1b 1c 1d 1e 1f ................ -- 1e
347 >C:3b20 20 21 22 23 24 25 26 27 28 29 2a 2a 2c 2d 2e 2f !"#$%&'()**,-./
348 >C:3b30 30 31 32 33 30 31 32 33 38 38 3a 3a 3c 3d 3e 3f 0123012388::<=>?
349 >C:3b40 40 60 46 4e 22 2e 62 2e 4a 64 64 64 64 64 64 64 @`FN".b.Jddddddd
350 >C:3b50 64 44 44 44 44 48 48 48 48 00 00 00 66 68 6a 68 dDDDDHHHH...fhjh
351 >C:3b60 66 24 26 28 2a 2c 62 66 68 6a 00 4e 4e 00 00 00 f$&(*,bfhj.NN...
352 >C:3b70 00 20 20 20 20 20 20 20 20 4c 4c 40 40 42 2e 40 . LL@@B.@
355 >C:4280 00 01 02 03 04 05 06 07 08 09 0a 0b 08 09 0a 0b ................
356 >C:4290 10 10 12 12 14 14 16 16 19 19 1a 1b 1c 1d 1e 20 ...............
357 >C:42a0 20 21 22 23 24 25 26 27 28 29 2a 2a 2c 2d 2e 2f !"#$%&'()**,-./
358 >C:42b0 30 31 32 33 30 31 32 33 38 39 3a 3b 3d 3d 3e 3f 0123012389:;==>?
359 >C:42c0 41 41 42 43 44 45 46 47 48 48 4b 4b 4c 4d 4e 4f AABCDEFGHHKKLMNO
360 >C:42d0 50 50 52 52 54 54 56 57 57 5a 5a 5b 5c 5d 5e 5f PPRRTTVWWZZ[\]^_
361 >C:42e0 61 61 62 63 64 64 66 67 67 69 6a 6b 6c 6d 6e 6f aabcddfggijklmno
362 >C:42f0 70 70 72 72 75 75 76 77 78 79 7a 7b 78 79 7a 7b pprruuvwxyz{xyz{
366 >C:3b00 00 01 02 03 04 05 06 07 08 09 0a 0b 08 09 0a 0b ................
367 >C:3b10 10 10 12 12 14 14 16 16 18 19 1a 1b 1c 1d 10 1f ................ -- 1e - explosion
368 >C:3b20 20 21 22 23 24 25 26 27 28 29 2a 2a 2c 2d 2e 2f !"#$%&'()**,-./
369 >C:3b30 30 31 32 33 30 31 32 33 38 38 3a 3a 3c 3d 3e 3f 0123012388::<=>?
370 >C:3b40 40 60 46 4e 22 2e 62 2e 4a 64 64 64 64 64 64 64 @`FN".b.Jddddddd
371 >C:3b50 64 44 44 44 44 48 48 48 48 00 00 00 66 68 6a 68 dDDDDHHHH...fhjh
372 >C:3b60 66 24 26 28 2a 2c 62 66 68 6a 00 4e 4e 00 00 00 f$&(*,bfhj.NN...
373 >C:3b70 00 20 20 20 20 20 20 20 20 4c 4c 40 40 42 2e 40 . LL@@B.@
377 >C:3b00 00 01 02 03 04 05 06 07 08 09 0a 0b 08 09 0a 0b ................
378 >C:3b10 10 10 12 12 14 14 16 16 18 19 1a 1b 1c 1d 1e 1f ................
379 >C:3b20 20 21 22 23 24 25 26 27 28 29 2a 2a 2c 2d 2e 2f !"#$%&'()**,-./
380 >C:3b30 30 31 32 33 30 31 32 33 38 38 3a 3a 3c 3d 3e 3f 0123012388::<=>?
381 >C:3b40 40 60 46 4e 22 2e 62 2e 4a 64 64 64 64 64 64 64 @`FN".b.Jddddddd
382 >C:3b50 64 44 44 44 44 48 48 48 48 00 00 00 66 68 6a 68 dDDDDHHHH...fhjh
383 >C:3b60 66 24 26 28 2a 2c 62 66 68 6a 00 4e 4e 00 00 00 f$&(*,bfhj.NN...
384 >C:3b70 00 20 20 20 20 20 20 20 20 4c 4c 40 40 42 2e 40 . LL@@B.@
387 bouldi dash 4, cave 19
388 >C:3b00 00 01 02 03 04 05 06 07 08 09 0a 0b 08 09 0a 0b ................
389 >C:3b10 10 30 12 12 14 14 16 16 18 19 1a 1b 1c 1d 1e 1f .0.............. -- bouncing stone: 11
390 >C:3b20 20 21 22 23 24 25 26 27 28 29 2a 2a 2c 2d 2e 2f !"#$%&'()**,-./
391 >C:3b30 30 31 32 33 30 31 32 33 38 38 3a 3a 3c 3d 3e 3f 0123012388::<=>?
392 >C:3b40 40 60 46 4e 22 2e 62 2e 4a 64 64 64 64 64 64 64 @`FN".b.Jddddddd
393 >C:3b50 64 44 44 44 44 48 48 48 48 00 00 00 66 68 6a 68 dDDDDHHHH...fhjh
394 >C:3b60 66 24 26 28 2a 2c 62 66 68 6a 00 4e 4e 00 00 00 f$&(*,bfhj.NN...
395 >C:3b70 00 20 20 20 20 20 20 20 20 4c 4c 40 40 42 2e 40 . LL@@B.@
398 bouldi dash 4, cave 6
399 >C:3b00 00 01 02 03 04 05 06 07 08 09 0a 0b 08 09 0a 0b ................
400 >C:3b10 10 1b 12 12 14 14 16 01 18 19 1a 1b 1c 1d 1e 1f ................ -- 0x17: falling diamond
401 >C:3b20 20 21 22 23 24 25 26 27 28 29 2a 2a 2c 2d 2e 2f !"#$%&'()**,-./
402 >C:3b30 30 31 32 33 30 31 32 33 38 38 3a 3a 3c 3d 3e 3f 0123012388::<=>?
403 >C:3b40 40 60 22 4e 22 2e 62 2e 4a 64 64 64 64 64 64 64 @`"N".b.Jddddddd -- 0x42: dirt looks like pointer
404 >C:3b50 64 44 44 44 44 48 48 48 48 00 00 00 66 68 6a 68 dDDDDHHHH...fhjh
405 >C:3b60 66 24 26 28 2a 2c 62 66 68 6a 00 4e 4e 00 00 00 f$&(*,bfhj.NN...
406 >C:3b70 00 20 20 20 20 20 20 20 20 4c 4c 40 40 42 2e 40 . LL@@B.@
409 >C:3b00 00 01 02 03 04 05 06 07 08 09 0a 0b 08 09 0a 0b ................
410 >C:3b10 10 08 12 12 14 14 16 02 18 19 1a 1b 1c 1d 10 1f ................
411 >C:3b20 20 21 22 23 24 25 26 27 28 29 2a 2a 2c 2d 2e 2f !"#$%&'()**,-./
412 >C:3b30 30 31 32 33 30 31 32 33 38 38 3a 3a 3c 3d 3e 3f 0123012388::<=>?
413 >C:3b40 40 60 22 4e 22 2e 62 2e 4a 64 64 64 64 64 64 64 @`"N".b.Jddddddd
414 >C:3b50 64 44 44 44 44 48 48 48 48 00 00 00 66 68 6a 68 dDDDDHHHH...fhjh
415 >C:3b60 66 24 26 28 2a 2c 62 66 68 6a 00 2e 2e 00 00 00 f$&(*,bfhj...... .. 0x6b, 6c - expanding wall looks like
416 >C:3b70 00 20 20 20 20 20 20 20 20 4c 4c 40 40 42 2e 40 . LL@@B.@
423 Deluxe Caves 1 contains a line with negative length.
424 that is not displayed at all, because:
433 LDA direction_tab+1,X
437 DEC $C8 ; decrementing length
438 BMI paint_line_quit ; if negative, jumps out of subroutine.
455 disassembly from: marek roth crazy light tutorial game.
456 for each element, code byte at 6a70+n and 6af0+n, hi and lo byte.
457 for example, chasing stone at (6a70+72) and (6af0+72) -> 5710.
458 (same in crazy dream: a800 and a900)
462 water in crazy dream: b964
465 from $aa00: something like an effect table; for elements which code
466 byte needs only a translation. for example, bladder1->bladder2
469 during processing, lda ($6d),y is used everywhere to read an element
470 from the cave array. the "default" value of y is $29, 41 decimal.
471 the cave is 40 bytes wide. so loading ($6d)+0 gives the element at
472 (x-1,y-1). loading ($6d)+41 gives the element at (x,y).
473 y coordinates for neighbouring elements:
481 538a: check if element at given coordinate is rockford-like.
482 returns x if no, x=0 if yes.
484 4ae9: check if element at (x,y-1) or (x+1,y)... is rockford-like.
487 3d5f: place random element at ($6d),y, if there is no steel wall, voodoo
488 or trapped diamond there.
495 ; check if ghost near rockford
496 .C:caad 20 E9 4A JSR $4AE9 ; check if nearing a rockford
497 .C:cab0 D0 25 BNE $CAD7 ; if not, move somewhere
499 .C:cab2 A9 67 LDA #$67 ; ghost explosion, stage 2
500 .C:cab4 85 83 STA $83
501 .C:cab6 A0 00 LDY #$00 ; x-1, y-1
502 .C:cab8 20 5F 3D JSR $3D5F
503 .C:cabb A0 02 LDY #$02 ; x+1, y-1
504 .C:cabd 20 5F 3D JSR $3D5F
505 .C:cac0 A0 29 LDY #$29 ; x, y (the ghost itself)
506 .C:cac2 20 5F 3D JSR $3D5F
507 .C:cac5 C6 83 DEC $83 ; now it becomes ghost explosion, stage 1
508 .C:cac7 A0 50 LDY #$50 ; x-1, y+1
509 .C:cac9 20 5F 3D JSR $3D5F
510 .C:cacc A0 52 LDY #$52 ; x+1, y+1
511 .C:cace 20 5F 3D JSR $3D5F
512 .C:cad1 20 71 41 JSR $4171 ; dunno
513 .C:cad4 4C 82 46 JMP $4682 ; finished
515 .C:cad7 A2 03 LDX #$03 ; tries to move 4 times
516 .C:cad9 20 00 25 JSR $2500 ; unpredictable random
517 .C:cadc 29 03 AND #$03 ; random number between 0..3
519 .C:cadf B9 F5 CA LDA $CAF5,Y ; pick a coordinate to move to
520 ; coordinates: 01 28 2a 51,
521 ; that is up left right down
523 .C:cae3 B1 6D LDA ($6D),Y ; what is there?
524 .C:cae5 F0 06 BEQ $CAED ; if zero (space), move
526 .C:cae8 10 EF BPL $CAD9 ; branch if x still >=0
527 .C:caea 4C 82 46 JMP $4682 ; finished
528 .C:caed A9 65 LDA #$65 ; ghost delayed
529 .C:caef 20 69 43 JSR $4369 ; store
530 .C:caf2 4C 2F 25 JMP $252F
537 .C:4092 AD 42 3D LDA $3D42 ----- vvv predictable random
540 .C:4097 29 80 AND #$80
541 .C:4099 8D 43 3D STA $3D43
542 .C:409c AD 41 3D LDA $3D41
544 .C:40a0 29 7F AND #$7F
545 .C:40a2 8D 44 3D STA $3D44
546 .C:40a5 AD 41 3D LDA $3D41
549 .C:40aa 29 80 AND #$80
551 .C:40ad 6D 41 3D ADC $3D41
552 .C:40b0 69 13 ADC #$13
553 .C:40b2 8D 41 3D STA $3D41
554 .C:40b5 AD 42 3D LDA $3D42
555 .C:40b8 6D 43 3D ADC $3D43
556 .C:40bb 6D 44 3D ADC $3D44
557 .C:40be 8D 42 3D STA $3D42 ------ ^^^ predictable random
558 .C:40c1 25 93 AND $93 ; & slime permeability
559 .C:40c3 D0 2F BNE $40F4 ; if nonzero, finish.
560 .C:40c5 A0 51 LDY #$51
561 .C:40c7 B1 6D LDA ($6D),Y ; what is under the slime?
562 .C:40c9 D0 2C BNE $40F7 ; if space, stay here. if nonspace, 40f7.
563 .C:40cb A0 01 LDY #$01
564 .C:40cd B1 6D LDA ($6D),Y
565 .C:40cf C9 10 CMP #$10
566 .C:40d1 F0 12 BEQ $40E5
567 .C:40d3 C9 14 CMP #$14
568 .C:40d5 F0 0E BEQ $40E5
569 .C:40d7 C9 70 CMP #$70
570 .C:40d9 F0 04 BEQ $40DF
571 .C:40db C9 72 CMP #$72
572 .C:40dd D0 18 BNE $40F7
574 .C:40e0 69 01 ADC #$01
575 .C:40e2 4C E8 40 JMP $40E8
577 .C:40e6 69 03 ADC #$03
578 .C:40e8 A0 51 LDY #$51
579 .C:40ea 20 69 43 JSR $4369
580 .C:40ed A9 00 LDA #$00
581 .C:40ef A0 01 LDY #$01
582 .C:40f1 20 69 43 JSR $4369
583 .C:40f4 4C 82 46 JMP $4682
584 .C:40f7 C9 40 CMP #$40 ; is a bladder under the slime?
585 .C:40f9 D0 12 BNE $410D ; if not, finish.
586 .C:40fb A0 01 LDY #$01 ; yes, it is a bladder.
587 .C:40fd B1 6D LDA ($6D),Y
588 .C:40ff D0 0C BNE $410D ; space over slime?
589 .C:4101 A9 41 LDA #$41 ; place a bladder_waiting over slime.
590 .C:4103 20 69 43 JSR $4369
591 .C:4106 A0 51 LDY #$51
592 .C:4108 A9 00 LDA #$00
593 .C:410a 20 69 43 JSR $4369
594 .C:410d 4C 82 46 JMP $4682
601 the last 16 coordinates of the active player is stored at $10-$1f and $20-$2f, where
602 the $1f,$2f are the most recent. the chasing stones try to go to these coordinates;
603 if they can not go in a direction (for example, they should go x+1, but they can't), they
604 try to change the other coordinate (y).
605 whether x or y is checked first, is determined by a random number; if the check fails, the
606 other coordinate is tried. (this is remembered by register x).
607 the c code in cave.c reproduces this exactly.
609 .C:5710 A2 03 LDX #$03
610 .C:5712 20 00 25 JSR $2500
611 .C:5715 29 01 AND #$01
612 .C:5717 D0 6C BNE $5785
613 .C:5719 A5 8B LDA $8B
614 .C:571b C5 10 CMP $10
615 .C:571d F0 14 BEQ $5733
616 .C:571f 90 0E BCC $572F
617 .C:5721 A0 28 LDY #$28
618 .C:5723 B1 6D LDA ($6D),Y
619 .C:5725 D0 18 BNE $573F
620 .C:5727 A9 73 LDA #$73
621 .C:5729 20 69 43 JSR $4369
622 .C:572c 4C 2F 25 JMP $252F
623 .C:572f A0 2A LDY #$2A
624 .C:5731 D0 F0 BNE $5723
626 .C:5734 E0 02 CPX #$02
627 .C:5736 F0 4D BEQ $5785
628 .C:5738 E0 00 CPX #$00
629 .C:573a F0 7C BEQ $57B8
630 .C:573c 4C 82 46 JMP $4682
633 .C:5741 E0 01 CPX #$01
634 .C:5743 F0 40 BEQ $5785
635 .C:5745 E0 00 CPX #$00
636 .C:5747 D0 F3 BNE $573C
637 .C:5749 A5 8B LDA $8B
638 .C:574b C5 10 CMP $10
639 .C:574d B0 1B BCS $576A
640 .C:574f A0 02 LDY #$02
641 .C:5751 B1 6D LDA ($6D),Y
642 .C:5753 D0 06 BNE $575B
643 .C:5755 A0 01 LDY #$01
644 .C:5757 B1 6D LDA ($6D),Y
645 .C:5759 F0 CC BEQ $5727
646 .C:575b A0 52 LDY #$52
647 .C:575d B1 6D LDA ($6D),Y
648 .C:575f D0 06 BNE $5767
649 .C:5761 A0 51 LDY #$51
650 .C:5763 B1 6D LDA ($6D),Y
651 .C:5765 F0 C0 BEQ $5727
652 .C:5767 4C 82 46 JMP $4682
653 .C:576a A0 00 LDY #$00
654 .C:576c B1 6D LDA ($6D),Y
655 .C:576e D0 06 BNE $5776
656 .C:5770 A0 01 LDY #$01
657 .C:5772 B1 6D LDA ($6D),Y
658 .C:5774 F0 B1 BEQ $5727
659 .C:5776 A0 50 LDY #$50
660 .C:5778 B1 6D LDA ($6D),Y
661 .C:577a D0 06 BNE $5782
662 .C:577c A0 51 LDY #$51
663 .C:577e B1 6D LDA ($6D),Y
664 .C:5780 F0 A5 BEQ $5727
665 .C:5782 4C 82 46 JMP $4682
666 .C:5785 A5 8C LDA $8C
667 .C:5787 C5 20 CMP $20
668 .C:5789 F0 14 BEQ $579F
669 .C:578b 90 0E BCC $579B
670 .C:578d A0 01 LDY #$01
671 .C:578f B1 6D LDA ($6D),Y
672 .C:5791 D0 1B BNE $57AE
673 .C:5793 A9 73 LDA #$73
674 .C:5795 20 69 43 JSR $4369
675 .C:5798 4C 2F 25 JMP $252F
676 .C:579b A0 51 LDY #$51
677 .C:579d D0 F0 BNE $578F
679 .C:57a0 E0 02 CPX #$02
680 .C:57a2 D0 03 BNE $57A7
681 .C:57a4 4C 19 57 JMP $5719
682 .C:57a7 E0 00 CPX #$00
683 .C:57a9 F0 9E BEQ $5749
684 .C:57ab 4C 82 46 JMP $4682
687 .C:57b0 E0 01 CPX #$01
688 .C:57b2 F0 F0 BEQ $57A4
689 .C:57b4 E0 00 CPX #$00
690 .C:57b6 D0 F3 BNE $57AB
691 .C:57b8 A5 8C LDA $8C
692 .C:57ba C5 20 CMP $20
693 .C:57bc B0 1B BCS $57D9
694 .C:57be A0 50 LDY #$50
695 .C:57c0 B1 6D LDA ($6D),Y
696 .C:57c2 D0 06 BNE $57CA
697 .C:57c4 A0 28 LDY #$28
698 .C:57c6 B1 6D LDA ($6D),Y
699 .C:57c8 F0 C9 BEQ $5793
700 .C:57ca A0 52 LDY #$52
701 .C:57cc B1 6D LDA ($6D),Y
702 .C:57ce D0 06 BNE $57D6
703 .C:57d0 A0 2A LDY #$2A
704 .C:57d2 B1 6D LDA ($6D),Y
705 .C:57d4 F0 BD BEQ $5793
706 .C:57d6 4C 82 46 JMP $4682
707 .C:57d9 A0 00 LDY #$00
708 .C:57db B1 6D LDA ($6D),Y
709 .C:57dd D0 06 BNE $57E5
710 .C:57df A0 28 LDY #$28
711 .C:57e1 B1 6D LDA ($6D),Y
712 .C:57e3 F0 AE BEQ $5793
713 .C:57e5 A0 02 LDY #$02
714 .C:57e7 B1 6D LDA ($6D),Y
715 .C:57e9 D0 06 BNE $57F1
716 .C:57eb A0 2A LDY #$2A
717 .C:57ed B1 6D LDA ($6D),Y
718 .C:57ef F0 A2 BEQ $5793
719 .C:57f1 4C 82 46 JMP $4682
720 .C:57f4 A2 01 LDX #$01
721 .C:57f6 8E 07 3D STX $3D07
722 .C:57f9 4C C1 56 JMP $56C1
727 finds a teleporter, starting from the current player (px, py), and round the whole cave.
728 if it founds one, which has a space near it, in the direction the player moves; that teleporter
730 if not, goes on with searching.
731 if it gets back to the current coordinates (the player which tried to use the teleporter), it quits.
732 (6d)+y = the currently checked element
735 .C:b2ec 48 PHA - push px, py
736 .C:b2ed A0 29 LDY #$29
737 .C:b2ef B1 6D LDA ($6D),Y
738 .C:b2f1 85 04 STA $04 - store actual rockford code (usually $50) to $04
739 .C:b2f3 A5 6D LDA $6D - saves current coordinates to 1049 and 104a
740 .C:b2f5 8D 49 10 STA $1049 |
741 .C:b2f8 A5 6E LDA $6E |
742 .C:b2fa 8D 4A 10 STA $104A ---+
743 .C:b2fd 18 CLC - does nothing
744 .C:b2fe A5 6D LDA $6D
745 .C:b300 69 00 ADC #$00
746 .C:b302 85 6D STA $6D
747 .C:b304 A5 6E LDA $6E
748 .C:b306 69 00 ADC #$00
749 .C:b308 85 6E STA $6E
751 .C:b30b A5 6D LDA $6D - (6d,6e) incremented by one
752 .C:b30d 69 01 ADC #$01 |
753 .C:b30f 85 6D STA $6D |
754 .C:b311 A5 6E LDA $6E |
755 .C:b313 69 00 ADC #$00 |
756 .C:b315 85 6E STA $6E ----+
757 .C:b317 A5 6D LDA $6D - compared to original pointer
758 .C:b319 CD 49 10 CMP $1049
759 .C:b31c D0 07 BNE $B325 - lsb does not match
760 .C:b31e A5 6E LDA $6E - check msb
761 .C:b320 CD 4A 10 CMP $104A
762 .C:b323 F0 30 BEQ $B355 - if both match, go to b355
763 .C:b325 A9 70 LDA #$70 - if msb does not match, check if we reached the end of the cave - $0b70
764 .C:b327 C5 6D CMP $6D
765 .C:b329 D0 06 BNE $B331
766 .C:b32b A9 0B LDA #$0B
767 .C:b32d C5 6E CMP $6E
768 .C:b32f F0 2A BEQ $B35B - if end of the cave, go to b35b; that sets coordinates to the beginning and comes back here
769 .C:b331 A0 29 LDY #$29 - check what is in the current one
770 .C:b333 B1 6D LDA ($6D),Y
771 .C:b335 C9 95 CMP #$95
772 .C:b337 D0 D1 BNE $B30A - if it is not a teleporter, go to b30a
773 .C:b339 68 PLA - we found a teleporter ---------------v
775 .C:b33b A8 TAY - get the player move coordinate from the stack
776 .C:b33c B1 6D LDA ($6D),Y - what is near the teleporter, in the direction?
777 .C:b33e D0 CA BNE $B30A - if not a space, this will not do; go back to searching
778 .C:b340 A5 04 LDA $04 - retain current player code (usually $50)
779 .C:b342 8D 6A B3 STA $B36A - store to 6369 (that is an lda instruction, self modifying code)
780 .C:b345 A9 DB LDA #$DB
781 .C:b347 91 6D STA ($6D),Y - place a will-be-rockford there
782 .C:b349 20 F4 B1 JSR $B1F4 - retain stored coordinates (to be able to continue cave scan)
784 .C:b34d 20 73 B3 JSR $B373 - current player becomes a space (disappeared in the teleport)
785 .C:b350 68 PLA - throw away address from space
787 .C:b352 4C 90 C0 JMP $C090
788 .C:b355 20 F4 B1 JSR $B1F4
791 .C:b35a 60 RTS - es vege. vagyis ha korbeertunk, nem tortenik semmi
792 .C:b35b A9 50 LDA #$50 - set coordinates to start of cave data in memory: $0850
793 .C:b35d 85 6D STA $6D
794 .C:b35f A9 08 LDA #$08
795 .C:b361 85 6E STA $6E
796 .C:b363 D0 CC BNE $B331 - always jumps to b331
797 .C:b365 4C 7A B3 JMP $B37A
799 .C:b369 A9 50 LDA #$50 - this changes "delayed" $db to some rockford.
800 .C:b36b A0 29 LDY #$29
801 .C:b36d 20 69 43 JSR $4369
802 .C:b370 4C 82 46 JMP $4682
803 .C:b373 A0 29 LDY #$29
804 .C:b375 A9 00 LDA #$00
805 .C:b377 4C 69 43 JMP $4369
811 .C:4b9f A5 87 LDA $87
812 .C:4ba1 D0 1B BNE $4BBE
813 .C:4ba3 E6 31 INC $31 ; $30,$31: amoeba count
814 .C:4ba5 D0 02 BNE $4BA9
815 .C:4ba7 E6 30 INC $30
816 .C:4ba9 A5 32 LDA $32
817 .C:4bab C5 34 CMP $34
818 .C:4bad 90 0B BCC $4BBA
819 .C:4baf A5 33 LDA $33
820 .C:4bb1 C5 35 CMP $35
821 .C:4bb3 90 05 BCC $4BBA
822 .C:4bb5 A9 3C LDA #$3C
823 .C:4bb7 4C 33 25 JMP $2533
824 .C:4bba A5 86 LDA $86
825 .C:4bbc D0 05 BNE $4BC3
826 .C:4bbe A9 1F LDA #$1F
827 .C:4bc0 4C 33 25 JMP $2533
828 .C:4bc3 A5 79 LDA $79 ; if found any amoeba which could grow (in this iteration), skip checking
829 .C:4bc5 D0 15 BNE $4BDC
830 .C:4bc7 A2 03 LDX #$03 ; amoeba growing; 4 possibilities to check
831 .C:4bc9 BC F7 4B LDY $4BF7,X
832 .C:4bcc B1 6D LDA ($6D),Y
833 .C:4bce C9 02 CMP #$02
834 .C:4bd0 90 06 BCC $4BD8 ; if we find a direction where there is space or dirt, this amoeba can grow
835 .C:4bd2 CA DEX ; decrement x
836 .C:4bd3 10 F4 BPL $4BC9 ; if not negative, try another direction (we try x=3..0)
837 .C:4bd5 4C 82 46 JMP $4682 ; finish
839 .C:4bd8 A9 01 LDA #$01 ; remember that there is an amoeba that can grow
840 .C:4bda 85 79 STA $79
841 .C:4bdc 20 00 25 JSR $2500 ; unpredictable random
842 .C:4bdf 25 94 AND $94 ; binary and possibility_of_growing
843 .C:4be1 C9 04 CMP #$04 ; if bigger than 4, finish
844 .C:4be3 B0 0F BCS $4BF4
845 .C:4be5 AA TAX ; choose a random direction
846 .C:4be6 BC F7 4B LDY $4BF7,X
847 .C:4be9 B1 6D LDA ($6D),Y
848 .C:4beb C9 02 CMP #$02 ; if there is space or dirt
849 .C:4bed B0 05 BCS $4BF4
850 .C:4bef A9 58 LDA #$58 ; and put an amoeba_scanned there
851 .C:4bf1 20 69 43 JSR $4369
852 .C:4bf4 4C 82 46 JMP $4682
853 >C:4bf7 01 28 2a 51 ; four direction bytes to load to register y
859 495b - rockford mozgas
864 $3f - novelve van - hanyat talalt eddig?
865 $90 - ha 0, akkor tarolodik az aktualis x
867 $f9 - suicide?, ha 0, akkor 4983, vagyis nem
868 4142: robbanast csinal, $83ba eltarolt elemmel
870 $af - valamifele jelzoflag, alapbol 0, aztan
872 ha adott helyen space, akkor noveli eggyel, es 3c6b-be #35 - hang lehet
873 ha dirt, akkor is noveli eggyel, es 3c6b-be #a5 - hang lehet
875 ha kijarat, akkor $91-be #02, $99-be #01, $af novel eggyel es vege
877 b192-tol crazy dream kiegeszitesek
878 b192 - skeleton ellenorzes, ha igen, ugrik 41d3
881 joystick olvas, $85-be eltarol
883 49fe - ugy erunk ide, hogy aksiban a joystick szarja
885 4a02 - rockford balra
886 4a1f - rockford folfele
889 ba7e - rovid kiegeszites, ami a pneumatic hammer hangjat csinalja, vagy a rajzot vagy tokmindegy mit
892 onmodosito, egyszer van megirva a rokford kod
893 4b09 - adat, <- #$51 - rokford delayed
895 4b35 - adat, <- #$50 - rokford
897 22f3 - player1 joystick beolvasas, akkuba megy & 0x0f
898 22f9 - player2 joystick beolvasas
904 b0-b3 __IS__ the cow (not a9...)
905 b4-b7 is cow delayed.
906 a9-af are cow enclosed's.
914 .C:467a B1 6D LDA ($6D),Y
916 .C:467d BD 00 AA LDA $AA00,X ; effect table
917 .C:4680 91 6D STA ($6D),Y
918 .C:4682 E6 6D INC $6D
919 .C:4684 D0 02 BNE $4688
921 for b4-b7, changes it to b0-b3.
923 .C:b3b0 A0 29 LDY #$29 ; simple effect table translation.
924 .C:b3b2 B1 6D LDA ($6D),Y
926 .C:b3b5 BD 00 AA LDA $AA00,X
927 .C:b3b8 20 69 43 JSR $4369
928 .C:b3bb 4C 82 46 JMP $4682
933 ; THIS MOVES A COW. IT WORKS EXACTLY THE SAME WAY AS A GUARD.
934 .C:b3c0 A0 29 LDY #$29 ; current cow.
935 .C:b3c2 B1 6D LDA ($6D),Y
943 .C:b3cb 29 03 AND #$03 ; two lsb's are direction.
945 .C:b3ce BC A4 21 LDY $21A4,X ; 51 28 01 2a, down left up right
946 .C:b3d1 B1 6D LDA ($6D),Y
947 .C:b3d3 D0 0E BNE $B3E3 ; space in that direction? if not, b3e3
948 .C:b3d5 18 CLC ; there is a space in that direction.
950 .C:b3d7 69 03 ADC #$03 ; turn one back
951 .C:b3d9 29 03 AND #$03 ; (turn one back...)
952 .C:b3db 69 B4 ADC #$B4 ; add cow delayed to new direction lsbs.
953 .C:b3dd 20 69 43 JSR $4369 ; store and finish
954 .C:b3e0 4C 2F 25 JMP $252F
955 .C:b3e3 BC A5 21 LDY $21A5,X ; 28 01 2a 51 left up right down; we jumped here if no space
956 .C:b3e6 B1 6D LDA ($6D),Y
957 .C:b3e8 D0 0A BNE $B3F4 ; space in another direction? if no, b3f4.
960 .C:b3ec 69 B4 ADC #$B4 ; if space, store cow there with original bits.
961 .C:b3ee 20 69 43 JSR $4369
962 .C:b3f1 4C 2F 25 JMP $252F
964 .C:b3f5 A0 29 LDY #$29
966 .C:b3f8 69 01 ADC #$01 ; don't move in any direction, just store.
967 .C:b3fa 29 03 AND #$03
968 .C:b3fc 69 B0 ADC #$B0
969 .C:b3fe 91 6D STA ($6D),Y
970 .C:b400 4C 82 46 JMP $4682 ; finish
973 .C:b403 A0 01 LDY #$01 ; over the cow... -------------- for b0-b3 - cows.
974 .C:b405 B1 6D LDA ($6D),Y
975 .C:b407 F0 B7 BEQ $B3C0 ; is a space? then b3c0.
976 .C:b409 A0 28 LDY #$28 ; left
977 .C:b40b B1 6D LDA ($6D),Y
978 .C:b40d F0 B1 BEQ $B3C0
979 .C:b40f A0 2A LDY #$2A ; right
980 .C:b411 B1 6D LDA ($6D),Y
981 .C:b413 F0 AB BEQ $B3C0
982 .C:b415 A0 51 LDY #$51
983 .C:b417 B1 6D LDA ($6D),Y
984 .C:b419 F0 A5 BEQ $B3C0
985 .C:b41b A9 A9 LDA #$A9 ; no space, store a cow enclosed.
986 .C:b41d 20 48 B4 JSR $B448
987 .C:b420 4C 82 46 JMP $4682 ; finish
989 .C:b423 A0 01 LDY #$01 ; b423: for a9-af - enclosed cows.
990 .C:b425 B1 6D LDA ($6D),Y ; space in any direction?
991 .C:b427 F0 15 BEQ $B43E ; if space, b43e.
992 .C:b429 A0 28 LDY #$28
993 .C:b42b B1 6D LDA ($6D),Y
994 .C:b42d F0 0F BEQ $B43E
995 .C:b42f A0 2A LDY #$2A
996 .C:b431 B1 6D LDA ($6D),Y
997 .C:b433 F0 09 BEQ $B43E
998 .C:b435 A0 51 LDY #$51
999 .C:b437 B1 6D LDA ($6D),Y
1000 .C:b439 F0 03 BEQ $B43E
1001 .C:b43b 4C B0 B3 JMP $B3B0 ; jump to a simple effect table translation, it will do: a9->aa, ab, ac, ad, ae, af, 97 (skeleton)
1002 .C:b43e A0 29 LDY #$29 ; we found at least one direction, where the enclosed cow could move.
1003 .C:b440 A9 B0 LDA #$B0 ; store a cow_left there!
1004 .C:b442 20 69 43 JSR $4369
1005 .C:b445 4C 82 46 JMP $4682
1006 .C:b448 A0 29 LDY #$29
1007 .C:b44a 4C 69 43 JMP $4369
1012 crazy dream 9 title screen maze
1013 -------------------------------
1014 .C:c700 A0 50 LDY #$50
1015 .C:c702 A9 00 LDA #$00
1016 .C:c704 99 A0 07 STA $07A0,Y ; writes 80times 0 to 07a0
1018 .C:c708 10 FA BPL $C704
1034 .C:c719 A9 A8 LDA #$A8 ; cave address to $6d-6e -> similiar to game (lda ($6d),y)
1035 .C:c71b 85 6D STA $6D
1036 .C:c71d A9 07 LDA #$07
1037 .C:c71f 85 6E STA $6E
1038 .C:c721 A9 00 LDA #$00
1042 .C:c726 85 71 STA $71
1043 .C:c728 A0 80 LDY #$80
1044 .C:c72a B1 6D LDA ($6D),Y ; read element at current position
1045 .C:c72c C9 80 CMP #$80 ; is it a 0x80?
1046 .C:c72e D0 5B BNE $C78B ; if not, go to c78b
1047 .C:c730 20 00 25 JSR $2500
1048 .C:c733 29 03 AND #$03
1049 .C:c735 D0 12 BNE $C749
1050 .C:c737 A0 30 LDY #$30
1051 .C:c739 B1 6D LDA ($6D),Y
1052 .C:c73b C9 81 CMP #$81
1053 .C:c73d D0 54 BNE $C793
1054 .C:c73f A9 80 LDA #$80
1055 .C:c741 91 6D STA ($6D),Y
1056 .C:c743 A0 58 LDY #$58
1057 .C:c745 91 6D STA ($6D),Y
1058 .C:c747 D0 4A BNE $C793
1059 .C:c749 C9 01 CMP #$01
1060 .C:c74b D0 12 BNE $C75F
1061 .C:c74d A0 82 LDY #$82
1062 .C:c74f B1 6D LDA ($6D),Y
1063 .C:c751 C9 81 CMP #$81
1064 .C:c753 D0 3E BNE $C793
1065 .C:c755 A9 80 LDA #$80
1066 .C:c757 91 6D STA ($6D),Y
1067 .C:c759 A0 81 LDY #$81
1068 .C:c75b 91 6D STA ($6D),Y
1069 .C:c75d D0 34 BNE $C793
1070 .C:c75f C9 02 CMP #$02
1071 .C:c761 D0 12 BNE $C775
1072 .C:c763 A0 D0 LDY #$D0
1073 .C:c765 B1 6D LDA ($6D),Y
1074 .C:c767 C9 81 CMP #$81
1075 .C:c769 D0 28 BNE $C793
1076 .C:c76b A9 80 LDA #$80
1077 .C:c76d 91 6D STA ($6D),Y
1078 .C:c76f A0 A8 LDY #$A8
1079 .C:c771 91 6D STA ($6D),Y
1080 .C:c773 D0 1E BNE $C793
1081 .C:c775 C9 03 CMP #$03
1082 .C:c777 D0 12 BNE $C78B
1083 .C:c779 A0 7E LDY #$7E
1084 .C:c77b B1 6D LDA ($6D),Y
1085 .C:c77d C9 81 CMP #$81
1086 .C:c77f D0 12 BNE $C793
1087 .C:c781 A9 80 LDA #$80
1088 .C:c783 91 6D STA ($6D),Y
1089 .C:c785 A0 7F LDY #$7F
1090 .C:c787 91 6D STA ($6D),Y
1091 .C:c789 D0 08 BNE $C793
1092 .C:c78b C9 81 CMP #$81 ; here we arrive if no 0x80 at loaded address
1093 .C:c78d D0 04 BNE $C793 ; branch to c793 if no 0x81
1094 .C:c78f A9 01 LDA #$01 ; write 0x01 to $71
1095 .C:c791 85 71 STA $71
1097 .C:c794 A5 6D LDA $6D ; increment $6d address
1098 .C:c796 69 01 ADC #$01
1099 .C:c798 85 6D STA $6D
1100 .C:c79a 90 02 BCC $C79E
1101 .C:c79c E6 6E INC $6E
1104 .C:c7a0 A5 6E LDA $6E
1105 .C:c7a2 C9 0B CMP #$0B ; if higher part is not 0x0b, go to c728 - checking again
1106 .C:c7a4 90 82 BCC $C728
1107 .C:c7a6 A5 6D LDA $6D
1108 .C:c7a8 C9 00 CMP #$00
1109 .C:c7aa 90 F8 BCC $C7A4 ; if lower part is ??? - go to checking
1110 .C:c7ac A5 71 LDA $71
1111 .C:c7ae F0 03 BEQ $C7B3
1112 .C:c7b0 4C 19 C7 JMP $C719
1113 .C:c7b3 A9 28 LDA #$28
1114 .C:c7b5 85 6D STA $6D
1115 .C:c7b7 A9 08 LDA #$08
1116 .C:c7b9 85 6E STA $6E
1117 .C:c7bb A0 01 LDY #$01
1118 .C:c7bd B1 6D LDA ($6D),Y
1119 .C:c7bf C9 80 CMP #$80
1120 .C:c7c1 D0 06 BNE $C7C9
1121 .C:c7c3 A9 00 LDA #$00
1122 .C:c7c5 91 6D STA ($6D),Y
1123 .C:c7c7 F0 10 BEQ $C7D9
1124 .C:c7c9 C9 03 CMP #$03
1125 .C:c7cb D0 0C BNE $C7D9
1127 .C:c7ce B1 6D LDA ($6D),Y
1129 .C:c7d1 C9 00 CMP #$00
1130 .C:c7d3 D0 04 BNE $C7D9
1131 .C:c7d5 A9 08 LDA #$08
1132 .C:c7d7 91 6D STA ($6D),Y
1133 .C:c7d9 E6 6D INC $6D
1134 .C:c7db A5 6D LDA $6D
1135 .C:c7dd D0 DE BNE $C7BD
1136 .C:c7df E6 6E INC $6E
1137 .C:c7e1 A5 6E LDA $6E
1138 .C:c7e3 C9 0C CMP #$0C
1139 .C:c7e5 D0 D6 BNE $C7BD
1146 crazy dream 9 game cave extras
1147 ------------------------------
1148 the number of the currently played cave is stored at $3d07.
1149 this is compared to 0x07, 0x17, ...
1150 and different cave setup routines are called.
1152 .C:c7f0 AD 07 3D LDA $3D07 ; cave number
1153 .C:c7f3 C9 07 CMP #$07
1154 .C:c7f5 D0 02 BNE $C7F9
1155 .C:c7f7 F0 20 BEQ $C819 ; c819, if number=7 (random maze) - solved
1156 .C:c7f9 C9 17 CMP #$17
1157 .C:c7fb D0 06 BNE $C803
1158 .C:c7fd 4C 00 CB JMP $CB00 ; cb00, if number=23 (rockfall) - solved
1159 .C:c800 4C F0 C7 JMP $C7F0
1160 .C:c803 C9 13 CMP #$13
1161 .C:c805 D0 03 BNE $C80A
1162 .C:c807 4C 60 CA JMP $CA60 ; ca60, if number=19 (all the way)
1163 .C:c80a C9 0E CMP #$0E
1164 .C:c80c D0 03 BNE $C811
1165 .C:c80e 4C 10 C9 JMP $C910 ; c910, if number=14 (metamorphosis) - solved
1166 .C:c811 C9 15 CMP #$15
1167 .C:c813 D0 03 BNE $C818
1168 .C:c815 4C 20 CA JMP $CA20 ; ca20, if number=21 (roll dice now) - solved
1169 .C:c818 60 RTS ; exit
1171 cave named "RANDOM MAZE" setup
1172 ------------------------------
1173 what this thing does, is that it looks for a bladder spender in the cave.
1174 if it found a bladder spender, it decides a random direction.
1175 checks if there is an invisible outbox in that direction, if there is, it carves a path.
1176 and looks for the spender throughout the cave.
1177 if end of the cave, it starts over again; until there is are no more invisible outboxes.
1178 at that point, we have a carved path of bladder spenders; they are changed to dirt.
1180 .C:c819 A9 49 LDA #$49 ; $6d -> 0849
1181 .C:c81b 85 6D STA $6D
1182 .C:c81d A9 08 LDA #$08
1183 .C:c81f 85 6E STA $6E
1184 .C:c821 A9 00 LDA #$00
1188 .C:c826 85 71 STA $71 ; $71=0
1189 .C:c828 A0 80 LDY #$80 ; y=0x80 ; THE ELEMENT WE CHECK IS AT $6d+0x80
1190 .C:c82a B1 6D LDA ($6D),Y ; load element from address
1191 .C:c82c C9 1E CMP #$1E ; is it a bladder spender?
1192 .C:c82e D0 5B BNE $C88B ; if not, c88b
1193 .C:c830 20 00 25 JSR $2500 ; unpredictable random to acc
1194 .C:c833 29 03 AND #$03 ; &0x03
1195 .C:c835 D0 12 BNE $C849 ; if nonzero, c849
1197 .C:c837 A0 30 LDY #$30 ; <- if random&3=0
1198 .C:c839 B1 6D LDA ($6D),Y ; what is at $6d+0x30, (0x80-0x30)=0x50, that is, two rows UP (y-2)
1199 .C:c83b C9 06 CMP #$06 ; is it an invisible outbox there?
1200 .C:c83d D0 54 BNE $C893 ; if not, c893 - check next address
1201 .C:c83f A9 1E LDA #$1E ; if invisible outbox, store bladder spender to y-2
1202 .C:c841 91 6D STA ($6D),Y
1203 .C:c843 A0 58 LDY #$58 ; store bladder spender to $6d+0x58, (0x80-0x58), to y-1
1204 .C:c845 91 6D STA ($6D),Y
1205 .C:c847 D0 4A BNE $C893 ; always branch to c893
1206 .C:c849 C9 01 CMP #$01 ; is it 1?
1207 .C:c84b D0 12 BNE $C85F ; if not one, c85f
1209 .C:c84d A0 82 LDY #$82 ; <- if random&3=1
1210 .C:c84f B1 6D LDA ($6D),Y ; what is at $6d+0x82, (0x82-0x80)=0x02, that is, two columns RIGHT (x+2)
1211 .C:c851 C9 06 CMP #$06
1212 .C:c853 D0 3E BNE $C893
1213 .C:c855 A9 1E LDA #$1E
1214 .C:c857 91 6D STA ($6D),Y
1215 .C:c859 A0 81 LDY #$81
1216 .C:c85b 91 6D STA ($6D),Y
1217 .C:c85d D0 34 BNE $C893
1218 .C:c85f C9 02 CMP #$02 ; is it 2?
1219 .C:c861 D0 12 BNE $C875 ; if not, c875
1221 .C:c863 A0 D0 LDY #$D0 ; <- if random&3=2
1222 .C:c865 B1 6D LDA ($6D),Y ; two rows DOWN (y+2)
1223 .C:c867 C9 06 CMP #$06
1224 .C:c869 D0 28 BNE $C893
1225 .C:c86b A9 1E LDA #$1E
1226 .C:c86d 91 6D STA ($6D),Y
1227 .C:c86f A0 A8 LDY #$A8
1228 .C:c871 91 6D STA ($6D),Y
1229 .C:c873 D0 1E BNE $C893
1230 .C:c875 C9 03 CMP #$03
1231 .C:c877 D0 12 BNE $C88B ; if not 3 (how is that possible?!), c88b - this can't happen.
1233 .C:c879 A0 7E LDY #$7E ; <- if random&3=3
1234 .C:c87b B1 6D LDA ($6D),Y ; two columns LEFT (x-2)
1235 .C:c87d C9 06 CMP #$06
1236 .C:c87f D0 12 BNE $C893
1237 .C:c881 A9 1E LDA #$1E
1238 .C:c883 91 6D STA ($6D),Y
1239 .C:c885 A0 7F LDY #$7F
1240 .C:c887 91 6D STA ($6D),Y
1241 .C:c889 D0 08 BNE $C893 ; always branch
1243 .C:c88b C9 06 CMP #$06 ; is the loaded element an invisible outbox?
1244 .C:c88d D0 04 BNE $C893 ; if not, c893 - just check next address.
1245 .C:c88f A9 01 LDA #$01 ; if invisible outbox, store 0x01 - that means, we still have parts to fill.
1246 .C:c891 85 71 STA $71 ; to $71
1248 .C:c893 18 CLC ; increment address
1249 .C:c894 A5 6D LDA $6D
1250 .C:c896 69 02 ADC #$02 ; add two bytes to address
1251 .C:c898 85 6D STA $6D
1252 .C:c89a 90 02 BCC $C89E
1253 .C:c89c E6 6E INC $6E
1256 .C:c8a0 A5 6E LDA $6E
1257 .C:c8a2 C9 0B CMP #$0B
1258 .C:c8a4 90 82 BCC $C828 ; jump to c828 if still inside address range
1259 .C:c8a6 A5 6D LDA $6D
1260 .C:c8a8 C9 00 CMP #$00
1261 .C:c8aa 90 F8 BCC $C8A4
1262 .C:c8ac A5 71 LDA $71 ; if $71 is...
1263 .C:c8ae F0 03 BEQ $C8B3
1264 .C:c8b0 4C 19 C8 JMP $C819 ; non zero, start all over
1267 ; if outside address range, and $71 is zero...
1268 ; this part checks the whole cave, and changes
1269 ; the bladder spender to a dirt.
1270 .C:c8b3 A9 00 LDA #$00
1271 .C:c8b5 85 6D STA $6D ; now we have 0b00 at $6d
1272 .C:c8b7 A2 01 LDX #$01
1273 .C:c8b9 A0 00 LDY #$00
1274 .C:c8bb B1 6D LDA ($6D),Y ; load thing at address
1275 .C:c8bd C9 1E CMP #$1E ; is it a bladder spender?
1276 .C:c8bf D0 04 BNE $C8C5
1277 .C:c8c1 A9 01 LDA #$01 ; if it is, change to dirt
1278 .C:c8c3 91 6D STA ($6D),Y
1279 .C:c8c5 88 DEY ; decrement y
1280 .C:c8c6 D0 F3 BNE $C8BB
1281 .C:c8c8 C6 6E DEC $6E
1282 .C:c8ca A5 6E LDA $6E
1283 .C:c8cc C9 07 CMP #$07 ; go back until $6d is 0x700
1284 .C:c8ce D0 EB BNE $C8BB
1285 .C:c8d0 60 RTS ; and finish
1289 .C:c8d3 A5 6D LDA $6D
1290 .C:c8d5 69 A0 ADC #$A0
1291 .C:c8d7 85 8B STA $8B
1292 .C:c8d9 A5 6E LDA $6E
1293 .C:c8db 69 00 ADC #$00
1294 .C:c8dd 85 8C STA $8C
1295 .C:c8df A0 80 LDY #$80
1296 .C:c8e1 B1 8B LDA ($8B),Y
1297 .C:c8e3 C9 06 CMP #$06
1301 cave random fill - for cave "roll dice"
1302 ---------------------------------------
1303 .C:ca20 A9 00 LDA #$00
1304 .C:ca22 85 6D STA $6D
1305 .C:ca24 A9 08 LDA #$08
1306 .C:ca26 85 6E STA $6E
1307 .C:ca28 A0 00 LDY #$00
1308 .C:ca2a B1 6D LDA ($6D),Y
1309 .C:ca2c C9 1E CMP #$1E
1310 .C:ca2e D0 17 BNE $CA47
1311 .C:ca30 20 00 25 JSR $2500
1312 .C:ca33 C9 08 CMP #$08
1313 .C:ca35 B0 04 BCS $CA3B
1314 .C:ca37 A9 30 LDA #$30 ; $08, butterfly
1315 .C:ca39 D0 0A BNE $CA45
1316 .C:ca3b C9 18 CMP #$18 ; $18, stone
1317 .C:ca3d B0 04 BCS $CA43
1318 .C:ca3f A9 10 LDA #$10
1319 .C:ca41 D0 02 BNE $CA45
1320 .C:ca43 A9 01 LDA #$01 ; dirt
1321 .C:ca45 91 6D STA ($6D),Y
1323 .C:ca48 D0 E0 BNE $CA2A
1324 .C:ca4a E6 6E INC $6E
1325 .C:ca4c A5 6E LDA $6E
1326 .C:ca4e C9 0C CMP #$0C
1327 .C:ca50 D0 D6 BNE $CA28
1331 cave random fill - for cave "rockfall"
1332 --------------------------------------
1333 .C:cb00 A9 00 LDA #$00 ; starting address=0800
1334 .C:cb02 85 6D STA $6D
1335 .C:cb04 A9 08 LDA #$08
1336 .C:cb06 85 6E STA $6E
1337 .C:cb08 A0 00 LDY #$00
1338 .C:cb0a B1 6D LDA ($6D),Y ; load element at address
1339 .C:cb0c C9 1E CMP #$1E ; is it the bladder spender?
1340 .C:cb0e D0 1F BNE $CB2F ; if not, go to cb2f
1341 .C:cb10 20 00 25 JSR $2500 ; unpredictable random to acc
1342 .C:cb13 C9 02 CMP #$02
1343 .C:cb15 B0 04 BCS $CB1B ; less than 0x02->cb1b
1344 .C:cb17 A9 64 LDA #$64 ; load 0x64 (acid)
1345 .C:cb19 D0 12 BNE $CB2D ; always jump to store
1346 .C:cb1b C9 20 CMP #$20
1347 .C:cb1d B0 04 BCS $CB23 ; less than 0x20->cb23
1348 .C:cb1f A9 10 LDA #$10 ; load 0x10 (stone)
1349 .C:cb21 D0 0A BNE $CB2D ; always jump
1350 .C:cb23 C9 25 CMP #$25 ; less than 0x25
1351 .C:cb25 B0 04 BCS $CB2B
1352 .C:cb27 A9 14 LDA #$14 ; diamond
1353 .C:cb29 D0 02 BNE $CB2D
1354 .C:cb2b A9 01 LDA #$01 ; dirt.
1355 .C:cb2d 91 6D STA ($6D),Y ; store acc to cave
1357 .C:cb30 D0 D8 BNE $CB0A
1358 .C:cb32 E6 6E INC $6E
1359 .C:cb34 A5 6E LDA $6E
1360 .C:cb36 C9 0C CMP #$0C
1361 .C:cb38 D0 CE BNE $CB08
1367 cave "metamorphosis" extra setup in crazy dream 9
1368 -------------------------------------------------
1369 same maze routine, but do the carving like x, x+2, x+4.
1370 later, the bladder spenders are replaced by 3x3 invisible outboxes;
1371 and the invisible outboxes are replaced with random elements.
1374 .C:c8d2 18 CLC ; load element at (x, y+4)
1375 .C:c8d3 A5 6D LDA $6D
1376 .C:c8d5 69 A0 ADC #$A0
1377 .C:c8d7 85 8B STA $8B
1378 .C:c8d9 A5 6E LDA $6E
1379 .C:c8db 69 00 ADC #$00
1380 .C:c8dd 85 8C STA $8C
1381 .C:c8df A0 80 LDY #$80
1382 .C:c8e1 B1 8B LDA ($8B),Y
1383 .C:c8e3 C9 06 CMP #$06 ; and compare to invisible outbox
1386 .C:c8e6 38 SEC ; load element at (x, y-4)
1387 .C:c8e7 A5 6D LDA $6D
1388 .C:c8e9 E9 A0 SBC #$A0
1389 .C:c8eb 85 8B STA $8B
1390 .C:c8ed A5 6E LDA $6E
1391 .C:c8ef E9 00 SBC #$00
1392 .C:c8f1 85 8C STA $8C
1393 .C:c8f3 A0 80 LDY #$80
1394 .C:c8f5 B1 8B LDA ($8B),Y
1395 .C:c8f7 C9 06 CMP #$06 ; compare to invisible outbox
1398 .C:c900 A9 FD LDA #$FD ; this changes the start address at the c919 routine to 07fd
1399 .C:c902 8D 1A C9 STA $C91A
1400 .C:c905 A9 07 LDA #$07
1401 .C:c907 8D 1E C9 STA $C91E
1404 .C:c910 20 00 C9 JSR $C900 ;;;;;;;;;;;;;;;;;;;;;; we start here.
1405 .C:c913 20 19 C9 JSR $C919
1406 .C:c916 4C B4 C9 JMP $C9B4
1408 .C:c919 A9 FA LDA #$FA ; this is 07fa or 07fd (it is also used by "all the way")
1409 .C:c91b 85 6D STA $6D
1410 .C:c91d A9 07 LDA #$07
1411 .C:c91f 85 6E STA $6E
1412 .C:c921 A9 00 LDA #$00
1416 .C:c926 85 71 STA $71 ; store zero to $71
1418 .C:c928 A0 80 LDY #$80 ; load element at current position
1419 .C:c92a B1 6D LDA ($6D),Y
1420 .C:c92c C9 1E CMP #$1E
1421 .C:c92e D0 5B BNE $C98B
1422 .C:c930 20 00 25 JSR $2500 ; if it is a bladder spender, create unpredictable random
1423 .C:c933 29 03 AND #$03 ; &0x03
1424 .C:c935 D0 12 BNE $C949 ; if not zero, c949
1426 .C:c937 20 E6 C8 JSR $C8E6 ; if it is a zero, jsr c8e6
1430 .C:c93d D0 54 BNE $C993 ; if it is not an invisible outbox, "finish"
1431 .C:c93f A9 1E LDA #$1E
1432 .C:c941 91 8B STA ($8B),Y
1433 .C:c943 A0 30 LDY #$30
1434 .C:c945 91 6D STA ($6D),Y
1435 .C:c947 D0 4A BNE $C993 ; always branch to c993 (increment address)
1437 .C:c949 C9 01 CMP #$01
1438 .C:c94b D0 12 BNE $C95F
1439 .C:c94d A0 84 LDY #$84 ; if it is 1
1440 .C:c94f B1 6D LDA ($6D),Y ; what is at (x+4, y)
1441 .C:c951 C9 06 CMP #$06
1442 .C:c953 D0 3E BNE $C993
1443 .C:c955 A9 1E LDA #$1E
1444 .C:c957 91 6D STA ($6D),Y ; store bladder spender to x+4,y
1445 .C:c959 A0 82 LDY #$82
1446 .C:c95b 91 6D STA ($6D),Y ; store bladder spender to x+2,y
1447 .C:c95d D0 34 BNE $C993
1449 .C:c95f C9 02 CMP #$02
1450 .C:c961 D0 12 BNE $C975
1451 .C:c963 20 D2 C8 JSR $C8D2 ; if it is 2, gosub c8d2
1454 .C:c968 D0 29 BNE $C993
1456 .C:c96b A9 1E LDA #$1E
1457 .C:c96d 91 8B STA ($8B),Y
1458 .C:c96f A0 D0 LDY #$D0
1459 .C:c971 91 6D STA ($6D),Y
1460 .C:c973 D0 1E BNE $C993
1461 .C:c975 C9 03 CMP #$03
1462 .C:c977 D0 12 BNE $C98B
1463 .C:c979 A0 7C LDY #$7C
1464 .C:c97b B1 6D LDA ($6D),Y
1465 .C:c97d C9 06 CMP #$06
1466 .C:c97f D0 12 BNE $C993
1467 .C:c981 A9 1E LDA #$1E
1468 .C:c983 91 6D STA ($6D),Y
1469 .C:c985 A0 7E LDY #$7E
1470 .C:c987 91 6D STA ($6D),Y
1471 .C:c989 D0 08 BNE $C993
1472 .C:c98b C9 06 CMP #$06 ; is it an invisible outbox?
1473 .C:c98d D0 04 BNE $C993 ; if no, jump to increment
1474 .C:c98f A9 01 LDA #$01 ; if yes, store 0x01 to 71 - so we will start again
1475 .C:c991 85 71 STA $71
1477 .C:c993 18 CLC ; increment address by 2
1478 .C:c994 A5 6D LDA $6D
1479 .C:c996 69 02 ADC #$02
1480 .C:c998 85 6D STA $6D
1481 .C:c99a 90 02 BCC $C99E
1482 .C:c99c E6 6E INC $6E
1485 .C:c9a0 A5 6E LDA $6E
1486 .C:c9a2 C9 0B CMP #$0B
1487 .C:c9a4 90 82 BCC $C928
1488 .C:c9a6 A5 6D LDA $6D
1489 .C:c9a8 C9 00 CMP #$00
1490 .C:c9aa 90 F8 BCC $C9A4
1491 .C:c9ac A5 71 LDA $71
1492 .C:c9ae F0 03 BEQ $C9B3
1493 .C:c9b0 4C 19 C9 JMP $C919
1496 .C:c9b4 A9 E8 LDA #$E8 ; cave setup finish routine
1497 .C:c9b6 85 6D STA $6D
1498 .C:c9b8 A9 07 LDA #$07 ; 07e8 to $6d
1499 .C:c9ba 85 6E STA $6E
1500 .C:c9bc A0 80 LDY #$80 ; we check $6d+0x80
1501 .C:c9be B1 6D LDA ($6D),Y
1502 .C:c9c0 C9 1E CMP #$1E ; is it a bladder spender?
1503 .C:c9c2 D0 20 BNE $C9E4
1504 .C:c9c4 A9 06 LDA #$06 ; if it is a bladder spender; draw a 3x3 rectange of invisible outboxes
1505 .C:c9c6 A0 57 LDY #$57 ;
1506 .C:c9c8 91 6D STA ($6D),Y ; outbox to (x-1,y-1)
1508 .C:c9cb 91 6D STA ($6D),Y ; outbox to (x,y-1)
1510 .C:c9ce 91 6D STA ($6D),Y ; outbox to (x+1,y-1)
1511 .C:c9d0 A0 7F LDY #$7F
1512 .C:c9d2 91 6D STA ($6D),Y ; outbox to (x-1,y)
1514 .C:c9d5 91 6D STA ($6D),Y ; outbox to (x,y)
1516 .C:c9d8 91 6D STA ($6D),Y ; outbox to (x+1,y)
1517 .C:c9da A0 A7 LDY #$A7
1518 .C:c9dc 91 6D STA ($6D),Y ; outbox to (x-1,y+1)
1520 .C:c9df 91 6D STA ($6D),Y ; outbox to (x,y+1)
1522 .C:c9e2 91 6D STA ($6D),Y ; outbox to (x,y+1)
1523 .C:c9e4 E6 6D INC $6D ; increment address
1524 .C:c9e6 A5 6D LDA $6D
1525 .C:c9e8 D0 D2 BNE $C9BC ; if not finished, c9bc
1526 .C:c9ea E6 6E INC $6E
1527 .C:c9ec A5 6E LDA $6E
1528 .C:c9ee C9 0B CMP #$0B
1529 .C:c9f0 D0 CA BNE $C9BC
1530 ; drawing 3x3 outboxes finished.
1531 .C:c9f2 A9 00 LDA #$00 ; 0x0800 to $6d
1532 .C:c9f4 85 6D STA $6D
1533 .C:c9f6 A9 08 LDA #$08
1534 .C:c9f8 85 6E STA $6E
1535 .C:c9fa A0 00 LDY #$00
1536 .C:c9fc B1 6D LDA ($6D),Y
1537 .C:c9fe C9 06 CMP #$06
1538 .C:ca00 D0 0F BNE $CA11
1539 .C:ca02 20 00 25 JSR $2500 ; unpredictable random
1540 .C:ca05 C9 18 CMP #$18
1541 .C:ca07 90 04 BCC $CA0D
1542 .C:ca09 A9 01 LDA #$01 ; dirt
1543 .C:ca0b D0 02 BNE $CA0F
1544 .C:ca0d A9 10 LDA #$10 ; stone
1545 .C:ca0f 91 6D STA ($6D),Y ; store chosen element.
1547 .C:ca12 D0 E8 BNE $C9FC
1548 .C:ca14 E6 6E INC $6E
1549 .C:ca16 A5 6E LDA $6E
1550 .C:ca18 C9 0C CMP #$0C
1551 .C:ca1a D0 DE BNE $C9FA
1557 crazy dream 9 - all the way
1558 ---------------------------
1559 .C:ca60 A9 FA LDA #$FA
1560 .C:ca62 8D 1A C9 STA $C91A
1561 .C:ca65 A9 07 LDA #$07
1562 .C:ca67 8D 1E C9 STA $C91E
1563 .C:ca6a 20 19 C9 JSR $C919 ; create a x,x+2,x+4-like maze, like in metamorphosis
1565 .C:ca6d A9 FA LDA #$FA ; 07fa to $6d
1566 .C:ca6f 85 6D STA $6D
1567 .C:ca71 A9 07 LDA #$07
1568 .C:ca73 85 6E STA $6E
1570 .C:ca75 A0 80 LDY #$80 ; 0x80 to y
1571 .C:ca77 A2 1F LDX #$1F ; x=pre_diamond_1
1572 .C:ca79 B1 6D LDA ($6D),Y ; what is at x,y?
1573 .C:ca7b C9 1E CMP #$1E ; is it a bladder spender?
1574 .C:ca7d D0 45 BNE $CAC4
1575 ; if there is a bladder spender at x,y vvvvvvvvvv
1576 .C:ca7f 8A TXA ; acc=pre_diamond_1
1577 .C:ca80 A0 57 LDY #$57
1578 .C:ca82 91 6D STA ($6D),Y ; x-1,y-1=pre_dia_1
1579 .C:ca84 A0 59 LDY #$59
1580 .C:ca86 91 6D STA ($6D),Y ; x+1,y-1=pre_dia_1
1581 .C:ca88 A0 A7 LDY #$A7
1582 .C:ca8a 91 6D STA ($6D),Y ; x-1,y+1=pre_dia_1
1583 .C:ca8c A0 A9 LDY #$A9
1584 .C:ca8e 91 6D STA ($6D),Y ; x+1,y+1=pre_dia_1
1586 .C:ca90 A0 30 LDY #$30
1587 .C:ca92 B1 6D LDA ($6D),Y ; what is at x,y-2
1588 .C:ca94 C9 1E CMP #$1E ; is it a bladder spender?
1589 .C:ca96 F0 05 BEQ $CA9D ; if yes, branch
1590 .C:ca98 8A TXA ; if not bladder spender
1591 .C:ca99 A0 58 LDY #$58
1592 .C:ca9b 91 6D STA ($6D),Y ; store pre_dia to x,y-1
1594 .C:ca9d A0 7E LDY #$7E ; what is at x-2,y
1595 .C:ca9f B1 6D LDA ($6D),Y
1596 .C:caa1 C9 1E CMP #$1E ; is it a bladder spender?
1597 .C:caa3 F0 05 BEQ $CAAA ; if yes, branch
1598 .C:caa5 8A TXA ; if not, store pre_dia to x-1,y
1599 .C:caa6 A0 7F LDY #$7F
1600 .C:caa8 91 6D STA ($6D),Y
1602 .C:caaa A0 D0 LDY #$D0 ; what is at x,y+2
1603 .C:caac B1 6D LDA ($6D),Y
1604 .C:caae C9 1E CMP #$1E
1605 .C:cab0 F0 05 BEQ $CAB7
1607 .C:cab3 A0 A8 LDY #$A8
1608 .C:cab5 91 6D STA ($6D),Y
1610 .C:cab7 A0 82 LDY #$82 ; what is at x+2,y
1611 .C:cab9 B1 6D LDA ($6D),Y
1612 .C:cabb C9 1E CMP #$1E
1613 .C:cabd F0 05 BEQ $CAC4
1614 .C:cabf 8A TXA ; if bladder spender, store pre_dia_1 to x+1,y
1615 .C:cac0 A0 81 LDY #$81
1616 .C:cac2 91 6D STA ($6D),Y
1618 .C:cac4 E6 6D INC $6D ; increment address
1619 .C:cac6 A5 6D LDA $6D
1620 .C:cac8 D0 AB BNE $CA75
1621 .C:caca E6 6E INC $6E
1622 .C:cacc A5 6E LDA $6E
1623 .C:cace C9 0C CMP #$0C
1624 .C:cad0 D0 A3 BNE $CA75 ; if still in cave memory, go up
1625 ; finished cave memory.
1627 .C:cad2 A2 02 LDX #$02 ; replace remaining bladder spenders with brick wall
1628 .C:cad4 8E 1B 0B STX $0B1B
1629 .C:cad7 A9 00 LDA #$00
1630 .C:cad9 85 6D STA $6D
1631 .C:cadb A9 08 LDA #$08
1632 .C:cadd 85 6E STA $6E
1633 .C:cadf A0 00 LDY #$00
1634 .C:cae1 B1 6D LDA ($6D),Y
1635 .C:cae3 C9 1E CMP #$1E
1636 .C:cae5 D0 03 BNE $CAEA
1638 .C:cae8 91 6D STA ($6D),Y
1640 .C:caeb D0 F4 BNE $CAE1
1641 .C:caed E6 6E INC $6E
1642 .C:caef A5 6E LDA $6E
1643 .C:caf1 C9 0C CMP #$0C
1644 .C:caf3 D0 EC BNE $CAE1
1651 (taken from crazy dream 2, an 1stb engine)
1652 $40 = bladder, code 467a
1653 $41-$48->bladder stages, code 481f
1659 .C:467a B1 6D LDA ($6D),Y ; what is at current position
1661 .C:467d BD 80 42 LDA $4280,X ; load from effect table
1662 .C:4680 91 6D STA ($6D),Y ; store
1663 .C:4682 E6 6D INC $6D ; increment coordinates
1664 .C:4684 D0 02 BNE $4688 ; ...
1665 .C:4686 E6 6E INC $6E ; ... not important from here.
1666 .C:4688 E6 8B INC $8B
1667 .C:468a A5 8B LDA $8B
1668 .C:468c C9 28 CMP #$28
1671 ... removes "scanned" bits.
1672 >C:4280 00 01 02 03 04 05 06 07 08 09 0a 0b 08 09 0a 0b ................
1673 >C:4290 10 10 12 12 14 14 16 16 19 19 1a 1b 1c 1d 1e 20 ...............
1674 >C:42a0 20 21 22 23 24 25 26 27 28 29 2a 2a 2c 2d 2e 2f !"#$%&'()**,-./
1675 >C:42b0 30 31 32 33 30 31 32 33 38 39 3a 3b 3d 3d 3e 3f 0123012389:;==>?
1676 >C:42c0 41 41 42 43 44 45 46 47 48 48 4b 4b 4c 4d 4e 4f AABCDEFGHHKKLMNO
1677 >C:42d0 50 50 52 52 54 54 56 57 57 5a 5a 5b 5c 5d 5e 5f PPRRTTVWWZZ[\]^_
1678 >C:42e0 61 61 62 63 64 64 67 67 68 69 6a 6b 6c 6d 6e 6f aabcddgghijklmno
1679 >C:42f0 70 70 72 72 75 75 76 77 78 79 7a 7b 78 79 7a 7b pprruuvwxyz{xyz{
1680 >C:4300 f0 2e e0 17 f0 10 a6 8b f0 4d e0 26 90 4f f0 53 .........M.&.O.S
1682 so $40 is translated to $41
1683 $49 translated to $48
1684 others are not translated.
1689 .C:481a A9 19 LDA #$19 ; found a mrs rockford, store CLOCK BIRTH STAGE 2!!!
1690 .C:481c 4C 31 25 JMP $2531
1692 .C:481f A2 03 LDX #$03
1693 .C:4821 BC F5 49 LDY $49F5,X ; >C:49f5 01 28 2a 51
1694 .C:4824 B1 6D LDA ($6D),Y
1695 .C:4826 C9 56 CMP #$56 ; is a mrs rockford _over_ the bladder?
1696 .C:4828 F0 F0 BEQ $481A ; if yes, convert.
1697 .C:482a CA DEX ; right to it? left to it?
1698 .C:482b 10 F4 BPL $4821 ; check other directions
1700 ; NOT TOUCHING MRS ROCKFORD,
1701 ; let's see if it can move.
1702 .C:482d A0 29 LDY #$29
1703 .C:482f B1 6D LDA ($6D),Y ; loads current element (bladder_n)
1704 .C:4831 AA TAX ; puts to x
1705 .C:4832 A0 01 LDY #$01 ; what is over?
1706 .C:4834 B1 6D LDA ($6D),Y
1707 .C:4836 D0 19 BNE $4851 ; if not space, 4851 (that checks if brick wall)
1709 ; IF SPACE over bladder...
1710 .C:4838 E0 48 CPX #$48 ; is it bladder stage8?
1711 .C:483a F0 0D BEQ $4849 ; if yes (store $40 to x,y and finish)
1712 .C:483c D0 02 BNE $4840 ; if not, this always jumps; increments its waiting stage, stays at in place
1713 .C:483e A2 40 LDX #$40 ; X=$40
1715 .C:4840 E8 INX ; X++ - add one
1716 .C:4841 A0 29 LDY #$29
1718 .C:4844 91 6D STA ($6D),Y ; store X to x,y.
1719 .C:4846 4C 82 46 JMP $4682 ; finish
1721 .C:4849 A9 40 LDA #$40 ; $40=bladder0
1722 .C:484b 20 69 43 JSR $4369 ; translate and finish
1723 .C:484e 4C 2F 25 JMP $252F
1725 ; we jump here if NOT A SPACE the bladder.
1726 .C:4851 C9 02 CMP #$02 ; is it brick wall;
1727 .C:4853 D0 E9 BNE $483E ; not a brick wall; store a bladder$41 and finish.
1729 ; it is brick wall over bladder.
1730 .C:4855 A0 00 LDY #$00 ; ... if space at x-1, y-1
1731 .C:4857 B1 6D LDA ($6D),Y
1732 .C:4859 D0 0C BNE $4867
1733 .C:485b A0 28 LDY #$28 ; ... and space at x-1, x
1734 .C:485d B1 6D LDA ($6D),Y
1735 .C:485f D0 06 BNE $4867
1736 .C:4861 E0 48 CPX #$48 ; ... and it is a bladder_8
1737 .C:4863 F0 12 BEQ $4877 ; jump to 4877, which adds 1 and does some effect translation
1738 .C:4865 D0 D9 BNE $4840 ; always jumps; if not bladder_8. adds one to X, stores to x,y, and finish
1739 .C:4867 A0 02 LDY #$02 ; what is at x+1, y-1
1740 .C:4869 B1 6D LDA ($6D),Y
1741 .C:486b D0 D1 BNE $483E ; not space - store a $41
1742 .C:486d A0 2A LDY #$2A
1743 .C:486f B1 6D LDA ($6D),Y
1744 .C:4871 D0 CB BNE $483E ; not space - store a $41
1745 .C:4873 E0 48 CPX #$48
1746 .C:4875 D0 C9 BNE $4840 ; if not $48, increment waiting stage
1747 .C:4877 E8 INX ; it is $48. add 1, then $49
1748 .C:4878 8A TXA ; to accu
1749 .C:4879 20 69 43 JSR $4369 ; do some effect translation - it becomes $48 again
1750 .C:487c 4C 2F 25 JMP $252F ; done
1755 .C:4369 A6 8C LDX $8C
1756 .C:436b E0 05 CPX #$05
1757 .C:436d 90 2C BCC $439B
1758 .C:436f E0 16 CPX #$16
1759 .C:4371 B0 8D BCS $4300
1760 .C:4373 C0 2A CPY #$2A
1761 .C:4375 B0 04 BCS $437B
1763 .C:4378 BD 80 42 LDA $4280,X ; put scanned or normal element?
1764 .C:437b 85 84 STA $84
1765 .C:437d 91 6D STA ($6D),Y
1766 .C:437f A5 8C LDA $8C
1769 .C:4383 A5 8B LDA $8B
1772 .C:4387 7D C8 25 ADC $25C8,X
1773 .C:438a 85 6F STA $6F
1774 .C:438c A9 00 LDA #$00
1775 .C:438e 7D C9 25 ADC $25C9,X
1776 .C:4391 85 70 STA $70
1777 .C:4393 20 1A 50 JSR $501A
1778 .C:4396 4C 00 3B JMP $3B00
1790 sub_7555: ; CODE XREF: sub_75A9
\r
1797 STA VARIABLES +$08
\r
1799 ; ---------------------------------------------------------------------------
\r
1801 loc_7565: ; CODE XREF: sub_7555+6
\r
1806 STA VARIABLES +$08
\r
1808 ; ---------------------------------------------------------------------------
\r
1810 loc_7571: ; CODE XREF: sub_7555+12
\r
1811 CMP #$14 ; IS IT A DIAMOND?
\r
1814 ; ---------------------------------------------------------------------------
\r
1816 loc_7578: ; CODE XREF: sub_7555+1E
\r
1817 CMP #5 ; IS IT AN OPEN EXIT?
\r
1825 loc_7586: ; CODE XREF: sub_7555+25
\r
1826 CMP #$10 ; IS IT A STONE?
\r
1829 BNE loc_7599 ; jump if not pushing left
\r
1832 BNE loc_7597 ; jump if not space left to the boulder
\r
1833 JSR sub_7543 ; move stone
\r
1835 loc_7597: ; CODE XREF: sub_7555+3D
\r
1838 loc_7599: ; CODE XREF: sub_7555+37
\r
1840 BNE locret_75A8 ; jump if not pushing right
\r
1846 loc_75A6: ; CODE XREF: sub_7555+4C
\r
1849 locret_75A8: ; CODE XREF: sub_7555+33 sub_7555+46
\r
1851 ; End of function sub_7555
\r
1860 sub_7543: ; CODE XREF: sub_7555+3F sub_7555+4E
\r
1861 JSR random ; random number
\r
1862 AND #3 ; &3 -> 0..3
\r
1863 BNE locret_7554 ; if nonzero (3 of 4 cases), return
\r
1869 locret_7554: ; CODE XREF: sub_7543+5
\r
1871 ; End of function sub_7543
\r
1877 same code in crazy light tutorial prg:
1878 .C:5123 C9 10 CMP #$10 ; boulder?
1879 .C:5125 D0 20 BNE $5147 ; jump to other checking if not
1880 .C:5127 C0 28 CPY #$28
1881 .C:5129 D0 0C BNE $5137 ; jump if not pushing left
1882 .C:512b A0 27 LDY #$27 ; what is at 2*left?
1883 .C:512d B1 6D LDA ($6D),Y
1884 .C:512f D0 03 BNE $5134 ; jump if not space.
1885 .C:5131 20 EF 3D JSR $3DEF ; try to push if space!
1886 .C:5134 A0 28 LDY #$28
1888 .C:5137 C0 2A CPY #$2A
1889 .C:5139 D0 0B BNE $5146 ; jump if not pushing right
1890 .C:513b A0 2B LDY #$2B ; what is at 2*right?
1891 .C:513d B1 6D LDA ($6D),Y
1892 .C:513f D0 03 BNE $5144 ; jump if not space.
1893 .C:5141 20 EF 3D JSR $3DEF ; try to push if space!
1894 .C:5144 A0 2A LDY #$2A
1898 .C:3def 20 00 25 JSR $2500 ; same as in frustidash
1899 .C:3df2 29 03 AND #$03
1900 .C:3df4 D0 F5 BNE $3DEB
1901 .C:3df6 E6 AF INC $AF
1902 .C:3df8 A9 11 LDA #$11
1903 .C:3dfa 20 69 43 JSR $4369
1904 .C:3dfd 4C C1 41 JMP $41C1
1910 ROUTINE TO ENABLE HIDDEN CAVE.
1911 runs when a cave is finished successfully
1913 .C:c028 AD 07 3D LDA $3D07 ; cave number played actually
1914 .C:c02b C9 10 CMP #$10 ; is $10? (->cave M)
1915 .C:c02d D0 2B BNE $C05A ; if not, exit
1917 ; checks if $0b4a->0b6f (36 elements) are either boulder or diamond
1918 ; if everywhere, c041
1920 .C:c02f A2 25 LDX #$25 ; loop variable, x=37 (to x=0)
1921 .C:c031 BD 49 0B LDA $0B49,X ; load 0b49+x
1922 ; 0b49 is inside cave data during game
1923 ; 0b49-0800=349, 841 decimally
1924 ; 841/40=row21 (0th is first), col1 (0th is first)
1926 ; so this routine checks, if in cell (1,21)-(25,21)
1927 ; is everywhere boulder or rock
1929 .C:c034 C9 10 CMP #$10 ; is boulder?
1930 .C:c036 F0 06 BEQ $C03E ; if yes, c03e
1931 .C:c038 C9 14 CMP #$14 ; is diamond?
1932 .C:c03a F0 02 BEQ $C03E ; if yes, c03e
1933 .C:c03c D0 1C BNE $C05A ; otherwise finish
1934 .C:c03e CA DEX ; decrement loop var
1935 .C:c03f 10 F0 BPL $C031 ; if still not zero, 031
1937 .C:c041 A9 00 LDA #$00 ; dunno
1938 .C:c043 85 8E STA $8E
1940 .C:c045 A2 27 LDX #$27 ; for x=39 downto 1
1941 .C:c047 A9 05 LDA #$05
1942 .C:c049 9D 00 D8 STA $D800,X ; ($d800+x)=5 (green color)
1943 .C:c04c BD 00 C0 LDA $C000,X ; ($0c00+x)=($c000+x) (HIDDEN CAVE UNVEILED text)
1944 .C:c04f 9D 00 0C STA $0C00,X
1946 .C:c053 10 F2 BPL $C047 ; next
1947 .C:c055 A9 00 LDA #$00 ; make cave 26 selectable
1948 .C:c057 8D 79 70 STA $7079
1949 .C:c05a 4C 6D 3B JMP $3B6D ; finish