home *** CD-ROM | disk | FTP | other *** search
- ╔════════════════════════════════════════════════════╗
- ║ Lesson 2 Part 015 F-PC 3.5 Tutorial by Jack Brown ║
- ╚════════════════════════════════════════════════════╝
-
- ┌──────────────────────────────────────────────────────┐
- │ Review some of the words we have introduced so far. │
- └──────────────────────────────────────────────────────┘
-
- In the following we are using the "stack picture" to show the
- parameters required by the words. Stack Picture notation:
-
- ( "stack inputs" -- "stack outputs" )
- where -- indicates word action.
-
- ┌──────────┐
- │ Output │
- └──────────┘
-
- SPACE ( -- ) ( Send a space to the display. )
- SPACES ( n -- ) ( Send n spaces to display. )
- CR ( -- ) ( Start a new line on display. )
- EMIT ( n -- ) ( Display ASCII character n . )
- . ( n -- ) ( Send top of stack to display. )
-
- ┌─────────────┐
- │ Arithmetic │
- └─────────────┘
-
- + ( m n -- sum ) ( Leave sum: sum = m + n )
- - ( m n -- dif ) ( Leave difference: dif = m - n )
- * ( m n -- prod ) ( Leave product: prod = m * n )
- / ( m n -- quot ) ( Leave quotient: quot = m / n )
-
- ┌────────┐
- │ Stack │
- └────────┘
-
- .S ( -- ) ( Non destructive stack print. )
- DUP ( n -- n n ) ( Duplicate top number on the stack. )
- SWAP ( n m -- m n ) ( Swap top two numbers on the stack. )
- ROT ( l m n -- m n l) ( ROTate 3rd number to the top of stack.)
- DROP ( n -- ) ( Discard top stack number. )
- MAX ( m n -- max ) ( Leave larger of m and n )
- MIN ( m n -- min ) ( Leave smaller of m and n )
- DEPTH ( -- n ) ( Leave count of stack items. )
-
- ┌───────────┐
- │ Comments │
- └───────────┘
-
- \ ( Comment to end of line. )
- ( everything in parenthesis is a comment too )
-
- ╓────────────────────╖
- ║ Review Assignment ║
- ╙────────────────────╜
-
- 1. You should be thoroughly familiar with the above words. If you
- haven't already done so use the MYQUIT outer interpreter to experiment
- with the above stack manipulating words.
-
- 2. Read the first two chapters of Starting Forth 2nd Edition and try the
- examples provided there with the outer interpreter MYQUIT functioning.
-
- 3. If you don't know about binary, octal, decimal, and hexadecimal
- numbering systems find out everything you can before reading the next
- message. Look at the first two chapters of an elementary book on 8086
- assembly language such as: IBM PC & XT Assembly Language by L.J. Scanlon
- for information on number systems and computer arithmetic.
-
- ┌────────────────────────────────────┐
- │ Please move to Lesson 2 Part 020 │
- └────────────────────────────────────┘
-