Post Reply 
FORTH Beginner Question.
09-06-2020, 08:12 PM (This post was last modified: 09-06-2020 08:13 PM by Sylvain Cote.)
Post: #5
RE: FORTH Beginner Question.
Try this:

Start FORTH and get dictionary free space
Code:
FORTH [ENTER]           // display: HP-71 FORTH 2A
ROOM  [ENTER]           // display: OK { 1 }        // get dictionary free space
.     [ENTER]           // display: 0  OK { 0 }     // show dictionary free space, should be 0

Grow the stack
Code:
1000  [ENTER]           // display: OK { 1 }        // enter 1000 on the stack
GROW  [ENTER]           // display: OK { 1 }        // grow dictionary free space
.     [ENTER]           // display: -1  OK { 0 }    // show grow result value, -1 means true means successfull

Create a new word
Code:
ROOM .        [ENTER]   // display: 1000  OK { 0 }  // show dictionary free space before MYDUP creation
: MYDUP DUP ; [ENTER]   // display: OK { 0 }        // add MYDUP word to the current dictionary
ROOM .        [ENTER]   // display: 968  OK { 0 }   // show dictionary free space after MYDUP creation
25 MYDUP      [ENTER]   // display: OK { 2 }        // put 25 on the stack and execute MYDUP
. .           [ENTER]   // display: 25 25 OK { 0 }  // dump stack on the screen

Leave FORTH
Code:
BYE   [ENTER]           // display: >
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
FORTH Beginner Question. - twoweims - 09-06-2020, 06:49 PM
RE: FORTH Beginner Question. - twoweims - 09-06-2020, 07:59 PM
RE: FORTH Beginner Question. - Sylvain Cote - 09-06-2020 08:12 PM
RE: FORTH Beginner Question. - rprosperi - 09-06-2020, 09:31 PM
RE: FORTH Beginner Question. - twoweims - 09-07-2020, 02:09 AM
RE: FORTH Beginner Question. - rprosperi - 09-07-2020, 02:50 AM
RE: FORTH Beginner Question. - Jim Horn - 09-08-2020, 02:26 AM



User(s) browsing this thread: 1 Guest(s)