Jump to content
IGNORED

Dark Star in TurboForth


Willsy

Recommended Posts

If only to prove that games can be written in TurboForth:

 

 

Features animation, sound and speech.

 

\ dark star
FORGET 'LevelData

 0 VALUE 'LevelData \ address of level data
 0 VALUE Level
 0 VALUE Column
 0 VALUE Row
 0 VALUE OrbCount
 0 VALUE BallRow
 0 VALUE BallCol
 0 VALUE RobotRow
 0 VALUE RobotCol
-1 VALUE Ball
 0 VALUE Robot
 0 VALUE #Collected \ number of orbs collected
 0 VALUE InputMode
84 VALUE BallChar
 0 VALUE IsPlayer?  \ the current player - ball or robot
 0 VALUE Score
 0 VALUE Lives
-1 VALUE JoystickMode?
 0 VALUE Time
31 VALUE TimeCol
 0 VALUE Frame#	 \ animation frame counter
 0 VALUE FrameCount
-1 VALUE Speech?
 0 VALUE FlashOrbs?

 1 CONSTANT Fire?
 2 CONSTANT Left?
 4 CONSTANT Right?
 8 CONSTANT Down?
16 CONSTANT Up?
$90 CONSTANT EmptyChar
$98 CONSTANT OrbChar
13 CONSTANT ENTER	   \ key code for ENTER key
448 CONSTANT TimeReset
400 CONSTANT DelayTime

HEX
: BrickUDG ( --)
  DATA 4 7FAA D5A8 D0A0 C080  80 DCHAR
  DATA 4 8080 8080 8080 807F  81 DCHAR
  DATA 4 FEA9 4101 0101 0101  82 DCHAR
  DATA 4 0101 0101 0101 01FE  83 DCHAR ;

: BallUDG1 ( --)
  DATA 4 030F 3F3F 5F5F 9F00  84 DCHAR
  DATA 4 8E8E 4640 2030 0C02  85 DCHAR
  DATA 4 4070 3C4C 6676 7F7F  86 DCHAR
  DATA 4 00FF FEF2 040C 30C0  87 DCHAR ;

: BallUDG2 ( --)
  DATA 4 030F 3F3F 5F47 991E  84 DCHAR
  DATA 4 8E8D 4541 2030 0C02  85 DCHAR
  DATA 4 C0F0 ACCC C6B6 BF7F  86 DCHAR
  DATA 4 7F9F E6F2 040C 30C0  87 DCHAR ;

: BallUDG3 ( --)
  DATA 4 030F 2F37 7B5D 9E1E  84 DCHAR
  DATA 4 8C8B 4741 0030 0C03  85 DCHAR
  DATA 4 C0F0 BCC8 E6E6 DF3F  86 DCHAR
  DATA 4 7F7F BEC2 0404 30C0  87 DCHAR ;

: BallUDG4 ( --)
  DATA 4 030B 3D3D 5D5E 9E9E  84 DCHAR
  DATA 4 8887 0741 4030 0C03  85 DCHAR
  DATA 4 C0F0 DCCC E6F4 E31F  86 DCHAR
  DATA 4 7F7F 7EB2 040C 10C0  87 DCHAR ;

: RobotUDG1 ( --)
  DATA 4 609F 9F61 03FF 80AA  88 DCHAR
  DATA 4 9FB5 90B5 9FAA 80FF  89 DCHAR
  DATA 4 06F9 F986 C0FF 01A9  8A DCHAR
  DATA 4 FD59 0D59 FDA9 01FF  8B DCHAR ;

: RobotUDG2 ( --)
  DATA 4 1D22 221D 03FF D5BF  88 DCHAR
  DATA 4 EAB0 E5B0 EABF D5FF  89 DCHAR
  DATA 4 B8F4 F4B8 C0FF 55FF  8A DCHAR
  DATA 4 AD07 4D07 ADFF 55FF  8B DCHAR ;

: RobotUDG3 ( --)
  DATA 4 0708 0807 03FF FFD5  88 DCHAR
  DATA 4 E0CA E7CA E0D5 FFFF  89 DCHAR
  DATA 4 E010 10E0 C0FF FF57  8A DCHAR
  DATA 4 03A7 F3A7 0357 FFFF  8B DCHAR ;

: RobotUDG4 ( --)
  DATA 4 1D2F 2F1D 03FF AAC0  88 DCHAR
  DATA 4 95CF 95CF 95C0 AAFF  89 DCHAR
  DATA 4 B844 44B8 C0FF AB01  8A DCHAR
  DATA 4 53F9 5BF9 5301 ABFF  8B DCHAR ;

