Skip to content

Instantly share code, notes, and snippets.

@tomaes
Last active May 30, 2019 16:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomaes/5e2e805d6db8913c7e94e3591a138605 to your computer and use it in GitHub Desktop.
Save tomaes/5e2e805d6db8913c7e94e3591a138605 to your computer and use it in GitHub Desktop.
a few notes on block tumble!
"Block Tumble!" is a humble Commodore 64 puzzle game from 1991 in 2KBytes; it features 56(!) levels.
Here are some random notes I took while poking around in memory...
observations:
- the level encoding is fixed: 18 Bytes x 56 = 1008 Bytes
- the level data starts at 0BF9 (in memory), or at 03FA (file offset)
- a better, flexible encoding of the level data should take around ~870 Bytes
(assuming a not-too-crowded field in most levels and on average at least 8 wall stones)
(also: discussing level encoding should be a separate post, as there are MANY options :))
- more lives/"retry" count: set A2 03 to A2 05 (or A2 FF if you don't mind breaking the HUD)
- the cursor flickering is quite annoying; replace EE 27 D0 with EA EA EA (inc $D027 -> nop nop nop) to get rid of it
- to see the end after the first level zero out everything from $40C (file offset) on
- for a more fun end, replace A2 30 A0 12 with A2 01 A0 12 (you get a walls-only level, 3 auto ups and downs of the cursor and the happy end message)
- kill the HUD and make everything even more focused and minimal by setting byte nr. $10 to 0
- the play stones look like 3x3 chars (and they are), but only 20x20 pixels are visible
- copy the following bytes to 03FA to play the last level first: 91 24 94 91 24 94 99 2C 94 91 E6 94 8F 3A 94 9A 58 A4
- copy the following bytes to 03B8 for a nicer cursor sprite: 35 55 54 40 00 02 40 00 02 00 00 00 40 00 02 00 00 00 40 00 02 00 00 00 40 00 02 00 00 00 40 00 02 00 00 00 40 00 02 00 00 00 40 00 02 00 00 00 40 00 02 00 00 00 40 00 02 40 00 02 35 55 54 01
- the playfield is shifted by one element to the left; you can't reach the right-most stones; the author didn't want to write code to get the cursor past $FF
- to speed up the very laggy controls change A2 0A EE to A2 02 EE; in fact, you might want to get rid of this whole section:
08D2 A2 0A LDX #$0A ; --- loop (10x): THIS IS WHY THINGS ARE SLOW!11
08D4 EE 27 D0 INC $D027 ; sprite cursor animation (aka annoying color flickering)
08D7 20 B8 0A JSR $0AB8 ; wait for retrace(!)
08DA CA DEX ;
08DB D0 F7 BNE $08D4 ; --- loop ends
level patches:
- press <space> and skip the current level: 20 C3 0A A6 -> 4C 74 0A A6
(this only alters two bytes; one for JSR -> JMP, and the other to change the high byte of a 16bit jump adress)
- jump to any of the 56 levels (load game first, then poke, then "run"):
poke 2109, ((l*18)+3065) and 255
poke 2111, (((l*18)+3065) and 3840)/256
level encoding:
The encoding in the game code is a bit weird, but this is what it boils down to...
3x8 = 24 bits per row = 3 bits per block element
64x field, but only 48 actual level positions (without top & bottom rows)
001 = red
010 = empty
011 = blue
100 = wall
101 = violet
110 = yellow
111 = yellow wall? (not in game)
level #1
wwwwwwww
89 24 94 w......w 100 010 010 010 010 010 010 100
89 24 94 w......w 100 010 010 010 010 010 010 100
89 24 94 w......w 100 010 010 010 010 010 010 100
8D 24 94 wb.....w 100 011 010 010 010 010 010 100
99 24 94 wy.....w 100 110 010 010 010 010 010 100
91 66 94 ww.yb..w 100 100 010 110 011 010 010 100
wwwwwwww
level #2
wwwwwwww
92 49 24 wwwwwwww 100 100 100 100 100 100 100 100
91 24 94 ww.....w 100 100 010 010 010 010 010 100
91 24 96 w......y 100 100 010 010 010 010 010 110
91 64 94 ww.y...w 100 100 010 110 010 010 010 100
91 54 94 ww.v...w 100 100 010 101 010 010 010 100
91 45 2C ww.w.wvw 100 100 010 100 010 100 101 100
wwwwwwww
possible improvements:
- crunch levels better
- get rid of the "retry" mechanism -> should be infinite, so no game over
- use the gained bytes to add a simple pwd system
- static colour cursor / kill the stupid animation code altogether
- this game is not easy (lv 56 is doable though :P); maybe add some hints? :)
- the "done it" message should be replaced by a looping auto-solving final stage + message on the board or below.
FIN.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment