Jump to content
IGNORED

Turboforth Game: TI-Wars


lucien2

Recommended Posts

It's the TurboForth v1.0 cart binaries that you posted on here, tried them with both Classic99 v367 and MESS 140 and both react with garbled screen, I also have TF 1.2 which boots fine but obviously is no good for your program.

Link to comment
Share on other sites

I just re-downloaded the TF1.0 files and tried it with Classic99 v367. It runs fine. What is written in the classic99 debugger log? Try to copy classic99.exe and the 4 DLLs in another folder. It will generate the default classic99.ini file.

Link to comment
Share on other sites

On closer observation of the startup the option 2 from start menu says "Turbo Forth 1.2", could this be a corrupt or mis-match of cart images from you v1.0 link?

 

Edit - answered my own question there, must have mixed up one of the .bins with version 1.2 :woozy:

 

Apologies Lucien, I'd love to see this game finished, very promising!

Edited by OX.
Link to comment
Share on other sites

  • 1 year later...

OK, thanks to Willsy's post here, I had to return to TI-WARS. If I hit the memory upper limit, I can't say anymore: Memory is full, there is no way to easily finish this game without complicated load/unload of code from disk.

 

First I had to make it compatible with TurboForth 1.2. While I was doing it, I chose to also adapt it to fbForth and TF1.1. In Forth, it's easier to do it afterwards than in other languages: just define a few missing words and redefine some incompatible ones at the beginning of the program. Leave the rest unchanged!

 

Here are the differences between the TurboForth versions.

LOO is used to prepare the parameters for TurboForth's DO/+LOOP to make it compatible with other Forths. TF1.0 DO/LOOP does not work with LEAVE and some versions of TF's DO/+LOOP don't work when the start value is less or equal than the final value.

 

TF1.0 ---------------
: -> --> ; IMMEDIATE
: BL 32 ;
: LOO ( lim strt -- )
  SWAP 1- SWAP 2DUP <= IF
    SWAP DROP DUP 1+ SWAP
  THEN ;
: INPUT-NUMBER ( -- n )
  INPUT-STRING
  PAD SPAN @ NUMBER IF DROP -1 HONK-TONE THEN ;
2 CONSTANT STRLBYTES
 
TF1.1 ---------------
: -> [COMPILE] --> ; IMMEDIATE
: LOO ( lim strt -- ) 2DUP <= IF SWAP DROP DUP 1+ SWAP THEN ;
: INPUT-STRING ( -- )
  ACCEPT-TONE PAD 80 EXPECT 80 >IN ! ;
: INPUT-NUMBER ( -- n )
  INPUT-STRING
  PAD #TIB @ NUMBER IF DROP -1 HONK-TONE THEN ;
1 CONSTANT STRLBYTES
 
TF1.2 ---------------
: INPUT-STRING ( -- )
  ACCEPT-TONE $0500 80 EXPECT 80 >IN ! ;
: INPUT-NUMBER ( -- n )
  INPUT-STRING
  $0500 PAD SPAN @ VMBR PAD SPAN @
  NUMBER IF DROP -1 HONK-TONE THEN ;

 

 

Here is what I changed from the FIG version to adapt it to fbForth:

 

