This lesson will discuss more of the details of RAM organization, working with the stack and some minimal Forth programming. The 32 KiB expansion RAM on the TI-99/4A is organized as follows in fbForth 2.0: The 8 KiB lower RAM (2000h – 3FFFh) contains four fbForth block buffers, low-level Assembly Language support, system global variables (termed “user variables”) and the return stack. You will notice here that hexadecimal numbers in this discussion (not in actual Forth code!) have a trailing ‘h
This is the first of several tutorials to help those new to Forth, fbForth 2.0 in particular, to understand the language and its programming environment, as well as to gain some facility with it. fbForth is based on TI Forth, which was derived mostly from FIG-Forth with some influence from Forth-79. There are more recent Forth standards; but, compatibility with TI Forth was the prime concern.
The biggest difference between TI Forth and fbForth is that fbForth is a file-based system,
We can write better temperature conversion words than we did at the end of the last lesson. If you thought that the words using /MOD were contrived to introduce /MOD , you were mostly on target. To obviate the necessity of using /MOD , all we need to do is to manage the dividend before division by adding half of the divisor. As before, we must adjust the sign of the rounding term to match the sign of the dividend and adjust the conversion formula such that the rounding term is an integer.
In this lesson we will learn a few new arithmetic words, several words for stack manipulation and how to use them all in programming, i.e., defining new words.
Before we do much more Forth arithmetic, let’s exercise our brains with some infix-to-postfix and postfix-to-infix conversions. Remember that infix notation is the same as algebraic notation and postfix is the same as RPN. Many of these exercises are based on or taken directly from Brodie’s Starting FORTH.
Convert the following