1991 · Ocean Software

Toki

This minisite was contributed by air, unorig. It’s currently claimed by unorig who is editing it to reach a Gold tier standard.

The joystick, the pause key, and how far Toki jumps and falls.

Controls

One joystick and two keys

The joystick moves Toki, jumps, and fires. The keyboard has two commands, and a third combination is hidden.

InputWhat it does
Joystick left or rightwalks left $8727 or right $8703
Joystick upjumps straight up $8840
Joystick up-left or up-rightjumps to that side $86D4 $869A
Joystick downon a block that allows it, hands Toki to the second movement routine $87D5
Firefires a shot $AF34
RUN/STOPpauses and resumes $5290
SPACEswitches between sound effects and music $5290
Both joysticks, then the Commodore keyskips a stage: the hidden combination

The game reads joystick port 2 each frame, and reads port 1 instead when port 2 is idle $8572. The four direction bits become a direction byte, and the fire bit becomes a flag, which the movement and shooting routines read.

Shooting

The stick picks the aim

A shot goes where the joystick points when fire is pressed.

On the ground, up aims straight up, up-right and up-left aim diagonally, and right and left aim sideways $AF34. Any other direction aims the way Toki faces. Each weapon record holds one path for every aim direction, so a weapon can send its shots differently in each of the eight directions.

Jumping and falling

The speed of a jump is a table

A jump rises quickly, slows, and falls faster the longer it falls, all from two small tables.

TablePixels per frame, by counter value from 0
Rise $02CE1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 6
Fall $02DF0, 1, 1, 2, 2, 3, 4, 5, 6

The routines for the rise $877A and the fall $87B8 take their step from these tables and move the player's trial position. The rise counter holds the height left to climb and counts down, and any value above 16 reads the last entry, so a jump starts at 6 pixels a frame and slows near the top. The fall counter starts at 0 and stops rising at 8, so a long fall tops out at 6 pixels a frame. The normal jump starts its counter at $38 $08FC, and a jump out of the second movement routine starts it at $10 $922F.