6 First module, control is passed to on startup. Contains
\r
7 initialization routines. Also it is the last core module.
\r
8 All new modules on top of it comes as result of executing
\r
9 external source files.
\r
11 head <name> ( -- ) compiles new dictionary entry without specifying
\r
15 : <name> ( -- ) creates new code module
\r
16 ; ( -- ) ends module (immideate)
\r
17 ex: : hello ." hi there" ;
\r
19 const <name> ( n -- ) defines new constant.
\r
20 ex: 2147483647 const max
\r
22 :i <name> ( -- ) same as ":" but this module will be executed
\r
23 immideately even in compile mode.
\r
26 create <name> ( -- ) same as "head" , but specify module type as data.
\r
27 ex: create LotoResults 5 , 13 , 52 , 12 , 11 , 3 ,
\r
29 allot ( n -- ) allocate n bytes in dictionary.
\r
30 ex: create MyArray 100 allot
\r
32 " <string>" ( -- ) compile string and its size into core.
\r
33 ex: create Mystring " This is it's contects"
\r
35 str <name> <string>" ( -- ) just shorter way for defining strings.
\r
36 ex: str Mystring This is it's contenc"
\r
38 var <name> ( -- ) define new 32 bit variable.
\r
41 ' <module> ( -- n ) return memory address of given entry.
\r
44 forget <name> ( -- ) erases from RAM given entry and all entries what was
\r
48 [ ( -- ) set interpret mode (immideate)
\r
49 ] ( n -- ) set compile mode and compile top stack element
\r
50 in as literal. Together [ .... ] cobination provides good
\r
51 way to compute some values only once, at compile time,
\r
52 rather than every time while program is running.
\r
53 ex: : calculate - [ 4 MyConst1 + MyConst2 * ] ;
\r
55 defer <name> ( -- ) creates new module, with jump instruction.
\r
56 Later address where to jump can be modified by "is" command.
\r
57 This provides method of foward referencing. So you can use
\r
58 modules what not jet exist.
\r
59 is ( address1 address2 -- ) address1 - where to jump, address2 -
\r
60 address of module created by defer command.
\r
62 : run dispver ." running ..." ;
\r
64 : (dispver ." Version 9.99 " ;
\r
65 ' (dispver ' dispver is
\r
67 Now if I type "run" on the screen appears:
\r
68 Version 9.99 running ...
\r
70 asc <char> ( -- ) reads char ascii code and treats it as literal.
\r
72 ex: : BreakLine 30 do asc - emit loop ;
\r
74 : BreakLine 30 do 45 emit loop ;
\r
76 dyninc ( handle -- ) execute code in dynamic memory handle.
\r
77 automatically deallocates it when done.
\r
79 include ( filenumber -- ) execute code in specified file.
\r
81 words ( -- ) display existing blocks in core.
\r
83 bye ( -- ) exit from Fifth
\r
86 Read one byte from input stream.
\r
89 Add one byte "c" to string located at "addr" and updates
\r
93 Read input stream and store it to pad until it finds c .
\r
94 It ignores all "c" bytes until it finds any non "c" byte.
\r
97 input stream: """"This is test !"aoeu idh
\r
98 result: This is test !
\r
100 Is useful for breaking text lines into words.
\r
103 So called safe "fkey". Reads data from input stream
\r
104 but converts characters with ASCII codes: 9 13 10
\r
107 str=str? ( adr1 adr2 -- result )
\r
108 Compares string at "adr1" with string at "adr2", returns
\r
109 true flag if they are equal or false if they are not.
\r
114 Searches whole dictionary for word in "pad". If found,
\r
115 returns it address, if not, returns 0.
\r
118 Execute word located in "pad". Depending on "mode".
\r
120 dta ( addr -- DataAddr )
\r
121 Calculates address of dictionary entry data area, from
\r
124 2num ( -- num result )
\r
125 Attempt to convert string located in "pad" into numeric
\r
126 value. If succeed returns number and true as result.
\r
127 If not, returns whatever and false as result.
\r
129 dadd ( addr length -- )
\r
130 Add to dictionary data located at "addr", with specified
\r
134 Act with number depending on "mode". When interpreting,
\r
135 leaves it in stack.
\r
139 Add to dictionary data located at "addr"+1 , length is taken
\r
143 return "h" contents.
\r
146 Holds input stream parser operation mode.
\r
151 Holds temprorary strings.
\r
154 Pointer to free byte in memory, always at the end of the
\r
155 dictionary. Each time when something is stored
\r
156 by "c," command, pointer is incareased.
\r
159 Pointer to last dictionary word. Each time when new word is
\r
160 compiled or erased by "forget", this pointer is updated.
\r
162 modulechk ( Dstr<filename> -- ) check if module is loaded, if not
\r
163 immideately load it.
\r
165 ne ( entrydata entrytype -- ) Compile new dictionary entry.
\r
166 It's name must be in "pad".
\r