: OrbUDG ( --)
  DATA 4 0000 0000 0304 0808  98 DCHAR
  DATA 4 0808 0403 0000 0000  99 DCHAR
  DATA 4 0000 0000 C020 9050  9A DCHAR
  DATA 4 1010 20C0 0000 0000  9B DCHAR ;

: EmptyUDG ( --)
  DATA 4 FFFF FFFF FFFF FFFF  90 DCHAR ;
  
: BarUDG2 ( --)
  DATA 4 $0000 $C0C0 $C0C0 $0000
  2DUP A0 DCHAR A8 DCHAR ;
   
: BarUDG4 ( --)
  DATA 4 $0000 $F0F0 $F0F0 $0000
  2DUP A1 DCHAR A9 DCHAR ;
   
: BarUDG6 ( --)
  DATA 4 $0000 $FCFC $FCFC $0000
  2DUP A2 DCHAR AA DCHAR ;
   
: BarUDG8 ( --)
  DATA 4 $0000 $FFFF $FFFF $0000
  2DUP A3 DCHAR AB DCHAR ;

: YouWin    DATA 1 $7DDB SAY ;
: GoodWork  DATA 1 $30FA SAY ;
: WellDone  DATA 2 $7717 $253E SAY ;
: VeryGood  DATA 2 $74DA $30D6 SAY ;

: WWT?	  DATA 1 77E9 SAY ;
: TryAgain  DATA 1 700F SAY ;
: OutOfTime DATA 3 4DD4 4BBA 6E69 SAY ;
: STTA	  DATA 3 63F7 6C73 700F SAY ;
: Hurry	 DATA 3 3757 3757 3757 SAY ;
: Completed
   3 RND CASE
  0 OF DATA 2 1F1A 1FCD ENDOF
  1 OF DATA 3 4B7D 3B8A 253E ENDOF
  2 OF DATA 6 39BD 1FCD 767D 473D 5231 4C41 ENDOF
   ENDCASE  SAY ;
   
: GoGoGo    TALKING? NOT IF DATA 3 2FFC 2FFC 2FFC SAY THEN ;

: Joystick Speech? IF DATA 3 3AED 3A32 4C41 SAY THEN ;
: Keyboard Speech? IF DATA 3 3BE9 3A32 4C41 SAY THEN ;
DECIMAL

CREATE WinPhrases
   ' YouWin ,
   ' GoodWork ,
   ' WellDone ,
   ' VeryGood ,
   
CREATE LosePhrases
   ' WWT? ,
   ' TryAgain ,
   ' OutOfTime ,
   ' STTA ,

: DefineGraphics ( --)
   1 GMODE  FALSE SSCROLL !
   32 0 DO I 1 14 COLOR LOOP
   16  1 15 COLOR  \ brick colour
   17  4 15 COLOR  \ robot colour
   18 15 14 COLOR  \ empty tile colour
   19  1 15 COLOR  \ orb colour
   21  3 14 COLOR  \ time bar
   BrickUDG  BallUDG1  RobotUDG1  OrbUDG  EmptyUDG
   BarUDG2   BarUDG4   BarUDG6    BarUDG8 ;

: NextColumn ( --) 2 +TO Column ;

: DrawIt ( a b c d --)
   Column 1+ Row 1+ GOTOXY  EMIT \ d
   Column 1+ Row    GOTOXY  EMIT \ c
   Column    Row 1+ GOTOXY  EMIT \ b
   Column    Row    GOTOXY  EMIT \ a
   NextColumn ;

: DrawBrick ( --) 128 129 130 131 DrawIt ;
: DrawBall  ( --) 132 133 134 135 DrawIt ;
: DrawRobot ( --) 136 137 138 139 DrawIt ;
: DrawOrb   ( --) 152 153 154 155 DrawIt ;
: DrawEmpty ( --) 144 144 144 144 DrawIt ;

: C@++ ( addr -- val addr+1) DUP C@ SWAP 1+ ;

: InfoPanel ( --)
   0 18 GOTOXY ." Time"
   TRUE ZEROS !
   0 19 GOTOXY ." Score:" Score U.
   FALSE ZEROS !
   25 19 GOTOXY ." Lives:" Lives 1- .
   0 20 GOTOXY ." Level:" Level 1+ .
   18 4 $AB 28 HCHAR ;
   
