text
stringlengths 0
99.6k
|
|---|
First, type in and LOAD the following definition:
|
: NEW-PUNCT ( CHAR -- FLAG)
|
ASCII : OVER = SWAP
|
ASCII + ASCII 0 >R OVER < SWAP R> < AND OR ;
|
Then, once your NEW-PUNCT has been loaded, type the following:
|
' NEW-PUNCT IS PUNCT?
|
Type the above carefully, or you could cause problems (don't forget the ' ). Blazin' Forth will now accept numbers as described in this section. If you prefer this new version, you may save the system with the word SAVE-FORTH. If you want to change back to the oolder version, do the following:
|
' (PUNCT?) IS PUNCT?
|
*ln2
|
Number Formatting -- Double Length Unsigned.
|
Pages 167-168
|
All of the definitions in this section will work as described, but they would be so much more readable using ASCII . Here are some examples:
|
: .PH# <# # # # # ASCII - HOLD #S #> TYPE SPACE ;
|
: .DATE <# # # ASCII / HOLD # # ASCII / HOLD #S #> TYPE SPACE ;
|
: :00 # SEXTAL # DECIMAL ASCII : HOLD ;
|
*ln2
|
Page 171
|
The definition that Brodie gives for .$ won't work in 83-forth. SIGN works on the value on the top of the stack. A definition that will work in 83-Forth is:
|
: .$ SWAP OVER DABS
|
<# # # ASCII . HOLD #S ROT ( to bring signed number to top)
|
ASCII $ HOLD SIGN #> TYPE SPACE ;
|
You might also noticw that the positions of the $ and SIGN have been switched. I prefer my negative dollars to have their signs in front of the $ sign. That's the only reason for this change.
|
*ln2
|
Page 174
|
The warning to experimenters is not true in Blazin' Forth. You can include punctuated, double-precision numbers inside of colon definitions, and they will work just fine. (I have never understood this restriction.) Note that other systems may not allow this.
|
*ln2
|
Page 175
|
The definition for R% on this page is simply wrong. It should be, instead:
|
: R% 10 M*/ 5 M+ 10 M/ S>D ROT DROP ;
|
Which gives $148.15 as an answer.
|
*fp0
|
*cn1;Chapter 8*cn0
|
*ln2
|
Page 194
|
See the note above (page 174). You do not need to use 2CONSTANT to include double numbers in Blazin' Forth. You may wish to do so as a matter of style, but it is not forced on you.
|
*ln2
|
*cn1;Chapter 9*cn0
|
*ln2
|
Brodies example:
|
110 ' LIMIT !
|
won't work with the '83 tick. Use
|
110 ' LIMIT >BODY !
|
instead. By the way, LIMIT is an important system constant in Blazin' Forth, and I don't recommend that you try this example on it.
|
*ln2
|
Vectored Execution:
|
*ln2
|
Page 218
|
The behaviour of ' and ['] in '83 Forth is exactly that described here. Ignore the footnote on '79s tick. You might also wish to look at the documentation for DEFER IS , which are very handy words for handling Vectored Execution.
|
*ln2
|
The Structure of a Dictionary Entry.
|
*ln2
|
Page 220
|
The structure of a dictionary entry for Blazin' Forth than described here. (Note: The '83 standard regards this as a system dependency, and does not specify any particular form of dictionary structure. Other systems may, and probably do, differ.)
|
In Blazin' Forth, the structure is:
|
LINK FIELD
|
NAME FIELD
|
CODE POINTER FIELD
|
PARAMETER FIELD
|
There is also an optional field, called the VIEW or LOCATE field. This field is used by LOCATE, and is added or not at the option of the user. With the view field included, the structure looks like this:
|
VIEW FIELD
|
NAME FIELD
|
CODE POINTER FIELD
|
PARAMETER FIELD
|
Compiling without the VIEW FIELD results in more compact (but not faster running) definitions, but note that LOCATE will not operate on any definition without a VIEW FIELD. To prevent the view field from being compiled:
|
VIEW OFF
|
To re-enable the compilation of the VIEW FIELD:
|
2 VIEW !
|
*ln2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.