Jump to content
IGNORED

Forth, Fortran & Logo games for TI?


jrhodes

Recommended Posts

It's true. Some things are so simple, like basic.

In Turbo Forth, to place a character on the screen, is simply, 100 42 V!

Placing an asterisk at location 100 of the screen., vs  CALL HCHAR(3,23,42)

I think the basic format is right, at 40 col mode.

I'll be at it rt after I finish SNP.

 

 

Edited by GDMike
Link to comment
Share on other sites

  • 1 year later...

I am testing different things in my un-released kernel and of course go down the rabbit hole of modifying the programs. :|

 

Here is Oregon trail re-worked with much better numbers used to determine results.

It is also pre-compiled as a binary program for Editor/Assembler cartridge so you can use it without needing the Forth system. 

It takes 3 files due to the large amount of text in the game which I moved from VDP RAM to CPU RAM so it was simpler to compile as an E/A5 program. 

 

Note: It can be won! I have done it.

But then I know a few things... :) 

 

Newest source code for the curious. (This is actually my attempt to write a game language on Forth)

Spoiler
\ ORGEGON TRAIL BY  majestyx on Atariage
\ RE-WRITE for  CAMEL99 Forth. Game specific language demonstration
\ Brian Fox  Dec 12, 2019 // Update Aug 25 2022

\ INCLUDE DSK1.TOOLS
NEEDS RANDOM FROM DSK1.RANDOM
NEEDS INPUT  FROM DSK1.INPUT
NEEDS CASE:  FROM DSK1.FASTCASE
NEEDS CASE   FROM DSK1.CASE
NEEDS ENUM   FROM DSK1.ENUM
NEEDS MARKER FROM DSK1.MARKER

CR .( Compiling Oregon Trail )
.( .)
: PRINT."  POSTPONE CR  POSTPONE ." ; IMMEDIATE

\ Print a stack string centered on the screen
: CENTERTYPE  ( addr len -- ) DUP C/L@ SWAP - 2/ 1- SPACES TYPE ;

\ Compile text string and print on a newline centered on the screen
: CENTER."
        ?COMP
        POSTPONE CR
        POSTPONE S"
        POSTPONE CENTERTYPE ;  IMMEDIATE

