Mail webatequ.in   Home Home

Modifying Rockfall

This is part of a set of pages about Rockfall.

My internal knowledge of Rockfall is rather patchy, so this is just a collection of things I've found out by experimenting. Generally, Rockfall and Rockfall II store things in the same formats but not in the same places.

Object values

At the level of animation frames, there are 31 objects in the game. This table shows which value corresponds to which object. (Five bits can represent 32 items, so there's an unused one at the end.)

Value

Object

Value

Object

Value

Object

Value

Object

0

space

1

grass

2

inner wall

3

outer wall

4

rock

5

exit

6..9

player

10..13

jewel

14..17

bomb

18..21

cyan alien

22, 23

red alien (right)

24, 25

red alien (left)

26..29

purple alien

30

explosion

31

space (again!)

The current level

Rockfall I

Calling the routine at 60312 plays the level whose number is stored at 23422. Afterwards, the flag at 23423 contains zero if the player died, or 5 (for an exit) if he finished the level.

Calling 60321 instead of 60312 (originally a typo I made) plays an interesting garbage level with lots of crazy things going on. I used to play this one regularly.

Rockfall II

A copy of the level being played is stored at 27136. This is the entire level in its current state, so it changes whenever anything moves or animates.

The level is 64 objects wide by 32 high and is stored in left-to-right top-to-bottom order, as you'd read a page of text. Each byte holds one object value, and only the lower five bits are used — so values of 4, 36, 68, etc. would all represent a rock.

Suppose you wanted to make an exit magically appear at the top-left hand corner of the current level (excluding the outer wall), i.e. one row and one column in from the top left. You'd need to poke 27136 + 64 (one row) + 1 (one column), i.e. 27201, with the value 5 (for an exit).

Designing new levels

You can design and test levels for Rockfall or Rockfall II in Ian Collier's Rockfall Designer tool, available on World of Spectrum. Pressing Enter in the designer allows you to save and/or test your level. (The test function tends to crash in 128K mode, so always run the designer in 48K mode.)

The very top and bottom rows of a level are expected to be solid outer wall, so anything you put in them will be "dead": it won't move or animate at all, even to obey gravity. The player can interact with objects in the top and bottom row (e.g. collecting a dead jewel or being killed by a dead alien), but if he enters one of those rows he will usually die.

The leftmost and rightmost columns of a level can contain objects, and in Rockfall II (specifically levels 4 and 9) anything that moves can go out at one side and in at the other, à la Pac-Man. (In Rockfall I, you will vanish and probably die if you try it.) This is purely a consequence of how levels are stored (left to right and top to bottom): the scrolling won't show you what's on the other side, and you will emerge one row higher or lower depending on which way you went.

If you put more than one exit in a level, only the top left one will obey the usual rule of disguising itself as grass until enough jewels are collected; the others will be immediately usable. If you put in more than one player, the top left one will be the one you control. The others act like a strange kind of inner wall: they do not animate, are immune to aliens, and can be crushed by rocks (allowing for certain new types of puzzle, since you can outrun the crushing rock) without any harm befalling the player.

Storage

Levels are stored in left-to-right top-to-bottom order with each byte representing two adjacent objects, as in the following table. Each object can fit into a four-bit representation here because we do not need to store individual animation frames (but note that the red alien can still start facing left or right).

Value

Object

Value

Object

Value

Object

Value

Object

0

space

1

grass

2

inner wall

3

outer wall

4

rock

5

exit

6

player

7

jewel

8

bomb

9

cyan alien

10

red alien (right)

11

red alien (left)

12

purple alien

13..15

not used

The high nybble of each byte is the left-hand object, and the low nybble is the right-hand one. For example, a value of 16 × 8 + 5 = 133 represents a bomb to the left of an exit. The unused values 13..15 produce various combinations of items — sometimes different depending on whether the value is in an odd or even memory location — which I haven't attempted to document.

Levels are stored from 30208 in Rockfall and from 29184 in Rockfall II.

The level format does not include the number of jewels to be collected. These figures are stored from 60798 (Rockfall I) and 58380 (Rockfall II), with each byte holding the jewel count for one level. Values above 99 won't display correctly.

Miscellaneous routines

Rockfall I

60458 waits for a keypress; 60853 prompts the player to redefine the control keys; 61061 performs some kind of initialisation (?); 61208 displays the WOW message when the player wins the game; and 61364 saves a copy of the game to tape, minus the loading screen.

The player's score is stored in 23424 (high byte) and 23425 (low byte).

Designing new graphics

The set of Rockfall graphics is 1024 bytes long. Bitmaps are stored in the order indicated by the table of object values, and each bitmap is 32 bytes long: eight bytes for the top left quarter, eight for the top right, eight for the bottom left, and eight for the bottom right. Since the final object value is not used, the last 32 bytes are used for attributes instead. For example, offset 4 × 32 = 128 holds the top pixel row of the top left quarter of a rock, and offset 31 × 32 + 4 = 996 holds the colour used for rocks.

The four quarters of an object must all be the same colour, but — because there's an object value for each animation frame — that colour can change as the object animates.

Graphics are stored at 27136 in Rockfall and at 26112 in Rockfall II.

This page was last updated 84 days ago.

Top Top of page   Home Home