: DecodeLevel ( level --)
   38 * 'LevelData +   \ address of level data in memory
   C@++ C@++ -ROT	  \ addr robotaddr balladdr
   16 /MOD 2* TO RobotRow  2* TO RobotCol
   16 /MOD 2* TO BallRow   2* TO BallCol
   0 TO Row   0 TO OrbCount
   9 0 DO			  \ 9 rows
  0 TO Column
  4 0 DO		    \ 4 bytes
    C@++ SWAP	   \ get a byte of data
    DUP		 $03 AND
    OVER   2 >> $03 AND
    2 PICK 4 >> $03 AND
    3 PICK 6 >> $03 AND
    4 0 DO
	  CASE
	    0 OF DrawEmpty ENDOF
	    1 OF DrawBrick ENDOF
	    2 OF DrawOrb  1 +TO OrbCount ENDOF
	  ENDCASE
    LOOP
    DROP
  LOOP  
  2 +TO Row
   LOOP
   DROP
   InfoPanel
   BallRow  TO Row   BallCol TO Column  DrawBall
   RobotRow TO Row  RobotCol TO Column  DrawRobot ;

CREATE BallFrames
\ store addresses of the ball character definition routines
 ' BallUDG1 ,
 ' BallUDG2 ,
 ' BallUDG3 ,
 ' BallUDG4 ,

CREATE RobotFrames
\ store addresses of the robot character definition routines
 ' RobotUDG1 ,
 ' RobotUDG2 ,
 ' RobotUDG3 ,
 ' RobotUDG4 ,

: Tick ( --)
   18 TimeCol GCHAR
   DUP $A8 = IF
  DROP $AB  18 TimeCol 32 1 HCHAR
  -1 +TO TimeCol
   ELSE 1- THEN
   18 TimeCol ROT 1 HCHAR
   Time 100 = IF
  Speech? IF Hurry THEN
  21 8 14 COLOR ( change bar to red)
  TRUE TO FlashOrbs?
   THEN ;

: CheckTime ( --)
   -1 +TO Time
   Time 4 MOD 0= IF Tick THEN ;
   
: Bonus ( --)
   Time 0> IF
  TRUE ZEROS !
  1000 \ sound parameter
  Time 4 /  1 DO
    Tick  
    5 +TO Score  
    6 19 GOTOXY Score U.
    DUP 7 0 SOUND 8 -
    DUP 8 -  7 1 SOUND
  LOOP
  DROP
  0 15 0 SOUND  0 15 1 SOUND \ turn off sound
  4 18 GOTOXY SPACE
  ZEROS 0!
   THEN ;

: Animate ( --)
  \ animates either the ball or the robot
  Ball IsPlayer? = IF
 BallFrames  Frame# CELLS + @ EXECUTE
  ELSE
 RobotFrames Frame# CELLS + @ EXECUTE
  THEN Frame# 1+ 4 MOD TO Frame# ;

: ScanKeyboard ( -- direction)
   KEY?
   DUP -1 <> IF
  CASE
    ASCII S OF  2 ENDOF
    ASCII D OF  4 ENDOF
    ASCII X OF  8 ENDOF
    ASCII E OF 16 ENDOF
    ENTER   OF  1 ENDOF
    0 \ default case
  ENDCASE
   ELSE DROP  0 THEN ;
   
: GetRowCol ( --)
   Ball IsPlayer? = IF
  BallRow  BallCol
   ELSE
  RobotRow  RobotCol
   THEN TO Column   TO Row ;
    
: SetRowCol ( --)
   Row Column  Ball IsPlayer? = IF
  TO BallCol  TO BallRow
   ELSE
  TO RobotCol  TO RobotRow
   THEN ;

: ErasePlayer ( --)
   DrawEmpty -2 +TO Column ;
   
: DrawPlayer ( --)
   Ball IsPlayer? = IF DrawBall ELSE DrawRobot THEN -2 +TO Column ;
   
: CheckOrb ( --)
   Row Column GCHAR OrbChar = IF
  1 +TO #Collected
  10 +TO Score
  TRUE ZEROS !  6 19 GOTOXY Score U.  ZEROS 0!
   THEN ;
   
: Delay ( delay--) 0 DO LOOP ;

: CanMove? ( row col--true/false)
   GCHAR
   Ball IsPlayer? = IF
  DUP EmptyChar =  SWAP  OrbChar =  OR
   ELSE
  EmptyChar =
   THEN ;
    
