<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>


Dark Star

The code is presented below:

Dark Star is a puzzle game. You need to collect all the 'power crystals' on each of the 25 levels, against the clock. You control a robot that looks a little like a spinning beach ball (!). The robot can move up, down, left and right. When moving, it continues moving until it hits a wall object.

Not all of the power crystals are reachable; you will have to use a second robot as a temporary 'blocker' to give the first robot something to butt up against.

The game gives a reasonable demonstration of some of the capabilities of TurboForth, featuring:

  • Character animation
  • Speech
  • Sound
  • Keyboard or Joystick operation
  • Screen scrolling

A number of Forth programming techniques are used:

  • Vectored execution
  • CREATEd words
  • VALUEs

This game is based on the version for the Jupiter Ace, a true Forth machine. I didn't have access to the source code of the Ace version, but I copied the look and feel of the graphics, adding a timer element and 3 lives. The level data was taken from the Z88 compiler website, where Dark Star is included as a demo project for the compiler.

Block File Data

In addition to the code above, the following disk blocks should contain the following data:

Block 2

             1         2         3         4         5         6   
   0123456789012345678901234567890123456789012345678901234567890123
  +----------------------------------------------------------------
00| Welcome to DarkStar!
01|
02|Your ships hyperdrive has blown
03|out and the only way to restore
04|power is to collect they hyper
05|drive power cells which have
06|been scattered randomly across
07|the 25 levels of your ship.
08|
09|Unfortunately, the radiation
10|emitted by the cells is far too
11|high for humans. You cannot do
12|it yourself. You must direct
13|two robots in order to collect
14|the cells. The first robot can
15|collect the cells. The second

Block 3

             1         2         3         4         5         6   
   0123456789012345678901234567890123456789012345678901234567890123
  +----------------------------------------------------------------
00|robot cannot collect any cells,
01|it can only move around the deck
02|and thus can only be used as a
03|'blocker' unit to make cells
04|accessible to the first robot.
05|
06|There's a further added problem!
07|Due to the high levels of radio-
08|activity good radio communication
09|to the robots is not possible,
10|restricting the control you have
11|over the two robots. Movement in
12|the four directions is possible,
13|but it is not possible to stop
14|their movement! They will only
15|stop when they hit an object!

Block 4

             1         2         3         4         5         6   
   0123456789012345678901234567890123456789012345678901234567890123
  +----------------------------------------------------------------
00|To complete your mission, you
01|must collect all the power cells
02|from all 25 decks of the ship.
03|
04|Oh yes, and the robots can only
05|survive for a limited amount of
06|time before succumbing to the
07|effects of radiation, so be as
08|fast as you can, you only have a
09|limited supply of robots!
10|
11|Good luck!
12|
13|Sent via Mission Control,
14|6/9/3641
15|

Block 5

             1         2         3         4         5         6   
   0123456789012345678901234567890123456789012345678901234567890123
  +----------------------------------------------------------------
00| Robot Control
01|
02|In keyboard mode, use:
03|
04| E = Up
05| S = Left
06| D = Right
07| X = Down
08|
09| Enter = Select robot
10|
11|In joystick mode, use Fire to
12|select the robot.
13|
14|Hurry hurry hurry!
15|

Block 6

             1         2         3         4         5         6   
   0123456789012345678901234567890123456789012345678901234567890123
  +----------------------------------------------------------------
00|
01|
02| Select Control Method
03|
04|Press:
05|
06| K for Keyboard Control
07|
08| J for Joystick Control
09|
10|
11|
12|
13|
14|
15|

<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube | Forum >>