\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\ helpers for choice tables....
\ : CLIP     ( n lo hi -- n') ROT MIN MAX ;   \ clip input to lo/hi

DECIMAL
\ RANDOM is used to select random actions range= 0 .. n
\ Usage:  7 RANDOM DISEASES
: RANDOM   ( n -- n )  RND  ;

\ random#  returns 1 .. n
: RANDOM#   ( n -- n )  RND 1+ ;

\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\ G A M E  L A N G U A G E
DECIMAL
: 3RD     ( a b c -- a b c a ) 2 PICK ;  \ get a copy of 3rd item on the stack

\ text game language extensions
: BETWEEN ( n lo hi -- ?) 1+ WITHIN ;

: %CHANCE     ( n -- ? )  100 RND >  ;
.( .)
\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\ control structure replaces if else then
: DOTHIS      POSTPONE IF   ; IMMEDIATE
: OTHERWISE   POSTPONE ELSE ; IMMEDIATE
: CONTINUE    POSTPONE THEN ; IMMEDIATE

\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\ syntax sugar for creating vector tables
: CHOICE:  :NONAME ;

: CHOICES,  ( addr... addr[n] n -- )
      DEPTH 1- OVER < ABORT" Not enough choices on stack"
      0 ?DO  COMPILE, LOOP ; \ compile addresses

\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\ read #input into a variable and test for limits
: VALID-INPUT ( variable  lo  hi  -- n )
          BEGIN
             3RD DUP #INPUT
             @ 3RD 3RD BETWEEN  \ fetch from variable, check limits
          UNTIL
          2DROP @ ;  \  drop limits, fetch variable value

HEX
: TOUPPER  ( c -- c') 5F AND ;

DECIMAL
: YES?    ( -- ?) PRINT." Y/N?"  KEY TOUPPER [CHAR] Y = ;

: .R      ( n width -- )  \ print n right justified
          >R DUP ABS 0 <# #S ROT SIGN #> R> OVER - SPACES  TYPE ;

: DEBIT     ( n variable -- ) DUP >R @ SWAP NEGATE + 0 MAX  R> ! ;
: CREDIT    ( n variable -- ) +! ;
.( .)

\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\ set screen color with black letters
HEX
: CYAN   ( -- ) 17 7 VWTR ;
: GREEN  ( -- ) 13 7 VWTR ;
: YELLOW ( -- ) 1B 7 VWTR ;

DECIMAL
: ROLL-DICE  ( -- n ) 12 RANDOM#  ;  \ Random # 1..12
\ : TESTDICE   BEGIN   ROLL-DICE .   ?TERMINAL UNTIL ;

\ random delay with dot printing
: ...  ( n -- ) 8 RANDOM#   0 ?DO  [CHAR] . EMIT  250 MS   LOOP ;


\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\           O R E G O N   C O D E   S T A R T S   H E R E

DECIMAL
\ game data
1847 CONSTANT YEAR
 100 CONSTANT DESTINATION ( how far we have to travel)

VARIABLE TEMP
VARIABLE ACCURACY
VARIABLE TOTAL
.( .)
\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\ status variables for the traveller
VARIABLE BUDGET
VARIABLE HEALTH
VARIABLE OXEN
VARIABLE OXEN#  ( normally 2)
VARIABLE FOOD
VARIABLE QUALITY
VARIABLE AMMO
VARIABLE CLOTHES
VARIABLE MISC
VARIABLE CASH
VARIABLE WOUNDED

VARIABLE ACTION
VARIABLE MILEAGE
VARIABLE DAY
VARIABLE LASTDAY ( # days to get to oregon is random )
VARIABLE MONTH

: NEWGAME
     HEALTH OFF
     OXEN OFF
     2 OXEN# !
     FOOD OFF
     AMMO OFF
     CLOTHES OFF ( no peeking!)
     MISC OFF
     CASH OFF
     WOUNDED OFF
     MILEAGE OFF
     1 DAY !
     30 RANDOM# 30 + LASTDAY !  ( max will be 59 days)
     400 RANDOM# 500 +  800 MIN  BUDGET !
;

: DEBIT-TOTAL   ( n -- ) TOTAL DEBIT ;

: ?DAY    TRUE ABORT" Bad day#"  ;
: ?MONTH  TRUE ABORT" Bad Month#" ;

\ days print themselves
: .MON     ." Monday" ;      : .TUE    ." Tuesday" ;
: .WED     ." Wednesday" ;   : .THU    ." Thursday" ;
: .FRI     ." Friday" ;      : .SAT    ." Saturday" ;
: .SUN     ." Sunday" ;
.( .)
\ a table of execution addresses of days
CASE: DAYS  ( day# -- )
      | .SUN | .MON | .TUE | .WED
      | .THU | .FRI | .SAT | ?DAY
;CASE

: .DOW     DAY @ 6 MOD DAYS ." , " ;
: .DAY#    DAY @ 2 .R ;

\ Months print themselves
: JAN    ." January" ;      : JUL   ." July" ;
: FEB    ." February" ;     : AUG   ." August" ;
: MAR    ." March" ;        : SEP   ." September" ;
: APR    ." April"  ;       : OCT   ." October" ;
: MAY    ." May" ;          : NOV   ." November" ;
: JUN    ." June" ;         : DEC   ." December" ;

CASE: MONTHS ( 1..12 -- ) \ prints month by no. input
     | ?MONTH
     | JAN | FEB  | MAR  | APR
     | MAY | JUN  | JUL  | AUG
     | SEP | OCT  | NOV  | DEC
     | ?MONTH
;CASE

: .MONTH  ( -- )  MONTH @  MONTHS ;
: .DATE  ( -- ) .DOW  .MONTH  .DAY# ." , "  YEAR . ;

.( .)
\ DOLLAR value formatted printing
: >$<    ( -- n ) [CHAR] $ HOLD ;
: >.<    ( -- n ) [CHAR] . HOLD ;
: '00'    [CHAR] 0 DUP HOLD HOLD ;
: .DOLLARS   ( n -- ) DUP ABS 0  <# '00' >.< #S >$< ROT SIGN #> TYPE SPACE ;
: @.$    ( addr -- )  @ .DOLLARS ;

: .BALANCE    PRINT." YOU HAVE "  TOTAL @.$ ." left" ;

: GET_ACCURACY ( -- )
          PRINT."  How well can you shoot?"
          PRINT."  (1) BEST"
          PRINT."  (2) GOOD"
          PRINT."  (3) FAIR"
          PRINT."  (4) Not sure..."
          PRINT."  (5) BAD"
          PRINT."  (1..5) : "
          ACCURACY  1 5 VALID-INPUT
          DUP 4 = IF  DROP  6 RND 1+ 25 * THEN  ACCURACY !  ;

: TEAM    ( -- )
          CR
          PRINT." How much do you want to spend"
          PRINT." on your team of oxen? ($50-$500)"
          OXEN 50 500 VALID-INPUT ;

: GETFOOD  ( -- ) PRINT."  ON FOOD "            FOOD  0 TOTAL @ VALID-INPUT ;
: GETAMMO  ( -- ) PRINT."  ON AMMUNITION "      AMMO  0 TOTAL @ VALID-INPUT ;
: CLOTHING ( -- ) PRINT."  ON CLOTHING "     CLOTHES  0 TOTAL @ VALID-INPUT ;
: GETMISC  ( -- ) PRINT."  ON MISC. SUPPLIES "  MISC  0 TOTAL @ VALID-INPUT ;

: .Y/N     ( ? --) DOTHIS ." Yes"   OTHERWISE ." No"   CONTINUE ;
.( .)

: .SUPPLIES
         CR
         PRINT."     -- Supplies Report --"
         CR    .DATE
         PRINT." FOOD          :   "  FOOD    @.$
         PRINT." BULLETS       :   "  AMMO    @.$
         PRINT." CLOTHING      :   "  CLOTHES @.$
         PRINT." MISC. SUPPLIES:   "  MISC    @.$
         PRINT." CASH          :   "  CASH    @.$
         PRINT."        -- Status --"
         PRINT."  Health       :   "  HEALTH @  4 .R
         PRINT."  Wounded      :   "  WOUNDED @ .Y/N
         CR
;

: BUYSTUFF
          PRINT."  Let's get you set you for the trip:"
          TEAM     DEBIT-TOTAL .BALANCE
          GETFOOD  DEBIT-TOTAL .BALANCE
          GETAMMO  DEBIT-TOTAL .BALANCE
          CLOTHING DEBIT-TOTAL .BALANCE
          GETMISC  DEBIT-TOTAL .BALANCE
          TOTAL @ CASH !
;

: SETUP   CR
          PRINT."  Your budget for the trip is: " BUDGET @.$
          BUDGET @ TOTAL !
          GET_ACCURACY
          BUYSTUFF
          100 HEALTH !
          WOUNDED OFF
          .SUPPLIES
;
.( .)
\ =====================================================
\ End of game messages
: AGAIN?  CR
          PRINT." Type RUN to play again"
          PRINT." Type BYE to leave the game"
          ABORT ;

: SORRY  GREEN CR
         PRINT."  ********************************"
         PRINT."  We are sorry. You didn't make it"
         PRINT."  to the great territory of Oregon."
         PRINT."  We will notify yer kinfolk."
         CR
         PRINT."  - Sincerely"
         CR
         PRINT."           The Oregon"
         PRINT."      -Chamber of Commerce-"
         HEALTH OFF
         AGAIN? ;

: CONGRATS
         GREEN
         CR CR
         PRINT." *****************************"
         PRINT." *  Y O U   M  A  D E   I T  *"
         PRINT." *****************************"
         PRINT." President James K. Polk"
         PRINT." sends you his heartiest"
         PRINT." congratulations."
         CR
         PRINT." He wishes you a prosperous life"
         PRINT." at your new Oregon home." CR CR
         AGAIN? ;
.( .)

: SEE-DOCTOR
         CR  ...
         PRINT." The doc wants " 20 RANDOM# 4 +  DUP .DOLLARS HEALTH DEBIT
         PRINT." to patch you up."
         CASH @ 8 <
         DOTHIS
            PRINT." You cain't afford it partner!"

         OTHERWISE
          CR
          PRINT." You got enough money."
          PRINT." He's good with the needle & thread"
          PRINT." Let him do it?"
          YES? DOTHIS
               CASH DEBIT  ( subtract the payment)
               WOUNDED OFF
               12 RANDOM# HEALTH CREDIT
               PRINT." You ain't as dumb as ya look."
            OTHERWISE
                CR PRINT." Ya feel lucky I reckon!"
                CR
             CONTINUE
         CONTINUE
;

.( .)
\ ====================================================
\ random sickness selector   Health debit for each sickness
CHOICE:  ." Swine Flu"          10 HEALTH DEBIT ;
CHOICE:  ." Scurvy"             15 HEALTH DEBIT ;
CHOICE:  ." Infection"          20 HEALTH DEBIT ;
CHOICE:  ." Consumption"        20 HEALTH DEBIT ;
CHOICE:  ." Typhoid fever"      23 HEALTH DEBIT ;
CHOICE:  ." Pneumonia"          30 HEALTH DEBIT ;
CHOICE:  ." an unknown disease" 30 HEALTH DEBIT ;
CHOICE:  ." Smallpox"           45 HEALTH DEBIT ;
CHOICE:  ." Bubonic plague"     55 HEALTH DEBIT ;
CHOICE:  ." Rabies"              0 HEALTH ! ;

CASE: DISEASES  10 CHOICES,  ;CASE
: SICKNESS      10 RANDOM DISEASES ;

: ?DEAD
         HEALTH @ 1 <
         DOTHIS  ...
            CR PRINT." Unfortunately you died on"  1000 MS
            CR .DATE
            SORRY
        CONTINUE ;

CHOICE: ." hand"    4 HEALTH DEBIT  ;
CHOICE: ." leg"     7 HEALTH DEBIT  ;
CHOICE: ." arm"     5 HEALTH DEBIT  ;
CHOICE: ." backside :-)"
        CR ." (sorry, 't ain't funny)"  8 HEALTH DEBIT ;
CHOICE: ." belly"  10 HEALTH DEBIT ;
CHOICE: ." head..."  HEALTH OFF ;
CHOICE: ." heart!"   HEALTH OFF ;

CASE: ANATOMY   7 CHOICES,   ;CASE

: BODYPART      7 RANDOM ANATOMY ;
.( .)
\ =====================================================
\ BAD luck
: STARVED
         PRINT."  You ran out of food and"
         PRINT."  starved to death"
         HEALTH OFF
         SORRY ;

: SNAKEBITE
         PRINT." You got bit by a snake!" ...
         PRINT." Right in the " BODYPART
         50 %CHANCE
         DOTHIS
            PRINT." there ain't no cure fer it!"
            HEALTH OFF
            SORRY
         OTHERWISE
            PRINT." You darn near died!"
            10 RANDOM HEALTH DEBIT
        CONTINUE
;

: MASSACRE
          PRINT." You were attacked and"
          PRINT." massacred by criminals"
          HEALTH OFF
          SORRY ;

: FROZE
          PRINT." Weather took a turn partner."
          PRINT." It went down to 30 below."
          PRINT." You and the family froze solid"
          HEALTH OFF
          SORRY
;
.( .)
: NOMEDICINE
          CR
          PRINT."  You ran out of medical supplies."
          PRINT."  There was no way to help."
          HEALTH OFF
;

: BANDITS
          PRINT."  Bandits Attacked!" HONK CR
          30 %CHANCE
          DOTHIS
             PRINT."  You ran out of bullets--"
             PRINT."  They got lots of yer cash"
             50 RANDOM# CASH DEBIT
             AMMO OFF
          CONTINUE

          20 %CHANCE
          DOTHIS
               PRINT." and... they took one of your oxen"
               1 OXEN# DEBIT
          CONTINUE

          10 %CHANCE
          DOTHIS
              WOUNDED ON
          CONTINUE
;

.( .)
: VERYSICK
          PRINT." Partner you is looking sickly."
          PRINT." The Doc says you gotta rest here "
          PRINT." fer " 5 RANDOM# 1+ DUP . ."  days. "  DAY CREDIT
          PRINT." cuz you got  " SICKNESS
          ...
          ?DEAD

          CR
          13 %CHANCE DOTHIS
                   PRINT." I got some bad news partner" ...
                   NOMEDICINE
                   ?DEAD
          CONTINUE

          50 %CHANCE DOTHIS
                  PRINT." You is on the mend partner!"
                  40 HEALTH CREDIT
          OTHERWISE
                   PRINT." You didn't make a full recovery"
                   PRINT." but ya ain't dead yet!"
                   13 RANDOM# HEALTH CREDIT
          CONTINUE
 ;

 \ =========================================
 CHOICE:  ." wheel" ;
 CHOICE:  ." axle" ;
 CHOICE:  ." yoke" ;
 CHOICE:  ." whipple-tree" ;
 CHOICE:  ." seat" ;
 CASE: PARTS  5 CHOICES,   ;CASE

: PART    5 RANDOM PARTS  ;

: BUSTED-WAGON
        PRINT." Yer wagon gots a busted " PART
        PRINT." It's gonna take some time to fix 'er up!"
        3 RANDOM# DAY CREDIT
        ...
        PRINT." That'll cost ya "
        5 RANDOM# DUP .DOLLARS
        CASH DEBIT
        5 RANDOM# MISC DEBIT
;

: SWAMPED
      CR
      PRINT." Wagon gets swamped fording a"
      PRINT." river. You lost some food"
      20 RANDOM 10 +   FOOD DEBIT
      ...
      33 %CHANCE
      DOTHIS
         PRINT." and some clothes"
         20 RANDOM#  CLOTHES DEBIT
      CONTINUE
;

: FOG
     PRINT." Lost your way in a heavy fog"
     ...
     PRINT." You lost " 3 RANDOM# DUP . DAY CREDIT ." days."
     20 RANDOM# FOOD DEBIT
;

: FIRE
     PRINT." There was a fire in your"
     PRINT." wagon. Food and supplies"
     PRINT." are damaged!"
     20 RANDOM 10 + FOOD DEBIT
     10 RANDOM 2 +  MISC DEBIT
;
CR .( 50% complete ...)
CR
: RAIN
     PRINT." Heavy rain" ...
     PRINT." Time & supplies were lost." ...
     3 RANDOM#   DAY  CREDIT
     7 RANDOM#   MISC DEBIT
    12 RANDOM#   FOOD DEBIT
;

: BAD-WATER
     PRINT." Bad water, You lost time"
     PRINT." looking for a clean spring."
     ...
     3 RANDOM# DAY CREDIT
     3 RANDOM HEALTH DEBIT
;

: SONLOST
     PRINT." Your son wandered off" ...
     PRINT." Spent a day looking for him"
     1 DAY CREDIT
     2 FOOD DEBIT
;

: OXLOST
     PRINT." OX wandered off. Two days lost" ...
     2 DAY CREDIT

     PRINT." (Tie him up next time)"
     4 RANDOM FOOD DEBIT
;
.( .)
: TERRAIN
     PRINT." RUGGED MOUNTAINS" ...
     37 %CHANCE
     DOTHIS
        PRINT." You got lost and loose valuable"
        PRINT." time trying to find a trail."
        2 DAY CREDIT
     OTHERWISE
         PRINT." You pushed through."
     CONTINUE

     21 %CHANCE
     DOTHIS
        PRINT." Wagon damaged! Lost time and supplies"
        2 RANDOM#   DAY CREDIT
        4 RANDOM#   FOOD DEBIT
        2 RANDOM    MISC DEBIT
     CONTINUE
;

: BLIZZARD
     PRINT." Blizzard in mountains at south pass" ...
     47 %CHANCE DOTHIS
         PRINT." Snow was " 3 RANDOM 2 + .  ." feet deep"
         PRINT." Time & supplies lost"
         2 RANDOM#   DAY CREDIT
         2 RANDOM   MISC DEBIT
         4 RANDOM#  FOOD DEBIT
    OTHERWISE
        PRINT." You made it safely through."
        PRINT." Only light snow."
        CR
    CONTINUE
;
.( .)
CASE: TRAGEDIES ( ndx --)
       | SNAKEBITE  | MASSACRE     | FROZE
       | BANDITS    | VERYSICK     | BUSTED-WAGON   | SWAMPED
       | FOG        | FIRE         | RAIN           | BAD-WATER
       | SONLOST    | OXLOST       | TERRAIN        | BLIZZARD
;CASE

DECIMAL
: SHITHAPPENS
        CR  ...
        PRINT." Tragedy has done commenced!"
        CR
        14 RANDOM TRAGEDIES
        ?DEAD ;

: ?BROKE
        CASH @ 1 <
        DOTHIS
           PRINT." Partner, yer flat broke!"
        CONTINUE ;
.( .)
: DOCTOR?
     PRINT." Wanna see a doctor?"
     YES?
     DOTHIS
          SEE-DOCTOR
     OTHERWISE
         PRINT." Ok, it's yer funeral."
     CONTINUE
;

: ?HEALTH
      20 %CHANCE
      DOTHIS  ( don't report this all the time)
         HEALTH @ 20 <
         DOTHIS  CR PRINT." You don't look so good partner." DOCTOR?  CONTINUE

         HEALTH @ 20 30 BETWEEN
         DOTHIS  CR PRINT." You gotta look after yerself better."  CONTINUE

         HEALTH @ 31 49 BETWEEN
         DOTHIS  CR PRINT." You feelin' ok? Ya looks kinda pale." CONTINUE

         HEALTH @ 49 >
         DOTHIS  CR PRINT." Yer still lookin' purty healthy"  CONTINUE
     CONTINUE
;

: ?SEE-DOCTOR
     CR
     PRINT." Wanna have a doc look at you?"
     YES?
     DOTHIS
        SEE-DOCTOR
        60 %CHANCE
        DOTHIS
            PRINT." He patched you up!"
            10 RANDOM HEALTH CREDIT
            WOUNDED OFF
         OTHERWISE
            PRINT." He fixed it but yer still hurtin'"
            WOUNDED OFF
            20 RANDOM# HEALTH DEBIT
        CONTINUE
     CONTINUE
     ?DEAD ;

.( .)
: GOTSHOT
          PRINT." OUCH! You got shot in the " BODYPART
          20 RANDOM#  HEALTH DEBIT
          ?DEAD
          WOUNDED ON
          5  RANDOM# MISC DEBIT
          10 RANDOM# AMMO DEBIT

          25 %CHANCE
          DOTHIS
             PRINT." and they took one of your oxen."
             1 OXEN# DEBIT
          CONTINUE

         ?SEE-DOCTOR
;

: ?GOTSHOT
         WOUNDED @ DOTHIS  GOTSHOT  CONTINUE ;

: WANNAEAT  ( -- n)
          CR
          PRINT." How do you wanna eat?"
          PRINT."   (1) POORLY"
          PRINT."   (2) OK"
          PRINT."   (3) WELL? "
          QUALITY 1 3 VALID-INPUT
;

: RUNNING
          PRINT." You are running away" ...
          5 %CHANCE DOTHIS
               WOUNDED ON
          CONTINUE
          10 %CHANCE DOTHIS
              GOTSHOT
          CONTINUE
          9 RANDOM# OXEN @ * MILEAGE CREDIT
          30 RANDOM#  OXEN DEBIT
          25 RANDOM#  HEALTH DEBIT

           3 RANDOM  DAY CREDIT
;
.( .)
: ATTACK    PRINT."  You are attacking " ...
            24 RANDOM#  AMMO DEBIT
            AMMO @ 10 < DOTHIS
                CR
                PRINT." Crap! We is gettin' low on ammo!"
                CR
            CONTINUE

            50 RANDOM# ACCURACY @ / %CHANCE
            DOTHIS
                PRINT." You scared them off!"
                PRINT." and found their money and food"
                CR
                60 RANDOM# FOOD CREDIT
                55 RANDOM# CASH CREDIT
                15 RANDOM# HEALTH CREDIT
            OTHERWISE
                GOTSHOT
            CONTINUE
;

: DEFEND    PRINT." We circled the wagons" ...
            PRINT." and let 'em have it!" ...
            24 RANDOM#  AMMO DEBIT
            AMMO @ 0= DOTHIS
                CR
                PRINT." Ah Spit! We is outta ammo!"
                CR
            CONTINUE

            50 RANDOM# ACCURACY @ / %CHANCE
            DOTHIS
               CR
               PRINT." You are a pretty good shot!"
               PRINT." They took off and left us alone"
               CR
               10 RANDOM# HEALTH CREDIT
               10 RANDOM# OXEN CREDIT
               20 RANDOM# AMMO DEBIT

            OTHERWISE
               CR
               PRINT." We took some hits but survived"
               5 %CHANCE DOTHIS    WOUNDED ON    CONTINUE
               25 RANDOM# AMMO DEBIT
               10 RANDOM# HEALTH DEBIT
               10 RANDOM# OXEN DEBIT
               30 %CHANCE DOTHIS
                     GOTSHOT
                 CONTINUE
            CONTINUE

;
.( .)
: KEEP-MOVING
         CR
         3 %CHANCE DOTHIS
             PRINT." Rollin Rollin Rollin..."
             PRINT." Man my butt is swollen..."
         CR
         OTHERWISE
             PRINT."  Move 'em out "
         CONTINUE ...

          3 RANDOM    HEALTH  DEBIT
         10 RANDOM#   OXEN    DEBIT
          4 RANDOM    CLOTHES DEBIT
          9 RANDOM#   OXEN# @ *  MILEAGE CREDIT
         26 %CHANCE DOTHIS    SHITHAPPENS   CONTINUE
;

CASE: REACTION  ( n -- )
       | RUNNING | ATTACK  | KEEP-MOVING  | DEFEND
;CASE

: HOSTILE-DECIDE ( -- )
         PRINT." They look hostile!"
         PRINT." Whaddya reckon we should do?"
         PRINT."   (1) RUN"
         PRINT."   (2) ATTACK"
         PRINT."   (3) CONTINUE"
         PRINT."   (4) DEFEND"
         ACTION 1 4 VALID-INPUT DROP
         CR ...
         ACTION @ 1- REACTION
         ?GOTSHOT
;

\ ======================================
\ random names for food
CHOICE: ." eatin'" ;
CHOICE: ." food" ;
CHOICE: ." viddles" ;
CHOICE: ." grub" ;
CASE: FOODS  4 CHOICES,  ;CASE
: FOODSTUFF  4 RANDOM FOODS ;
.( .)
\ ======================================
\ game animals
CHOICE: ." deer"
        PRINT." We got food for days!" CR
        87 FOOD CREDIT ;

CHOICE: ." possum"
        PRINT." Ain't much food but better than nothin'" CR
         10 FOOD CREDIT ;

CHOICE: ." squirrel"
        PRINT." We is gonna be hungry" CR
         5 FOOD CREDIT ;

CHOICE: ." duck"
        PRINT." A little greasy, but fillin'" CR
        15 FOOD CREDIT ;

CHOICE: ." turkey"
        PRINT." Now that's some good viddles" CR
         25 FOOD CREDIT  ;

CASE: VARMINTS  5 CHOICES,   ;CASE

: ANIMAL    5 RANDOM VARMINTS ;
.( .)
: HUNT
        PRINT." You are hunting"
        PRINT." Be vaarrwee quiet " ...
        PRINT." Press space bar to fire"
        BEGIN KEY? BL = UNTIL
        CR PRINT." BANG!" CR

        ACCURACY @ RANDOM# HEALTH @ *   \  HEALTH affects accuracy
        55 MAX %CHANCE DOTHIS
             PRINT." You shot a " ANIMAL
        OTHERWISE
             PRINT." You missed."
             PRINT." Yer gonna be hungry tonight." ...
             5 FOOD DEBIT
             3 HEALTH DEBIT
       CONTINUE
       5 RANDOM 1+ AMMO DEBIT
;

: .CASH  ." You have " CASH @.$ ." cash" ;

: BUYFOOD
         PRINT." How much do you want to spend?"
         CR .CASH
         TEMP  1 CASH @  VALID-INPUT
         DUP CASH DEBIT  FOOD CREDIT
         CR .CASH ." left"
;

\ ================================================
\ status testers begin with a ?

: ?FOOD  \ test DOTHIS we have enough Food points left
          FOOD @ 0= DOTHIS   STARVED  CONTINUE
          FOOD @ 10 <
          DOTHIS
              PRINT." You need to do some hunting
              PRINT." or by some " FOODSTUFF ." !!!"
              PRINT." 1. Hunt"
              PRINT." 2. Buy Food"
              PRINT." Enter to go on"
              CR
              KEY
              CASE
                  [CHAR] 1 OF HUNT     ENDOF
                  [CHAR] 2 OF BUYFOOD  ENDOF
              ENDCASE
          CONTINUE ;
.( .)
: ?WOUNDED
         WOUNDED @ 0 <>
         DOTHIS CR
            PRINT." Did you know you are wounded?"
            DOCTOR?
         CONTINUE
;

: ?TIMEOUT
         DAY @ LASTDAY @ >
         DOTHIS
            CR PRINT." It's a terrible shame."
            1000 MS
            PRINT." Y'all didn't get to Oregon in time."
            1000 MS
            PRINT." I reckon yer lost" CR CR
            SORRY
         CONTINUE
  ;
.( .)
\ good stuff that can happen OR NOT!
CHOICE: ." Comanche" ;
CHOICE: ." Sioux"  ;
CHOICE: ." Apache" ;
CHOICE: ." Cheyenne" ;
CHOICE: ." Navaho" ;
CHOICE: ." Blackfoot" ;
CASE: TRIBES    6 CHOICES,   ;CASE
: TRIBE   5 RND TRIBES ;

: NATIVES
        CR
        PRINT." You bumped into a tribe of " TRIBE ." ."
        8 %CHANCE
        DOTHIS
          PRINT." You said something wrong..."
          PRINT." They took your wife and kids." ...
          PRINT." and left you alone to die."
          HEALTH OFF ?DEAD   SORRY
       CONTINUE

       50 %CHANCE
       DOTHIS
            PRINT." They gave you some fresh " FOODSTUFF
            20 RANDOM# FOOD CREDIT
            20 RANDOM# HEALTH CREDIT
       CONTINUE

       22 %CHANCE
       DOTHIS
          PRINT." and fed your animals!"
          50 RANDOM# OXEN CREDIT
       CONTINUE
;

: HUNTER
         33 %CHANCE
         DOTHIS
             CR PRINT." You met a hunter and he gave you a " ANIMAL
         CONTINUE
;

: GRAZING
         50 %CHANCE DOTHIS
             CR
             PRINT." Good luck!"
             PRINT." Your Oxen found some nice grazing."
             25 RANDOM#  OXEN CREDIT
         CONTINUE
;

: GOODWEATHER
           63 %CHANCE DOTHIS
             CR
             PRINT." The weather is good for travelling."
             2 OXEN CREDIT
             2 HEALTH CREDIT
             2 CLOTHES CREDIT
          CONTINUE
;

CASE: GOODTHINGS
     | NATIVES  | HUNTER  | GRAZING | GOODWEATHER
;CASE

: HAPPYDAYS   4 RANDOM GOODTHINGS  ;
.( .)
: AreWeThereYet?
         MILEAGE @ DESTINATION  >
         DOTHIS
            CONGRATS
         THEN
         PRINT." We travelled "  MILEAGE @ . ." miles."
;

: CONSUME  \  things are used up every day
       6 RANDOM# HEALTH DEBIT
      10 RANDOM# OXEN# @ * 2+ OXEN DEBIT
      10 RANDOM# FOOD DEBIT
       9 RANDOM# CLOTHES DEBIT
      10 RANDOM# MISC DEBIT
;

: ?OXEN
         OXEN @ 10 <
         DOTHIS
             PRINT." Yer oxen are almost dead!"
             PRINT." Wanna stop for grazing"
             YES?
             DOTHIS
                35 RANDOM# OXEN CREDIT
                PRINT." Your oxen got a good rest"
                CR
             OTHERWISE
                 30 RANDOM# OXEN DEBIT
             CONTINUE

             OXEN @ 0=
             DOTHIS
               PRINT." Your oxen are dead."
               PRINT." You ran them into the ground!"
               PRINT." You never made it out..."
               STARVED
             CONTINUE

             OXEN @ 15 <
             DOTHIS
                 PRINT." Your oxen are still weak"
             OTHERWISE
                PRINT." You oxen are doing better"
             CONTINUE
      CONTINUE
;

: ?ENEMIES
        5 %CHANCE DOTHIS
              CR PRINT." Uhoh, we got company!"
              HOSTILE-DECIDE
        CONTINUE ;


CHOICE: CR CR ." Your cheap coat fell apart. "
        CR ." You died of exposure. "  ;

CHOICE: CR CR ." Your cheap boots rotted away. "
        CR CR ." Your feet rotted next! " ;

CHOICE: CR CR ." Your cheap underwear chaffed your privates!"
        CR CR ." You died crying..." ;

CHOICE: CR CR ." That cheap hat was infested with earwig eggs."
        CR ." They ate your brain" ;

CASE: WARDROBE-FAILURE   4 CHOICES,   ;CASE

: ?CLOTHING
        CLOTHES @ 1 <
        DOTHIS
          4 RANDOM WARDROBE-FAILURE
          HEALTH OFF
          SORRY
        CONTINUE ;

.( .)
: TITLE-PAGE
         TEXT  GREEN
         CENTER." * O R E G O N  T R A I L *"
         CR
         CENTER." The game that time forgot"
         CR
         CR
         CR
         2000 MS
         CENTER." Based on BASIC version
         CENTER." by Majestyx on Atariage"
         1000 MS
         CR
         CR
         CR
         CR
         CENTER." Re-write in Forth by TheBF"
         CR
         CENTER." Version 1.6"
         0 22 AT-XY
         CENTER." Press a key to begin"
         KEY DROP
;

: OPENING
         TITLE-PAGE
         YELLOW PAGE
         PRINT."  -- You're on the Oregon trail" ...
         12 RANDOM# MONTH !
         1 DAY !
         CR .DATE ...
         SETUP
;
.( .)
: CAMP   CR
         PRINT." Oxen are tied up, fire is lit."
         PRINT." Get some sleep partner" ...
         33 %CHANCE DOTHIS
              PRINT." Uhoh! I heard some footsteps"
              PRINT." over yonder!"
              HOSTILE-DECIDE
        OTHERWISE
              CR
              PRINT." We had a peacful night"
              PRINT." Eat some vittles and git goin'"
              10 RANDOM#  FOOD DEBIT
              10 HEALTH   CREDIT
              20 RANDOM#  OXEN# @ *  OXEN CREDIT
        CONTINUE
;
.( .)
: VALIDATE ( c addr len -- ? )  ROT SCAN NIP ;

: MENU-KEY ( c)
         BEGIN
            KEY  DUP S" 12349" VALIDATE
         0= WHILE
            DROP
         REPEAT ;

.( .)
: MENU
     CR
     PRINT." It's day " .DAY#
     PRINT." What do you want to do?"
     PRINT." 1) Keep moving"
     PRINT." 2) Setup Camp for the night"
     PRINT." 3) Hunt"
     PRINT." 4) Check supplies"
     CR ." > " MENU-KEY DUP EMIT
     CASE
       [CHAR] 1 OF KEEP-MOVING ENDOF
       [CHAR] 2 OF CAMP        ENDOF
       [CHAR] 3 OF HUNT        ENDOF
       [CHAR] 4 OF .SUPPLIES   ENDOF
       [CHAR] 9 OF ." Secret programmer escape ;-)" ABORT ENDOF
                HONK
    ENDCASE
;

CR .( . Starting...)
: RUN ( -- )
    DECIMAL
    NEWGAME
    OPENING
    BEGIN
      MENU
      CONSUME
      15 %CHANCE
      DOTHIS SHITHAPPENS
      OTHERWISE
          AreWeThereYet?
      CONTINUE
      26 %CHANCE DOTHIS   HAPPYDAYS    CONTINUE
      ( test our status)
      ?FOOD     ?OXEN    ?CLOTHING ?BROKE
      ?ENEMIES
      ?WOUNDED  ?HEALTH  ?DEAD
      1 DAY CREDIT
      ?TIMEOUT
   AGAIN ;

: START  WARM  RUN ;

LOCK
INCLUDE DSK1.SAVESYS

' START SAVESYS DSK3.OREGON

 

 

 

OREGONTRAIL.ZIP

  • Like 7
Link to comment
Share on other sites

While I'm at it here is a politically incorrect SNAKE game where the snake likes mice not apples. 

I can't get past 14 ft.  in "Viper" speed mode. Let me know how you do. 

 

Requires Editor/Assembler cartridge or equivalent program file loader. 

 

Source available on request. 

 

SNAKE-EA5.ZIP

  • Like 3
Link to comment
Share on other sites

1 hour ago, TheBF said:

I don't have a Final Grom (guess I should).

I am interested in the process of how you do that.

I've used ModuleCreator2 tool. Just convert the EA5 files in V9T9 format with TiDir, then use the GUI of the tool to create the SSS. There are also the MakeCart util from Tursi and the Java program from Rasmus that can be used to create carts.

ModuleCreator2 is generating a 8.bin SSS file that can be used with FinalGROM, MiSTer FPGA TI99 core and the various emulators (Classic99, MAME).

 

 

  • Like 2
  • Thanks 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...