FIG ---------------
: V! C!VDP ;
: V@ C@VDP ;
: THEN [COMPILE] ENDIF ; IMMEDIATE
: GOTOXY ( col row -- ) C-ROW ! C-COL ! ;
: SCREEN ( b -- ) 7 C!REG ;
: PICK ( n -- n ) 1+ PICK ;
: ACCEPT-TONE 52 GPLLNK DROP ;
: HONK-TONE 54 GPLLNK DROP ;
: SPRITE ( # y x asc color -- )
  4 PICK 4 * 771 +
  DUP ROT SWAP V!
  SWAP 128 + SWAP 1- V!
  SPRLOC ;
: HCHAR ( y x asc count -- )
  ROT 3 PICK 32 * + SWAP ROT FILLVDP DROP ;
: GRAPHICS-MODE ( -- )
  GMODE
  0 PAGE !
  32 B/LINE ! ;
: TEXT-MODE ( -- ) TMODE ;
: PATTERN ( addr count n -- )
  8 * 1024 + SWAP CELLS ROT ROT SWAP ROT VMBW ;
 
FB ---------------
: V! VSBW ;
: V@ VSBR ;
: PICK ( n -- n ) 1+ CELLS SP@ + @ ;
: ACCEPT-TONE BEEP ;
: HONK-TONE HONK ;
: 2DUP OVER OVER ;
: ROLL ( n -- ) -DUP IF 1- SWAP >R MYSELF R> SWAP THEN ;
: EMIT EMIT8 ; 
0 VAR LAST-KEY
: ?KEY ( unit -- code status )
  DROP ?KEY8
  DUP LAST-KEY @ = IF
    -1
  ELSE
    DUP -1 = IF 0 ELSE 1 THEN
  THEN
  SWAP DUP LAST-KEY ! SWAP ;
: SPRITE ( # y x asc color -- )
  4 PICK 4 * 771 +
  DUP ROT SWAP V!
  SWAP 255 + SWAP 1- V!
  SPRLOC ;
: HCHAR ( y x asc count -- )
  3 ROLL ROT ROT SWAP HCHAR ;
: GRAPHICS-MODE GRAPHICS ;
: TEXT-MODE TEXT ;
: PATTERN ( addr count n -- )
  8 * 4088 + SWAP CELLS ROT ROT SWAP ROT VMBW ;

 

 

Now it can be run with 5 forth versions: TurboForth 1.0, 1.1, and 1.2(.1), fbForth 2.0 and Weiand FIG forth

 

The next step is to optimize high memory usage (compiled code is put there).

 

At first I just removed the map editor. It's not that useful to instantly switch between the game and the map editor.

Free memory (before -> after):

TurboForth 1.2: 1124 -> 3272

fbForth: 2292 -> 4334

FIG: 2314 -> 4356

 

Then, I'll need to prepare my VDP patterns/colors in a block, ready to be moved to VDP.

 

Finally, I need to put all my arrays to the following free memory zones:

TurboForth: entire low ram or VDP at >3420 (951 bytes)

fbForth: VDP at >1152 (9350 bytes)

FIG Forth: VDP at >1430 (~11088 bytes), low ram from >2080 (after TIB) to >2680 (before return stack)

  • Like 3
Link to comment
Share on other sites

Nice!

 

In TF V1.2 you can get more free VDP memory by setting #BUF. See the release note for V1.1 here.

 

Also, check out the VDP memory map here. If you set #BUF to 1 then only VDP block buffer 0 @ >3020 will be used for used for block operations, meaning there is 5K free from >1C20 to >2C1F. Give it a try.

 

I have a new build of TFV1.2.1 ready to release. Current build of TF is V1.2.1:0 (build 0) but I have V1.2.1:1 ready to roll. It includes a bug fix (shame on me) >MAP which is the word that does the SAMS mapping! (For some reason, V1.2.1:0 seems to write garbage values to the mapping registers. I just scrapped the code for V1.2.1:1 and re-wrote it from scratch).

 

I'll post that build later this evening.

 

Let me know how you get on. It's nice to see someone using TF. I was thinking I'm the only one that uses it!

 

[edit]: I've added a description of #BUF to the online glossary on TurboForth.net. Just type #BUF (or even just BUF) into the search box and it'll find it for you.

Edited by Willsy
Link to comment
Share on other sites

  • 4 months later...

Hum, well, I did not touched it since april 13th. I switched my priorities and I'm finishing first my Fractals in GPL.

I removed the character definitions and store them in 3 blocks, ready to load to VDP. Memory saved: ~1100 bytes.

I then changed the algorithm to show the possible moves to use recursion and remove the offscreen copy of the display of possible moves. It is a bit slower to display and if you scroll the map with the possible moves displayed, it's really slower. Memory saved: ~1000 bytes.

I'm thinking to translate what I have so far to a GPL/assembly mix.

In any case I have a lot less time to do this than when my only wife was my computer and my only babies were my programs ;)

TI-WARS 130415.zip

  • Like 2
Link to comment
Share on other sites

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...