08-31-2022, 03:05 PM
Gosh, is FORTH still around!?
I got into FORTH on the Radio Shack COCO computer. The 6809 was a good CPU for FORTH.
I am even on the internet! (pg 25) http://www.forth.org/fd/FD-V04N6.pdf
As always, somebody does a good job in Wikipedia: https://en.wikipedia.org/wiki/Forth_(pro..._language)
Here is a code sample from page 180:
Exercize 2.15: Suppose the variables TEMP and HEATER-SWITCH have been declared
as part of an industrial simulation. TEMP holds a simulated temperature and
HEATERSWITCH holds a value that indicates whether a simulated heater is on or off.
Code a word STC (simulate temperature change'') which has the following spec.
If the value held in HEATER-SWITCH is non zero, add 2 to the value held in TEMP,
otherwise subtract 1 from the value held in TEMP.
Solution 2.15:
I got into FORTH on the Radio Shack COCO computer. The 6809 was a good CPU for FORTH.
I am even on the internet! (pg 25) http://www.forth.org/fd/FD-V04N6.pdf
As always, somebody does a good job in Wikipedia: https://en.wikipedia.org/wiki/Forth_(pro..._language)
Here is a code sample from page 180:
Exercize 2.15: Suppose the variables TEMP and HEATER-SWITCH have been declared
as part of an industrial simulation. TEMP holds a simulated temperature and
HEATERSWITCH holds a value that indicates whether a simulated heater is on or off.
Code a word STC (simulate temperature change'') which has the following spec.
If the value held in HEATER-SWITCH is non zero, add 2 to the value held in TEMP,
otherwise subtract 1 from the value held in TEMP.
Solution 2.15:
Code: (Select All)
: STC \ -
HEATER-SWITCH @
IF 2 ELSE -1 THEN
TEMP +!
;
___________________________________________________________________________________
I am mostly grateful for the people who came before me. Will the people after me be grateful for me?
I am mostly grateful for the people who came before me. Will the people after me be grateful for me?