: MoveLeft ( --)
   BEGIN GetRowCol Row Column 2- CanMove? WHILE
  ErasePlayer  -2 +TO Column
  CheckOrb DrawPlayer SetRowCol  DelayTime Delay  Animate
   REPEAT ;

: MoveRight ( --)
   BEGIN GetRowCol Row Column 2+ CanMove? WHILE
  ErasePlayer  2 +TO Column
  CheckOrb DrawPlayer SetRowCol  DelayTime Delay  Animate
   REPEAT ;

: MoveDown ( --)
   BEGIN GetRowCol Row 2+ Column CanMove? WHILE
  ErasePlayer  2 +TO Row  
  CheckOrb DrawPlayer SetRowCol  DelayTime Delay  Animate
   REPEAT ;

: MoveUp ( --)
   BEGIN GetRowCol Row 2- Column CanMove? WHILE
  ErasePlayer  -2 +TO Row  
  CheckOrb DrawPlayer SetRowCol  DelayTime Delay  Animate
   REPEAT ;

: Debounce ( --)
   JoystickMode? IF
  BEGIN 0 JOYST 0= UNTIL
   ELSE
  BEGIN KEY? -1 = UNTIL
   THEN ;
   
: Volume ( ch# vol  -- )
 $F AND SWAP 2* 1+ 8 + 4 << OR $8400 C! ;
   
: BusyNoise ( --)
   50 0 DO 50  15 0 DO  DUP I 0 SOUND 10 + LOOP DROP LOOP
   0 15 0 SOUND ;

: MovePlayer ( --)
   JoystickMode? IF 0 JOYST ELSE ScanKeyboard THEN
   CASE
  Left?  OF  MoveLeft  ENDOF
  Right? OF  MoveRight ENDOF
  Down?  OF  MoveDown  ENDOF
  Up?    OF  MoveUp    ENDOF
  Fire?  OF  IsPlayer? NOT TO IsPlayer?
			 Debounce BusyNoise Completed ENDOF
   ENDCASE ;

: AllOrbs? ( -- true/false) OrbCount #Collected = ;

: SayEnd ( --)
   Speech? IF
  AllOrbs? IF
    WinPhrases
  ELSE
   LosePhrases
  THEN
   THEN  4 RND CELLS + @ EXECUTE ;

: Reset ( --)
   21 3 14 COLOR   \ set time bar to green
   19 1 15 COLOR   \ orb colour
   0 TO FrameCount
   TimeReset TO Time
   31 TO TimeCol
   0 TO #Collected
   0 TO Frame#
   Ball TO IsPlayer?
   FALSE TO FlashOrbs? ;
   
: GameOver ." Game Over Sucker!" ;
: Wow! ." You completed the game!" ;

: Wipe ( --)
   32 24  23 0 DO
  0 I 3 PICK 3 PICK PANEL
  0 SCROLL  6 SCROLL    1- SWAP 1- SWAP
   LOOP
   6 SCROLL 2DROP ;

: FlashOrbs
   19 16 RND 15 COLOR ;
   
: Game ( --)
   DefineGraphics
   0 TO Level
   
   3 TO Lives
   0 TO Score
   BEGIN
  Lives 0>  Level 25 <  AND WHILE
    Reset
    Level DecodeLevel GoGoGo
    BEGIN
	  MovePlayer
	  1 +TO FrameCount  FrameCount 70 MOD 0= IF
	    Animate  CheckTime THEN
	    FlashOrbs? IF FlashOrbs THEN
    AllOrbs? Time 4 = OR UNTIL
    SayEnd
    Time 4 = IF -1 +TO Lives ELSE Bonus  1 +TO Level THEN
    Wipe
   REPEAT
   Lives 0= IF GameOver ELSE Wow! THEN ;

   
S" DSK1.DARKSTAR" USE
FORGET SlideScreen
: SlideScreen ( block# --)
   0 4 32 16 PANEL
   BLOCK
  32 0 DO
    0 SCROLL
    16 0 DO
	  31 I 4 + GOTOXY
	  DUP I 64 * + V@ EMIT
    LOOP
    1+
  LOOP DROP ;
  
: AnyKey ( --)
   ASCII > 256 *  32 +  \ > and space char in single cell
   0 BEGIN
  1+ DUP  50 MOD  0= IF
    SWAP  ><  DUP 31 19 GOTOXY EMIT  SWAP
  THEN
  KEY? 1+  0 JOYST  1 = OR
   UNTIL  2DROP ;
   
: BrickRows
   0 TO Row  
   2 0 DO
  0 TO Column
  2 0 DO  
    16 0 DO DrawBrick LOOP  
    2 +TO Row   0 TO Column
  LOOP
  20 TO Row
   LOOP ;
   
: GetControlMode ( --)
   6 BLOCK
   15 64 * +
   15 0 DO
  32 0 DO
    DUP V@
    I 4 GOTOXY EMIT
    1+
  LOOP
  6 SCROLL
  32 -  64 -
   LOOP DROP
   BEGIN
  KEY? DUP
  ASCII J =  SWAP  ASCII K =
   OR UNTIL
   KEY? ASCII J = IF TRUE ELSE FALSE THEN
   TO JoystickMode?
   Wipe ;
   

: DarkStar ( --)
   DefineGraphics  BrickRows
   7 2 DO I BLOCK DROP LOOP \ get blocks into the cache
   6 2 DO I SlideScreen AnyKey LOOP
   GetControlMode
   Game ;
   
HERE TO 'LevelData
17 C, 30 C,  \ level 1
85 C, 85 C, 85 C, 85 C, 69 C, 0 C, 0 C, 145 C, 64 C, 0 C,
2 C, 21 C, 64 C, 0 C, 88 C, 1 C, 64 C, 82 C, 0 C, 5 C, 82 C,
8 C, 0 C, 129 C, 72 C, 0 C, 37 C, 33 C, 64 C, 5 C, 128 C,
9 C, 85 C, 85 C, 85 C, 85 C,

30 C, 86 C,  \ level 2
16 C, 68 C, 64 C, 69 C, 64 C, 128 C, 0 C, 1 C, 1 C, 129 C,
128 C, 128 C, 68 C, 128 C, 8 C, 17 C, 0 C, 4 C, 8 C, 4 C,
64 C, 17 C, 8 C, 1 C, 1 C, 4 C, 64 C, 105 C, 64 C, 0 C, 0 C,
4 C, 16 C, 64 C, 0 C, 16 C,

30 C, 46 C,  \ level 3
85 C, 85 C, 85 C, 85 C, 64 C, 0 C, 0 C, 145 C, 64 C, 80 C,
0 C, 81 C, 64 C, 96 C, 2 C, 1 C, 72 C, 0 C, 148 C, 9 C, 70 C,
8 C, 36 C, 37 C, 69 C, 134 C, 8 C, 149 C, 96 C, 5 C, 128 C,
1 C, 85 C, 85 C, 85 C, 85 C,

125 C, 30 C,  \ level 4
85 C, 85 C, 85 C, 85 C, 64 C, 0 C, 0 C, 17 C, 64 C, 4 C,
0 C, 1 C, 89 C, 137 C, 153 C, 153 C, 68 C, 98 C, 68 C, 69 C,
89 C, 152 C, 153 C, 153 C, 64 C, 4 C, 0 C, 1 C, 64 C, 64 C,
0 C, 65 C, 85 C, 85 C, 85 C, 85 C,

17 C, 110 C,  \ level 5
21 C, 85 C, 85 C, 84 C, 64 C, 64 C, 65 C, 1 C, 65 C, 132 C,
130 C, 17 C, 80 C, 0 C, 65 C, 1 C, 97 C, 144 C, 0 C, 5 C,
80 C, 1 C, 33 C, 1 C, 100 C, 17 C, 16 C, 17 C, 64 C, 64 C,
36 C, 25 C, 21 C, 85 C, 85 C, 84 C,

65 C, 113 C,  \ level 6
0 C, 85 C, 85 C, 85 C, 1 C, 2 C, 1 C, 137 C, 4 C, 2 C, 0 C,
69 C, 16 C, 2 C, 0 C, 1 C, 64 C, 2 C, 0 C, 1 C, 80 C, 2 C,
4 C, 5 C, 64 C, 2 C, 0 C, 65 C, 65 C, 2 C, 5 C, 129 C, 85 C,
85 C, 85 C, 85 C,

115 C, 122 C,  \ level 7
85 C, 85 C, 85 C, 85 C, 64 C, 0 C, 0 C, 1 C, 20 C, 84 C,
24 C, 89 C, 24 C, 24 C, 68 C, 68 C, 4 C, 16 C, 84 C, 80 C,
20 C, 16 C, 100 C, 100 C, 64 C, 0 C, 0 C, 1 C, 64 C, 96 C,
0 C, 25 C, 85 C, 85 C, 85 C, 85 C,

108 C, 98 C,  \ level 8
85 C, 85 C, 85 C, 84 C, 66 C, 80 C, 0 C, 5 C, 65 C, 129 C,
72 C, 1 C, 66 C, 81 C, 24 C, 1 C, 80 C, 1 C, 65 C, 145 C,
81 C, 0 C, 2 C, 97 C, 98 C, 64 C, 129 C, 17 C, 80 C, 0 C,
0 C, 1 C, 21 C, 85 C, 85 C, 85 C,

30 C, 72 C,  \ level 9
4 C, 85 C, 85 C, 84 C, 25 C, 128 C, 1 C, 1 C, 98 C, 64 C,
32 C, 4 C, 17 C, 9 C, 66 C, 65 C, 65 C, 134 C, 32 C, 9 C,
64 C, 9 C, 64 C, 4 C, 102 C, 0 C, 0 C, 16 C, 64 C, 0 C, 0 C,
64 C, 85 C, 85 C, 85 C, 0 C,

93 C, 36 C,  \ level 10
0 C, 85 C, 85 C, 84 C, 85 C, 32 C, 0 C, 1 C, 64 C, 5 C, 98 C,
73 C, 72 C, 6 C, 24 C, 4 C, 64 C, 4 C, 32 C, 73 C, 102 C,
4 C, 144 C, 68 C, 24 C, 5 C, 65 C, 80 C, 64 C, 0 C, 4 C,
68 C, 21 C, 85 C, 80 C, 65 C,

30 C, 108 C,  \ level 11
85 C, 85 C, 85 C, 85 C, 64 C, 1 C, 0 C, 1 C, 65 C, 160 C,
2 C, 133 C, 80 C, 32 C, 20 C, 9 C, 96 C, 6 C, 104 C, 21 C,
81 C, 64 C, 20 C, 1 C, 96 C, 146 C, 0 C, 9 C, 89 C, 80 C,
4 C, 5 C, 20 C, 85 C, 85 C, 84 C,

17 C, 92 C,  \ level 12
80 C, 1 C, 65 C, 84 C, 69 C, 86 C, 21 C, 37 C, 64 C, 40 C,
0 C, 129 C, 69 C, 5 C, 129 C, 145 C, 68 C, 133 C, 97 C, 65 C,
69 C, 5 C, 1 C, 17 C, 64 C, 8 C, 0 C, 1 C, 64 C, 0 C, 32 C,
1 C, 85 C, 85 C, 85 C, 85 C,

18 C, 113 C,  \ level 13
21 C, 85 C, 85 C, 84 C, 65 C, 0 C, 0 C, 133 C, 68 C, 6 C,
2 C, 81 C, 64 C, 0 C, 128 C, 17 C, 72 C, 0 C, 0 C, 25 C,
68 C, 0 C, 32 C, 1 C, 80 C, 0 C, 136 C, 25 C, 64 C, 64 C,
33 C, 17 C, 21 C, 85 C, 85 C, 84 C,

36 C, 50 C,  \ level 14
85 C, 85 C, 85 C, 85 C, 102 C, 0 C, 0 C, 153 C, 73 C, 0 C,
1 C, 65 C, 64 C, 0 C, 2 C, 1 C, 64 C, 0 C, 36 C, 1 C, 64 C,
2 C, 0 C, 1 C, 73 C, 0 C, 0 C, 65 C, 102 C, 0 C, 0 C, 153 C,
85 C, 85 C, 85 C, 85 C,

51 C, 76 C,  \ level 15
21 C, 84 C, 85 C, 84 C, 64 C, 9 C, 0 C, 33 C, 68 C, 132 C,
16 C, 33 C, 64 C, 64 C, 104 C, 97 C, 17 C, 1 C, 32 C, 17 C,
96 C, 0 C, 16 C, 97 C, 16 C, 0 C, 128 C, 4 C, 96 C, 0 C,
0 C, 9 C, 21 C, 85 C, 85 C, 84 C,

35 C, 19 C,  \ level 16
85 C, 85 C, 85 C, 85 C, 80 C, 98 C, 0 C, 9 C, 96 C, 152 C,
0 C, 5 C, 81 C, 80 C, 8 C, 5 C, 80 C, 2 C, 100 C, 1 C, 104 C,
0 C, 9 C, 129 C, 82 C, 0 C, 85 C, 129 C, 89 C, 4 C, 0 C,
1 C, 85 C, 85 C, 85 C, 85 C,

29 C, 124 C,  \ level 17
85 C, 85 C, 85 C, 85 C, 73 C, 0 C, 0 C, 65 C, 68 C, 38 C,
152 C, 17 C, 64 C, 25 C, 100 C, 129 C, 73 C, 0 C, 2 C, 65 C,
66 C, 96 C, 9 C, 1 C, 68 C, 17 C, 100 C, 17 C, 64 C, 33 C,
128 C, 1 C, 85 C, 85 C, 85 C, 85 C,

115 C, 26 C,  \ level 18
85 C, 85 C, 85 C, 85 C, 72 C, 2 C, 1 C, 1 C, 65 C, 152 C,
6 C, 1 C, 64 C, 100 C, 1 C, 129 C, 64 C, 129 C, 2 C, 97 C,
70 C, 64 C, 73 C, 1 C, 73 C, 132 C, 132 C, 1 C, 100 C, 4 C,
0 C, 65 C, 85 C, 85 C, 85 C, 85 C,

126 C, 110 C,  \ level 19
85 C, 85 C, 85 C, 85 C, 96 C, 20 C, 0 C, 89 C, 68 C, 16 C,
0 C, 97 C, 73 C, 2 C, 80 C, 129 C, 68 C, 1 C, 128 C, 1 C,
64 C, 16 C, 36 C, 1 C, 69 C, 36 C, 88 C, 17 C, 73 C, 24 C,
0 C, 81 C, 85 C, 85 C, 85 C, 85 C,

77 C, 66 C,  \ level 20
85 C, 85 C, 85 C, 85 C, 64 C, 152 C, 0 C, 1 C, 88 C, 36 C,
88 C, 5 C, 68 C, 72 C, 4 C, 17 C, 64 C, 65 C, 65 C, 9 C,
68 C, 16 C, 33 C, 17 C, 80 C, 37 C, 24 C, 37 C, 64 C, 0 C,
38 C, 1 C, 85 C, 85 C, 85 C, 85 C,

103 C, 105 C,  \ level 21
85 C, 85 C, 85 C, 85 C, 69 C, 64 C, 8 C, 5 C, 64 C, 64 C,
0 C, 69 C, 64 C, 88 C, 0 C, 33 C, 66 C, 0 C, 128 C, 133 C,
64 C, 16 C, 5 C, 97 C, 66 C, 32 C, 2 C, 41 C, 85 C, 85 C,
85 C, 85 C, 0 C, 0 C, 0 C, 0 C,

103 C, 105 C,  \ level 22
85 C, 85 C, 85 C, 85 C, 100 C, 25 C, 24 C, 17 C, 64 C, 16 C,
0 C, 1 C, 96 C, 16 C, 96 C, 129 C, 81 C, 128 C, 2 C, 21 C,
72 C, 64 C, 86 C, 1 C, 64 C, 4 C, 64 C, 129 C, 85 C, 85 C,
85 C, 85 C, 0 C, 0 C, 0 C, 0 C,

103 C, 105 C,  \ level 23
21 C, 85 C, 85 C, 84 C, 68 C, 25 C, 24 C, 17 C, 64 C, 32 C,
64 C, 1 C, 80 C, 16 C, 33 C, 129 C, 65 C, 129 C, 10 C, 33 C,
88 C, 64 C, 82 C, 1 C, 64 C, 4 C, 64 C, 129 C, 21 C, 85 C,
85 C, 84 C, 0 C, 0 C, 0 C, 0 C,

103 C, 105 C,  \ level 24
85 C, 85 C, 85 C, 85 C, 64 C, 4 C, 0 C, 5 C, 69 C, 136 C,
1 C, 101 C, 70 C, 0 C, 36 C, 21 C, 74 C, 9 C, 20 C, 1 C,
70 C, 33 C, 0 C, 81 C, 69 C, 0 C, 69 C, 105 C, 85 C, 85 C,
85 C, 85 C, 0 C, 0 C, 0 C, 0 C,

103 C, 105 C,  \ level 25
85 C, 85 C, 85 C, 85 C, 64 C, 0 C, 0 C, 17 C, 72 C, 88 C,
8 C, 1 C, 64 C, 96 C, 129 C, 65 C, 72 C, 1 C, 65 C, 129 C,
70 C, 2 C, 64 C, 33 C, 69 C, 132 C, 0 C, 1 C, 85 C, 85 C,
85 C, 85 C, 0 C, 0 C, 0 C, 0 C,

  • Like 6
Link to comment
Share on other sites

Very nice! And so smooth! Is this going to be your entry in the Turbo Forth contest?

 

Is there a contest? I thought it died a death! This forum has been a bit of a graveyard the last two or three months!

 

I guess I should probably stay out of any TF contest as I would probably have an unfair advantage.

Link to comment
Share on other sites

I want to play it Willsy, how do I run it? Do I need to make a BLOCKS file from the above code, if so then how can I import the code?

 

First you need TurboForth version 1.2: TF-Version1.2.zip

 

Extract the two BIN files to the MODS folder in Classic99. Then in Classic99 select the Cartridge menu, then User, then Open and navigate to the MODS folder and select one of the files. I think you can select any one. It doesn't matter (can't remember, since my cartridge is defined in classic99.ini)

 

Then, copy these two disk images to the DSK1 folder in Classic99:

 

BLOCKS.zip

DARKSTAR.zip

 

You don't really need the blocks disk image, but what the hell, it contains a lot of neat stuff for TF like the assembler and other stuff.

 

So, boot TF and hold down ENTER as it starts. This will bypass booting from DSK1.BLOCKS

 

Then type this, EXACTLY as shown (spaces are important!)

 

S" DSK1.DARKSTAR" USE
40 BLOAD DROP
DARKSTAR

 

And that's it. You're off.

 

The source code is not on the disk image because I haven't got around to putting it in a blocks (horizontal) format yet. It was written on the PC in Notepad++ so it's kind of vertical. I'm a newbie Forth programmer and I sometimes find vertical helps (indentation and stuff like that).

 

Here's the source code: darkStar.txt

 

Note that's it's unfinished in so far as it lacks a decent game over and game complete routine(s). I kind of run out of steam - pressure of work and life etc. I'll leave the addition of decent "game over" and "game complete" screens to the reader. The hooks are there. Just redefine the words GameOver and Wow!

 

Have fun! :-)

