home *** CD-ROM | disk | FTP | other *** search
- |O|Dalso ourdemo : junk ; last demo-hs !|E
- |B|" Here are the current dictionary pointers:"
- |Dmem. save-mem|E
- |" Notice how they change after the following definition."|A
- |K: Hello
- ." Greetings from the makers of LOVE FORTH" ;
- |O|B|Dmem. dif. |E
-
- |" The majority of this definition was added to the data segment."
- |" This is because text strings are always added to the data segment."
- |F
- |Dpage mem. save-mem create D2* |E
- |" Notice how a code definition is added to the code segment."|A
-
- |D\ |Ecode D2* ;( d -- d )
- |D\|E pop ax
- |D\|E pop bx
- |D\|E shl bx, 1
- |D\|E rcl ax, 1
- |D\|E push bx
- |D\|E push ax
- |D\|E next
- |K|D\ |Ec;|B
- |O|D|B10 dpcode +! -2 dp +! mem. dif. |E
- |" The two bytes added to the threads is the CFA of the new word."
- |F
- |Dpage mem. save-mem |E
- |" The next definition is entirely in high level Forth."
- |" Notice how the long name affects only the head segment."|A
-
- : ADD-SIX-TO-THE-TOP-OF-THE-STACK ( n -- n )|K
- 6 + ;
- |O|D|Bmem. dif. save-mem|E|A
- : 6+ ( n -- n )|K
- 6 + ;
- |O|D|Bmem. dif. |E
- |" The eight bytes in the thread segment are the body of the definition."
- |" In this case the code and data segments do not change."|A
-
- 46 ADD-SIX-TO-THE-TOP-OF-THE-STACK .|K
- 46 6+ .
- |A|F|Bourdemo to-menu
-