Link to comment
Share on other sites

Very nice! And so smooth! Is this going to be your entry in the Turbo Forth contest?

 

Is there a contest? I thought it died a death! This forum has been a bit of a graveyard the last two or three months!

 

I guess I should probably stay out of any TF contest as I would probably have an unfair advantage.

 

Yep, it's a bit of a graveyard.

Edited by sometimes99er
Link to comment
Share on other sites

  • 1 month later...

Yes please! Could you also include the TF1.2 rom for Classic 99 as well? Yahoo won't let me download it for some reason...

Would you be OK me posting Dark Star on the Gameshelf site?

 

Don't you get the message through your regular e-mail, also? The files are attached to that message and you should be able to download them without any trouble. BTW the same thing happens to me on the YaHoo site. It's a PITA to have to open the message in two different places, but maybe it will work for you as well.

 

...lee

Link to comment
Share on other sites

Here you go.

 

Attached:

 

[ attachments removed. See post below for attachments ]

 

For those that feel like giving it a try:

  • Unzip the darkstar disk file into classic99's DSK1 folder
  • Unzip the TurboForth ROM files in classic99's MODS folder
  • Start Classic99
  • Click on the Cartridge menu at the top of Classic99
  • Select User, then select Open from the drop down menu
  • Navigate to your Classic99\MODS folder and select one of the TurboForth files
  • The TurboForth 'cartridge' is now inserted into your TI
  • Select 2 to start TurboForth

Okay, now you should be running TurboForth. You may get a menu presented. You can ignore that. We need to tell TurboForth to use a different blocks file. The file we want is in the DSK1 folder and is called DARKSTAR:

 

Type the following:

 

 S" DSK1.DARKSTAR" USE
1 LOAD

 

Please note: There is a space between the quote mark and the D of DSK1. It is important!

 

After that, you get a menu where you can just compile the code from the source code on the disk, or load ready compiled object code.

 

For more information, see the Darkstar page on the TurboForth website.

 

Have fun!

  • Like 2
Link to comment
Share on other sites

  • 2 months later...

Very cool game! I only watched the demo video so far but I think I'll have to try this out, for reals!

 

You Forth programmers amaze me. I just could never grasp the RPN for programming. I get it, with my financial calculator but, programming is another story.

 

Regardless, thanks for sharing!

 

-D

 

"Long Live the TI-99/4a!"

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...