home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / library.doc < prev    next >
Text File  |  1990-04-06  |  41KB  |  677 lines

  1. \ LIBRARY.DOC    The Function Library Wordset for Target Compiler
  2.  
  3. Arrays, Constants & Variables available in TCOM
  4.  
  5. ARRAY CMDPATH      ( -- a1 )    holds the command spec location used by $SYS
  6. ARRAY DTBUF        ( -- a1 )    holds date time conversion $    See TTIMER
  7. ARRAY OUTBUF       ( -- a1 )    holds the LINEREAD line         See TSREAD
  8.  
  9. CONST B/HCB        ( -- n1 )            bytes per handle = 72
  10. CONST BL           ( -- c1 )
  11. CONST BLACK        ( -- n1 )    black                           See TCOLOR
  12. CONST BLUE         ( -- n1 )    blue                            See TCOLOR
  13. CONST BROWN        ( -- n1 )    brown                           See TCOLOR
  14. CONST CYAN         ( -- n1 )    cyan                            See TCOLOR
  15. CONST DKGRAY       ( -- n1 )    dark gray        blink in Bg    See TCOLOR
  16. CONST DOS_CMD_TAIL ( -- cs:a1 ) DOS command line pointer in ?CS: space
  17. CONST GREEN        ( -- n1 )    green                           See TCOLOR
  18. CONST LTBLUE       ( -- n1 )    light blue       blink in Bg    See TCOLOR
  19. CONST LTCYAN       ( -- n1 )    light cyan       blink in Bg    See TCOLOR
  20. CONST LTGRAY       ( -- n1 )    light gray                      See TCOLOR
  21. CONST LTGREEN      ( -- n1 )    light green      blink in Bg    See TCOLOR
  22. CONST LTMAGENTA    ( -- n1 )    light magenta    blink in Bg    See TCOLOR
  23. CONST LTRED        ( -- n1 )    light red        blink in Bg    See TCOLOR
  24. CONST MAGENTA      ( -- n1 )    magenta                         See TCOLOR
  25. CONST RED          ( -- n1 )    red                             See TCOLOR
  26. CONST WHITE        ( -- n1 )    white            blink in Bg    See TCOLOR
  27. CONST YELLOW       ( -- n1 )    yellow           blink in Bg    See TCOLOR
  28.  
  29. HNDLE COMSPEC$          command spec $, filled by COMSPEC@      See TENVIRON
  30. HNDLE ME$               my program name, filled by ME@          See TENVIRON
  31. HNDLE BLKHNDL           handle used for BLOCK I/O               See TBLOCK
  32. HNDLE LREADHNDL         lineread handle                         See TSREAD
  33.  
  34. VALUE #COLORS      ( -- n1 )    Number of screen colors         See TGRAPH
  35. VALUE B/BUF        ( -- n1 )    size of block buffer            See TBLOCK
  36. VALUE COLS         ( -- n1 )    Screen columns, default 80      See TVIDEO
  37. VALUE GCH.MAX      ( -- n1 )    Maximum read characters         See TSTDIO
  38. VALUE HDOTS        ( -- n1 )    width of graphic screen in dots See THERC
  39. VALUE LRHNDL       ( -- a1 )    return addr of cur file handle  See TSREAD
  40. VALUE MCOLUMN      ( -- n1 )    screen menu left column         See TMENU
  41. VALUE MLINE        ( -- n1 )    screen menu top line            See TMENU
  42. VALUE PCH.MAX      ( -- n1 )    Maximum write characters        See TSTDIO
  43. VALUE ROWS         ( -- n1 )    Screen rows, default 25         See TVIDEO
  44. VALUE SVMAX        ( -- n1 )    save screen max save depth      See TSAVESCR
  45. VALUE SVSIZE       ( -- n1 )    size of screen to save in bytes See TSAVESCR
  46. VALUE VDOTS        ( -- n1 )    height of graphic screen in dots
  47.  
  48. VAR   'TIB         ( -- a1 )
  49. VAR   #EXSTRT      ( -- a1 )
  50. VAR   #LINE        ( -- a1 )
  51. VAR   #OUT         ( -- a1 )
  52. VAR   #TIB         ( -- a1 )
  53. VAR   >IN          ( -- a1 )
  54. VAR   ATTRIB       ( -- a1 )                                    See TVIDEO
  55. VAR   BASE         ( -- a1 )
  56. VAR   BLK          ( -- a1 )    current block number
  57. VAR   CAPS         ( -- a1 )
  58. VAR   COLOR        ( -- a1 )    Color of the next plotted point with LINE
  59. VAR   DP           ( -- a1 )
  60. VAR   DPL          ( -- a1 )
  61. VAR   ESC_FLG      ( -- a1 )
  62. VAR   FUDGE        ( -- A1 )
  63. VAR   HLD          ( -- a1 )
  64. VAR   LINE_LIMIT   ( -- a1 )    holds read limit if no LF found in LINEREAD
  65. VAR   LMARGIN      ( -- a1 )    left margin, default 0          See LIBRARY
  66. VAR   LOADLINE     ( -- a1 )    most recently read line         See TSREAD
  67. VAR   RMARGIN      ( -- a1 )    right margin default 64         See LIBRARY
  68. VAR   RP0          ( -- a1 )
  69. VAR   RWERR        ( -- a1 )    most recent error code
  70. VAR   SAVECUR      ( -- a1 )
  71. VAR   SP0          ( -- a1 )
  72. VAR   SPAN         ( -- a1 )
  73. VAR   SSEG         ( -- a1 )                                    See TSEARCH
  74. VAR   STIME        ( -- a1 )    binary start time double variable   TTIMER
  75. VAR   TABSIZE      ( -- a1 )    tab size defaults to 8          See LIBRARY
  76. VAR   TTIME        ( -- a1 )    DOS time format double variable See TTIMER
  77. VAR   VIDEO-SEG    ( -- a1 )    holds current physical scrn SEG See TVIDEO
  78.  
  79. Functions available in TCOM
  80.  
  81. MACRO !            ( n addr -- )
  82.       !>           ( n1 | <name> -- )   Store n1 into VALUE <name>.
  83. CODE  !L           ( n1 seg addr -- )
  84. :     "            ( | string" -- a1 n1 )
  85. :     ">$          ( a1 n1 -- a2 )
  86. :     "envfind     ( a1 n1 -- n2 f1 )   find string a1,n1 in environment
  87. :     #            ( d1 -- d2 )
  88. :     #>           ( d# -- addr len )
  89. :     #EXPECT      ( a1 n1 n2 -- )      get n1 chars to a1. begin at n2.
  90. :     #S           ( d -- 0 0 )
  91. :     $>HANDLE     ( a1 a2 -- )         move counted string to handle
  92. :     $>TIB        ( a1 -- )            move string to TIB      See LIBRARY
  93. :     $SYS         ( cmd_line -- f1 )   pass command line to DOS shell
  94. CODE  %DOSEXPECT   ( addr +n -- n2 )    low level DOS expect
  95. :     %KEY         ( -- c1 )            get a key, filter func keys to > 127
  96. :     %SPACES      ( n1 -- )            DOS display n1 spaces
  97. :     %TYPE        ( a1 n1 -- )         DOS display string
  98. :     %VSPACES     ( n1 -- )            video display n1 spaces See TVIDEO
  99. :     %VTYPE       ( addr len -- )      video display string    See TVIDEO
  100. MACRO (+LOOP)      ( n -- )             primitive
  101. :     (.)          ( n -- a l )
  102. :     (D.)         ( d -- a l )
  103. :     (FNUMBER?)   ( a1 -- f1 ; F: -- r ) convert string to floating #
  104. MACRO (LIT)        ( n1 -- )            macro to compile an inline literals
  105. MACRO (LOOP)       ( -- )
  106. :     (NUMBER?)    ( adr -- d flag )
  107. :     (U.)         ( u -- a l )
  108. :     (UD.)        ( ud -- a l )
  109. MACRO *            ( n1 n2 -- n3 )
  110. :     */           ( n1 n2 n3 -- n1*n2/n3 )
  111. CODE  */MOD        ( n1 n2 n3 -- rem quot )
  112. CODE  *D           ( n1 n2 -- d# )
  113. MACRO +            ( n1 n2 -- sum )
  114. MACRO +!           ( n addr -- )        increment the variable by n
  115.       +!>          ( n | <name> -- )    increment the value following by n
  116. :     +LOOP        ( -- )
  117. CODE  +PLACE       ( a1 n1 a2 -- )      append string a1,n1 to counted a2
  118. MACRO -            ( n1 n2 -- n1-n2 )
  119. CODE  -ROT         ( n1 n2 n3 -- n3 n1 n2 )
  120. CODE  -SCAN        ( a1 n1 c2 -- a2 n2 ) scan char backwards  uses SSEG
  121. CODE  -SKIP        ( a1 n1 c1 -- a2 n2 ) skip char backwards  uses SSEG
  122. :     .            ( n -- )
  123. :     ."           ( | string" -- )
  124. :     .COMSPEC     ( -- )               show command spec       See TENVIRON
  125. :     .DATE        ( -- )               display the date        See TTIMER
  126. :     .ELAPSED     ( -- )               display elapsed time    See TTIMSTUF
  127. :     .ENV         ( -- )               show environment string See TENVIRON
  128. :     .ENVCHR      ( i -- )                                     See TENVIRON
  129. :     .LRHNDL      ( -- )               display the cur file    See TSREAD
  130. :     .ME          ( -- )               show my programs name   See TENVIRON
  131. :     .PATH        ( -- )               show the path string    See TENVIRON
  132. :     .R           ( n l -- )
  133. :     .TIME        ( -- )               display the time        See TTIMER
  134. CODE  /            ( num den -- quot )
  135. CODE  /MOD         ( num den -- rem quot )
  136. CODE  /STRING      ( a1 n1 n2 -- a2 n3 ) split n2 chars from string a1,n1
  137. MACRO 0<           ( n -- f )
  138. :     0<=          ( n1 n2 -- f )
  139. MACRO 0<>          ( n -- f )
  140. MACRO 0=           ( n -- f )
  141. CODE  0>           ( n -- f )
  142. :     0>=          ( n1 n2 -- f )
  143. :     0FL          ( -- )               set first file          See TWFL
  144. MACRO 0MAX         ( n1 -- n2 )         clip a1 to zero or above
  145. :     10TH-ELAPSED ( -- n1 )            elapsed time in 10ths   See TTIMSTUF
  146. MACRO 1+           ( n1 -- n2 )
  147. MACRO 1-           ( n1 -- n2 )
  148. CODE  2!           ( d addr -- )
  149. MACRO 2*           ( n -- 2*n )
  150. MACRO 2+           ( n1 -- n2 )
  151. MACRO 2-           ( n1 -- n2 )
  152. MACRO 2/           ( n -- n/2 )
  153. MACRO 2>R          ( n1 n2 -- )
  154. CODE  2@           ( a1 -- d1 )         return the double word at a1
  155. MACRO 2DROP        ( d -- )
  156. CODE  2DUP         ( d -- d d )
  157. CODE  2OVER        ( d1 d2 -- d1 d2 d1 )
  158. MACRO 2R>          ( -- n1 n2 )
  159. MACRO 2R@          ( -- n1 n2 )
  160. :     2ROT         ( a b c d e f - c d e f a b )
  161. CODE  2SWAP        ( d1 d2 -- d2 d1 )
  162.       2VARIABLE    ( | <name> -- )      defind <name> as a double variable
  163.       2CONSTANT    ( d1 | <name> -- )   define <name> as a double constant
  164. MACRO 3DROP        ( n1 n2 n3 -- )
  165. CODE  3DUP         ( n1 n2 n3 -- n1 n2 n3 n1 n2 n3 )
  166. :     320x200x16   ( -- )               EGA,VGA graphics mode   See TGRAPH
  167. :     320x200x256  ( -- )               VGA graphics mode
  168. :     320x200x4    ( -- )               CGA graphics mode       See TGRAPH
  169. :     320x200x4M   ( -- )               CGA COMPOSITE graphics mode
  170. :     4DUP         ( a b c d -- a b c d a b c d )
  171. :     640x200x2    ( -- )               CGA graphics mode       See TGRAPH
  172. :     640x200x16   ( -- )               EGA,VGA graphics mode
  173. :     640x350x2    ( -- )               EGA,VGA MONO graphics mode
  174. :     640x350x16   ( -- )               EGA,VGA graphics mode
  175. :     640x480x2    ( -- )               EGA,VGA graphics mode
  176. :     640x480x16   ( -- )               VGA graphics mode
  177. CODE  8*           ( n -- 8*n )
  178.       :            ( | <name> -- )      define a new target definition
  179.       ::           ( | <name> -- )      define compile time user defining word
  180. CODE  <            ( n1 n2 -- f )
  181. :     <#           ( -- )
  182. :     <=           ( n1 n2 -- f )
  183. MACRO <>           ( n1 n2 -- f )
  184. CODE  <HRENAME>    ( handle1 handle2 -- ax cf=0 | ecode 1 )     See THANLDES
  185. MACRO =            ( n1 n2 -- f )
  186.       =:           ( n1 | <name> -- )   Assign n1 into VALUE <name>.
  187. CODE  >            ( n1 n2 -- f )
  188. :     >=           ( n1 n2 -- f )
  189. :     >ATTRIB      ( handle -- attrib-addr )           move to attrib addr
  190. :     >BG          ( n1 -- )            set background color    See TCOLOR
  191. :     >BOLD        ( -- )               BRIGHT                  See TVIDEO
  192. :     >BOLDBLNK    ( -- )               BOLD BLINK              See TVIDEO
  193. :     >BOLDUL      ( -- )               BOLD UNDERLINE          See TVIDEO
  194. :     >BOX         ( -- )               select full around BOX  See TBOX
  195. :     >FG          ( n1 -- )            set forground color     See TCOLOR
  196. :     >HNDLE       ( handle -- handle-addr )           move to DOS hndl #
  197. :     >MENU        ( -- )               select menu type BOX    See TBOX
  198. :     >NAM         ( handle -- name-string-addr )      move to frst name chr
  199. :     >NORM        ( -- )               NORMAL                  See TVIDEO
  200. MACRO >R           ( n -- )
  201. :     >REV         ( -- )               REVERSE                 See TVIDEO
  202. :     >REVBLNK     ( -- )               REVERSE BLINK           See TVIDEO
  203. :     >UL          ( -- )               UNDERLINE               See TVIDEO
  204. :     ?CR          ( -- )               need CR?                See LIBRARY
  205. MACRO ?CS:         ( -- cs )            where the code is located.
  206. :     ?DNEGATE     ( d1 n -- d2 )
  207. MACRO ?DO          ( l i -- )           ?DO .. LOOP or ?DO .. +LOOP
  208. MACRO ?DS:         ( -- ds )            where all the data is located
  209. MACRO ?DUP         ( n1 -- [n1] n1 )    duplicate if not zero
  210. MACRO ?EXIT        ( f1 -- )            exit definition if f1 is true
  211. :     ?KEYPAUSE    ( -- )               Pause if key pressed
  212. MACRO ?LEAVE       ( f -- )             leave loop if f1 true
  213. :     ?LINE        ( n1 -- )            conditional CR check    See LIBRARY
  214. :     ?NEGATE      ( n1 n2 -- n3 )
  215. :     ?PRINTER.READY ( -- f1 )          is LPT1 ready for a character
  216. :     ?SYSERROR    ( n1 -- )            leave prog if n1 = 2 or 8 See TEXEC
  217. :     ?UPPERCASE   ( a1 -- a1 )         conditionally convert $ to uppercase
  218. CODE  ?VMODE       ( -- n1 )            get the video mode from DOS
  219. MACRO @            ( a1 -- n1 )         return the word contents of a1
  220. CODE  @L           ( seg a1 -- n1 )     get word from external memory
  221. :     ABORT        ( -- )               Terminate the program, return to DOS.
  222.       ABORT"       ( f1 | string" -- )  if f1 true, display string and ABORT.
  223. MACRO ABS          ( n1 -- n2 )         return the absolute value of n1
  224. MACRO AGAIN        ( -- )               BEGIN .. AGAIN
  225. CODE  ALLOC        ( n1 -- n2 n3 f1 )   allocate DOS memory
  226. :     ALLOT        ( n1 -- )            allot target data space.
  227. MACRO AND          ( n1 n2 -- n3 )      logical and of n1,n2
  228. :     ARC          ( x y radius start-ang end-ang -- )          see TSHAPES
  229.       ARRAY        ( n1 | <name> -- )   define <name> as an array of size n1
  230. :     AT           ( X Y -- )           set current cursor position
  231. :     AT?          ( -- X Y )           return current cursor position
  232. :     B>SEC        ( d1 -- n1 )         convert bin time to seconds TTIMER
  233. :     B>T          ( d1 -- )            save bin time to TTIME var  TTIMER
  234. :     BCR          ( -- )               BOX carraige return     See TBOX
  235. CODE  BDOS         ( DX AH -- AL )      DOS call interface
  236. CODE  BDOS2        ( CX DX AL -- CX DX AX )
  237. :     BDOSKEY      ( -- c1 )            get key using DOS call redirectable
  238. :     BDOSKEY?     ( -- c1 )            get key DOS no wait redirectable
  239. :     BEEP         ( -- )               beep the speaker
  240. MACRO BEGIN        ( -- )               BEGIN .. UNTIL
  241. CODE  BETWEEN      ( n lo hi -- flag )  perform range check
  242. :     BIG-CURSOR   ( -- )               set block cursor
  243. :     BLANK        ( a1 n1 -- )         fill an array a1 with n1 blanks
  244. :     BLOCK        ( n1 -- a1 )         get block n1 from current file as a1
  245. CODE  BOUNDS       ( n1 n2 -- n3 n4 )   Calculate limits used in DO-loop
  246. :     BOX          ( x y x' y' -- )     draw a BOX on the screen  See TBOX
  247. :     BOX&FILL     ( x y x' y' -- )     draw BOX & fill it with spaces
  248. :     BUFFER       ( n1 -- a1 )         allocate buffer to block n1 return a1
  249. :     BUFIO_INIT   ( -- )               Initialize buffered I/O See TSTDIO
  250. :     BYE          ( -- )               leave program
  251. MACRO C!           ( char addr -- )
  252. CODE  C!L          ( byte seg addr -- )
  253. MACRO C+!          ( n addr -- )
  254. MACRO C@           ( addr -- char )
  255. CODE  C@L          ( seg addr -- byte )
  256. CODE  CAPS-COMP    ( addr1 addr2 len -- -1 | 0 | 1 )
  257.       CASE         ( -- )               start CASE OF ENDOF ENDCASE stmnt.
  258. :     CIRCLE       ( x y radius -- )    draw a circle           See TSHAPES
  259. :     CLR-HCB      ( handle - )         clear out the handle
  260. ALIAS CLS          ( -- )               An ALIAS for DARK, clears the screen.
  261. CODE  CMOVE        (  from to count -- )
  262. CODE  CMOVE>       ( from to count -- )
  263. CODE  CMOVEL       ( sseg sptr dseg dptr cnt -- )
  264. CODE  CMOVEL>      ( sseg sptr dseg dptr cnt -- )
  265.       CODE         ( | <name> -- )      start an assembly definition <name>
  266. CODE  COMP         ( addr1 addr2 len -- -1 | 0 | 1 )
  267. :     COMPARE      ( addr1 addr2 len -- -1 | 0 | 1 )
  268. :     COMSPEC@     ( -- )               extract the command specification
  269. :     COMSPEC_INIT ( -- )               initalize CMDBUF for $SYS
  270. :     COM_EXTRACT  ( a1 -- )            extract the command specification
  271.       CONSTANT     ( n1 | <name> -- )   define <name> as a constant number
  272. :     CONVERT      ( +d1 adr1 -- +d2 adr2 )
  273. CODE  COUNT        ( a1 -- a2 n1 )      return addr and length of counted $
  274. :     CR           ( -- )               perform a carraige return
  275.       CREATE       ( | <name> -- ) make <name> like a variable, but no bytes
  276. MACRO CRESET       ( b addr -- )
  277.       CSEG         ( a1 | <name> -- )   create a new CODE segment in memory
  278. MACRO CSET         ( b addr -- )
  279. MACRO CTOGGLE      ( b addr -- )
  280. :     CURSOR-OFF   ( -- )               turn off the cursor display
  281. :     CURSOR-ON    ( -- )               turn on the cursor display
  282. CODE  CURPOINTER   ( hndle -- d1 )      get file pos in cur file See TSREAD
  283. CODE  D+           ( d1 d2 -- dsum )    double number add
  284. CODE  D+!          ( d addr -- )        double number plus store
  285. :     D-           ( d1 d2 -- d3 )      double number subtract
  286. :     D.           ( d -- )             display double number
  287. :     D.R          ( d l -- )           display double number right in field
  288. :     D.M.Y        ( -- )               select D.M.Y date format See TTIMER
  289. :     D0=          ( d -- f )           double number zero equals
  290. MACRO D2*          ( d -- d*2 )         double number shift left
  291. MACRO D2/          ( d -- d/2 )         double number shift right
  292. :     D<           ( d1 d2 -- f )       double number less than
  293. :     D=           ( d1 d2 -- f )       double number equal
  294. :     D>           ( d1 d2 -- f )       double number greater than
  295. CODE  DABS         ( d1 -- d2 )         absolute value of top double number
  296. :     DARK         ( -- )               clear screen
  297. CODE  DEALLOC      ( n1 -- f1 )         release DOS allocated memory
  298. :     DECIMAL      ( -- )               select the decimal number base
  299. MACRO DECR         ( addr -- )          decrement contants of addr
  300.       DECR>        ( | <name> -- )      decrement value following
  301.       DEF-RWMODE   ( -- )               sets HOPEN R/W mode.    See THANDLES
  302.       DEFER        ( | <name> -- )      define <name> as a defered word
  303. MACRO DEPTH        ( -- n1 )            return data stack depth
  304. CODE  DIGIT        ( char base -- n f )
  305. :     DIRINIT      ( -- )               init GETFILE's memory   See TWFL
  306. :     DMAX         ( d1 d2 -- d3 )      maximum of top two double numbers
  307. :     DMIN         ( d1 d2 -- d3 )      minimum of top two double numbers
  308. MACRO DNEGATE      ( d# -- d#' )`       change sign of top double number
  309. MACRO DO           ( l i -- )           DO .. LOOP or DO .. n1 +LOOP
  310. MACRO DO?          ( -- )
  311. :     DOSVER       ( -- n1 )            return the DOS version
  312. :     DOSIO_INIT   ( -- )               initialize EMIT, TYPE & SPACES to DOS
  313. :     DOS_EXPECT   ( a1 n1 -- )         DOS expect
  314. :     DOS_TO_TIB   ( -- )               Move the DOS commandline to TIB
  315. :     DOUBLE?      ( -- f )             last num convert result in double?
  316. MACRO DROP         ( n1 -- )            discard the top of stack
  317. MACRO DS:!         ( ds -- )            set DS to the value on the stack
  318. MACRO DS:->SS:     ( -- )               set SS to DS
  319. :     DS:ALLOC     ( n1 -- a1 )         alloc some DS: ram return addr
  320. :     DS:FREE?     ( -- a1 )            return amount of free DS: ram
  321.       DSEG         ( a1 | <name> -- )   create a new DATA segment in memory
  322. :     DU<          ( ud1 ud2 -- f )     return f1 true is ud1 lessthan ud2
  323. :     DUMP         ( addr len -- )      simple display memory
  324. MACRO DUP          ( n1 -- n1 n1 )      duplicate the top of stack
  325. MACRO DUP>R        ( n1 -- n1 )         put copy on return stack
  326. :     EEOL         ( -- )               Erase to end of line
  327. MACRO ELSE         ( -- )               IF .. ELSE .. THEN
  328. DEFER EMIT         ( c1 -- )            emit a char to console
  329. :     EMPTY-BUFFERS ( -- )              initialize block system See TBLOCK
  330.       END-CODE     ( -- )               terminate an assembly word
  331.       END-CSEG     ( -- )               finish all CODE compiling in target
  332.       END-DSEG     ( -- )               finish all DATA compiling in target
  333.       END-MACRO    ( -- )               terminate a MACRO definition
  334.       END-TABLE    ( a1 -- )            terminate building a TABLE
  335.       ENDCASE      ( -- )               resolve ENDOF's in CASE statment
  336. CODE  ENDFILE      ( handle -- double-end ) move to file end    See THANDLES
  337.       ENDMENU      ( n1 -- )            finish menu definition  See TMENU
  338.       ENDOF        ( -- )               finish OF statment in CASE
  339. :     ENVSIZE      ( -- n1 )            calculate environ size  See TENVIRON
  340. :     ERASE        ( addr len -- )      fill array with zero
  341. :     EVSEG        ( -- n1 )            return the segment of environment $.
  342. CODE  EXEC:        ( n1 -- )            execute the n-th CALL following
  343. CODE  EXECF        ( string PARMS -- ecode )
  344. MACRO EXECUTE      ( cfa -- )           execute routine cfa
  345. :     EXHREAD      ( a1 n1 handle seg -- len-read )     read external
  346. :     EXHWRITE     ( a1 n1 handle seg -- len-written )  write external
  347. MACRO EXIT         ( -- )               leave the current definition
  348. :     EXPECT       ( a1 n1 -- )         expect chars n1 into addr a1
  349. MACRO FALSE        ( -- false )         put a false (0) on stack
  350. CODE  FILL         ( a1 n1 c1 -- )      fill array with c1
  351. :     FINDFIRST    ( string -- f1 )     return first matching dir to string
  352. :     FINDNEXT     ( -- f1 )            return next matching dir to string
  353. MACRO FLIP         ( n1 -- n2 )         flip hi/lo bytes of n1
  354. :     FLUSH        ( -- )               save and empty memory blocks
  355. :     FLUSH_B      ( -- )               Flush the I/O channel   See TSTDIO
  356. MACRO FOR          ( n1 -- )            FOR .. NEXT
  357. :     GET-CURSOR   ( -- shape )         get the current cursor shape
  358. CODE  GETCH        ( -- c1 )            get char from STDIN     See TSTDIO
  359. :     GETCHAR_B    ( -- c1 )            Read one buffered char  See TSTDIO
  360. :     GETDATE      ( -- y md )          get the current date
  361. :     GETFILE      ( -- a1 f1 )         pick file from popup select window
  362. :     GETTIME      ( -- hm sh )         get the current time
  363. :     GRAPH-INIT   ( -- f1 )            init graphics, color=true & herc=0
  364. :     H.           ( n1 -- )            display n1 in HEX
  365. :     H.R          ( n1 n2 -- )         display n1 right justified in HEX
  366.       HANDLE       ( | <name> -- )      make <name> an array of B/HCB size
  367. :     HCLOSE       ( handle -- return-code ) close file         See THANDLES
  368. :     HCREATE      ( handle -- error-code )  create file        See THANDLES
  369. :     HDARK        ( -- )               clear screen to black hercules graph
  370. :     HDELETE      ( handle -- return-code ) delete file        See THANDLES
  371. :     HERCULES     ( -- )               set hercules graphics   See THERC
  372. CODE  HDOS1        ( cx dx fun -- ax cf | errcode 1 )           See THANDLES
  373. CODE  HDOS3        ( bx cx dx ds fun -- ax cf | ecode 1 )       See THANDLES
  374. CODE  HDOS4        ( bx cx dx fun -- ax cf | ecode 1 )          See THANDLES
  375. :     HERE         ( -- a1 )            return addr of free ram space
  376. :     HEX          ( -- )               set the HEX number base
  377. :     HLIGHT       ( -- )               clear screen to white hercules graph
  378. :     HOLD         ( char -- )
  379. :     HOPEN        ( handle -- error-code )  open file          See THANDLES
  380. :     HOURS        ( n1 -- )            delay for n1 hours      See TTIMSTUF
  381. :     HPAGED       ( n1 -- )            graphics DISPLAY page   See THERC
  382. :     HPAGEW       ( n1 -- )            page to write graphics  See THERC
  383. :     HREAD        ( a1 n1 handle -- length-read )     read file
  384. :     HRENAME      ( handle1 handle2 -- return-code )  rename file
  385. :     HTEXT        ( -- )               switch back to text mode hercules
  386. :     HWRITE       ( a1 n1 handle -- length-written )  write to file
  387. MACRO I            ( -- n )             return loop index
  388. :     ICOS         ( deg -- cos*10k)    integer COS times 10000 of degrees
  389. CODE  ISIN         ( deg -- sin*10k)    integer SIN times 10000 of degrees
  390. MACRO IF           ( f -- )             branch if flag is zero
  391. MACRO INCR         ( addr -- )          increment contents of addr
  392.       INCR>        ( | <name> -- )      increment value following
  393. :     INIT-CURSOR  ( -- )               init the cursor shape control words
  394. MACRO J            ( -- n )             return second loop index
  395. MACRO K            ( -- n )             return third loop index
  396. DEFER KEY          ( -- c1 )            get key, defered through KEY-F
  397. CODE  KEY?         ( -- f1 )            test, key waiting. BIOS, no redirect
  398. MACRO LEAVE        ( -- )               leave loop immediately
  399. MACRO LEAVE?       ( -- )               primitive
  400. CODE  LENGTH       ( a1 -- a2 n1 )      get length of word counted string
  401. CODE  LFILL        (  seg a1 n1 c1 -- ) fill external memory with c1
  402. :     LINE         ( x y x' y' -- )     draw line in COLOR between points
  403. :     LINEEDITOR   ( x y a1 n1 -- f1 )  edit line in a1 at xy, max len n1
  404. :     LINEFROM     ( x y -- )           prepares origin for LINETO segments
  405. :     LINETO       ( x y -- )           draw line from cur in COLOR to xy
  406. :     LINEREAD     ( -- a1 )            read a line from cur file See TSREAD
  407. :     LINEREAD_INIT ( -- )              initialize LINEREAD     See TSREAD
  408.       LONG_BRANCH  Switches the compiler to using +/- 32767 byte branches.
  409. :     LOOP         ( -- )               DO .. LOOP
  410. :     M/D/Y        ( -- )               select M/D/Y date format See TTIMER
  411. :     M/MOD        ( d# n1 -- rem quot )
  412.       MACRO        ( | <name> -- )      make <name> a code type word in-line
  413. MACRO MAX          ( n1 n2 -- n3 )      return maximum of n1, n2
  414. :     ME@          ( -- )               extract my own execution name string
  415. :     ME_EXTRACT   ( a1 -- )            extract my program name DOS3 & up
  416.       MENULINE"    ( | strint" func --) add a line to a menu    See TMENU
  417. :     MENU         ( -- )               See TMENU, show&process menu select
  418. :     MENUBOX      ( x y x' y' -- )     draw a menu type box    See TBOX
  419. MACRO MIN          ( n1 n2 -- n3 )      return minimum of n1, n2
  420. :     MINUTES      ( n1 -- )            delay for n1 minutes    See TTIMSTUF
  421. :     MOD          ( n1 n2 -- rem )     return n1 MOD n2
  422. CODE  MOVEPOINTER  ( double-offset handle -- )         set file pointer
  423. :     MS           ( n1 -- )            delay for n1 Milli-Seconds. ABOUT?
  424. :     MU/MOD       ( ud# un1 -- rem d#quot )
  425. MACRO NEGATE       ( n1 -- n2 )         change sign of n1
  426.       NEWMENU      ( n1 | <name> -- a1) create a new menu       See TMENU
  427.       NEWMENUBAR   ( n1 | <name> -- a1) create a new menu bar   See TMENU
  428. MACRO NEXT         ( -- )               NEXT as in FOR ... NEXT
  429. MACRO NIP          ( n1 n2 -- n2 )      discard second item on stack
  430.       NOOP         ( -- )               a subroutine to do nothing
  431. :     NORM-CURSOR  ( -- )               set a normal cursor shape (underline)
  432. MACRO NOT          ( n -- n' )
  433. :     NUMBER?      ( adr -- d flag )    convert string to number
  434. :     OCTAL        ( -- )               set the OCTAL number base
  435.       OF           ( n1 n2 -- n1 | )    start OF portion of CASE statment
  436. MACRO OFF          ( addr -- )          set contents of addr to zero
  437.       OFF>         ( | <name> -- )      set value following to zero
  438. MACRO ON           ( addr -- )          set contents of addr to -1
  439.       ON>          ( | <name> -- )      set the value following to -1
  440. MACRO OR           ( n1 n2 -- n3 )
  441. MACRO OVER         ( n1 n2 -- n1 n2 n1 )
  442. MACRO P!           ( n port# -- )       I/O port WORD store
  443. MACRO P@           ( port# -- n )       I/O port WORD fetch
  444. :     PAD          ( -- a1 )
  445. :     PATH@        ( -- )               extract the path string
  446. :     PATH_EXTRACT ( a1 -- )            extract the path string
  447. :     PATHSET      ( handle -- f1 )     prepend cur path to file in handle
  448. MACRO PC!          ( n port# -- )       I/O port character store
  449. MACRO PC@          ( port# -- n )       I/O port character fetch
  450. CODE  PDOS         ( addr drive# -- f1 ) get directory for drive#
  451. CODE  PEMIT        ( c1 -- )            emit a character to LPT1
  452. MACRO PERFORM      ( addr-of-cfa -- )   execute function pointed to by
  453. MACRO PICK         ( nm ... n2 n1 k -- nm ... n2 n1 nk )
  454. CODE  PLACE        ( a1 n1 a2 -- )      fill buffer a2 with string a1,n1
  455. :     PLOT         ( x y -- )           plot point at x y, graphics in color
  456. MACRO PLUCK        ( n1 n2 n3 -- n1 n2 n3 n1 )
  457. :     POINT        ( x y -- color )     get color of point x y in graphics
  458. CODE  PR-STATUS    ( n1 -- b1 )         get the status byte for printer n1
  459. :     PREPEND.PATH ( handle -- f1 )     prepend cur path to file in handle
  460. CODE  PUTCHAR      ( c1 -- )            write a char to STDOUT  See TSTDIO
  461. :     PUTCHAR_B    ( c1 -- )            Write one buffered char See TSTDIO
  462.       QUERY        ( -- )               accept a line of text into TIB
  463. MACRO R>           ( -- n1 )            move n1 from return to data stack
  464. MACRO R>DROP       ( -- )               discard one item from return stack
  465. MACRO R@           ( -- n )             copy n1 from return to data stack
  466. CODE  RAW_STDIN    ( -- )               make DOS STDIN "raw", unbuffered
  467.       READ-ONLY    ( -- )               makes HOPEN read only   See THANDLES
  468.       READ-WRITE   ( -- )               makes HOPEN read/write  See THANDLES
  469. :     RECOVERSCR   ( -- )               copy saved screen back  See TSAVESCR
  470. :     RECOVERLINE  ( n1 -- )            copy saved screen line back TSAVESCR
  471. MACRO REPEAT       ( -- )               BEGIN .. WHILE .. REPEAT
  472.       RESTORE>     ( | <name> -- )      restore contents of <name> from RSTK
  473. :     RESTSCR      ( -- )               restore saved screen    See TSAVESCR
  474. :     ROLL         ( n1 n2 .. nk k -- n2 n3 .. nk n1 )
  475. CODE  ROT          ( n1 n2 n3 -- n2 n3 n1 )
  476. MACRO RP!          ( n -- )             set return stack pointer
  477. MACRO RP@          ( -- addr )          get return stack pointer
  478. MACRO RPICK        ( nm ... n2 n1 k -- nm ... n2 n1 nk )
  479. CODE  S>D          ( n -- d )
  480. :     SAVE-BUFFERS ( -- )               save any changed blocks to disk
  481.       SAVE>        ( | <name> -- )      save contents of <name> on RSTK
  482.       SAVE!>       ( n1 | <name> -- )   save contents to RSTK, and set to n1
  483. :     SAVESCR      ( -- )               save screen to restoral See TSAVESCR
  484. CODE  SCAN         ( addr len char -- addr' len' ) scan char forwards
  485. CODE  SEARCH       ( sadr slen dadr dcnt -- offset found? )     See TSEARCH
  486. :     SEC-ELAPSED  ( -- n1 )            return elapsed seconds  See TTIMSTUF
  487.       SECONDS      ( n1 -- )            delay for n1 seconds    See TTIMSTUF
  488. CODE  SET-CURSOR   ( n1 -- )            set the cursor shape
  489. :     SET-DTA      ( a1 -- )            set data transfer adr
  490. :     SET_MEMORY   ( n1 -- )            adj DOS memory usage down to n1.
  491. CODE  SETBLOCK     ( seg siz -- f1 )    adjust an allocated DOS block
  492. :     SETDATE      ( MD Y -- )          set DOS date            See TTIMER
  493. :     SETTIME      ( HM Sh -- )         set DOS time            See TTIMER
  494.       SHORT_BRANCH Switches the compiler back to using +/- 127 byte branches.
  495. :     SIGN         ( n1 -- )
  496. CODE  SKIP         ( a1 n1 c1 -- a2 n2 ) skip chars c1 forward
  497. MACRO SP!          ( n -- )             set stack pointer
  498. MACRO SP@          ( -- n )             return stack pointer
  499. :     SPACE        ( -- )               display a space using DOS
  500. DEFER SPACES       ( n1 -- )            display n1 spaces
  501. CODE  SPLIT        ( n1 -- n2 n3 )      split hi/lo of n1 into n2 n3
  502. :     STDIN_INIT   ( -- )               set "raw" and redirectable KEY
  503. MACRO SWAP         ( n1 n2 -- n2 n1 )   swap the two top stack items
  504. :     T>B          ( -- )               convert time to binary See TTIMER
  505. :     TAB          ( -- )               move to next TAB stop
  506.       TABLE        ( | <name> -- )      DEFINING word to build tables
  507. :     TENTHS       ( n1 -- )            delay for n1 tenths     See TTIMSTUF
  508. DEFER TEXT-MODE    ( -- )               restore text mode after graphics
  509. MACRO THEN         ( -- )               resolve branch
  510. :     TIME-ELAPSED ( -- d1 )            return elapsed time     See TTIMSTUF
  511. :     TIME-RESET   ( -- )               reset elapsed time      See TTIMSTUF
  512. CODE  TIB          ( -- a1 )            TIB is after top of stack
  513. MACRO TRUE         ( -- true )          put a true on data stack
  514. CODE  TUCK         ( n1 n2 -- n2 n1 n2 )copy top under second stack item
  515. DEFER TYPE         ( a1 n1 -- )         display the string a1,n1
  516. :     U*D          ( n1 n2 -- d1 )      unsigned multiply, n1 * n2 = d1
  517. :     U.           ( u -- )             unsigned number print
  518. :     U.R          ( u l -- )           unsigned right justified # print
  519. CODE  U16/         ( u -- u/16 )        right shift by four bits
  520. MACRO U2/          ( u -- u/2 )         right shift by one bit
  521. CODE  U8/          ( u -- u/8 )         right shift by three bits
  522. MACRO U<           ( n1 n2 -- f )
  523. :     U<=          ( u1 u2 -- f )
  524. MACRO U>           ( n1 n2 -- f )
  525. :     U>=          ( u1 u2 -- f )
  526. :     UD.          ( ud -- )            unsigned double number print
  527. :     UD.R         ( ud l -- )          unsigned double right justified # prt
  528. CODE  UM*          ( n1 n2 -- d )
  529. CODE  UM/MOD       ( ud un -- URemainder UQuotient )
  530. MACRO UMAX         ( n1 n2 -- n3 )      return unsigned maximum of n1, n2
  531. MACRO UMIN         ( n1 n2 -- n3 )      return unsigned minimum of n1, n2
  532. MACRO UNDO         ( -- )               DO .. UNDO EXIT .. LOOP
  533. MACRO UNTIL        ( f1 -- )            BEGIN .. UNTIL
  534. :     UPC          ( c1 -- c2 )         convert a character to uppercase
  535. :     UPDATE       ( -- )               mark current block as changed
  536. :     UPPER        ( addr len -- )      convert string to uppercase
  537.       VALUE        ( n1 | <name> -- )   define <name> as a changable constant
  538.       VARIABLE     ( | <name> -- )      define <name> as a variable
  539. CODE  VIDEO        ( DX CX BX AX -- DX AX ) perform a video BIOS function
  540. CODE  VIDEO-TYPE   ( string length x y -- ) direct display type See TVIDEO
  541. :     VMODE!       ( n1 -- )            set video mode
  542. :     VMODE.SET    ( -- )               sets direct video type  See TVIDEO
  543. :     VMODE@       ( -- n1 )            get video mode
  544. MACRO WHILE        ( f1 -- )            BEGIN .. WHILE .. REPEAT
  545. :     WINKEY       ( c1 -- c1 )         window key processing   See TWFL
  546. :     WINMSG       ( -- )               extra window message    See TWFL
  547. CODE  WITHIN       ( n lo hi -- flag )  within bounds range check
  548. :     WORD         ( c1 -- a1 )         return a1 a word from TIB
  549.       WRITE-ONLY   ( -- )               makes HOPEN write only. See THANDLES
  550. MACRO XOR          ( n1 n2 -- n3 )      logical XOR of n1 n2
  551. :     Y-M-D        ( -- )               set date format to Y-M-D See TTIMER
  552. CODE  [']          ( -- a1 )            get address of routine following
  553.  
  554. Floating point wordset
  555.  
  556. F#BYTES   Size of a floating point number in bytes.
  557. FPSSIZE   The size of the floating point stack, in bytes.
  558. FPSTACK   The floating point stack.
  559. FSP0      The base of the floating point stack.
  560. FSP       Contains the pointer to the F.P. Stack top.
  561. FDEPTH    The depth of the floating point stack, in FPSSIZE
  562.           units.
  563. FCLEAR    Empties the floating point stack.
  564. FDROP     Drop one floating point element from the F.P. stack.
  565. FNSWAP    Exchange the n-th item on the F.P. stack with the
  566.           zeroth item.
  567. FPICK     Push a copy of the nth element of the F.P. stack
  568.           onto the F.P. stack.
  569. FDUP      Duplicate the top element on the F.P. stack.
  570. FOVER     Push a copy of the second element on the F.P. stack
  571.           onto the F.P. stack.
  572. FSWAP     Interchange the top two elements on the F.P. stack.
  573. FNEGATE   Reverse the sign of the element at the top of the
  574.           F.P. stack.
  575. FNIP      Drop the second item from the F.P. stack.
  576. FROT      Rotate the top three items on the F.P. stack,
  577.           bring the third element to the top.
  578. F-ROT     Rotate the top three items on the F.P. stack,
  579.           bringing the second item to the top, and moving the
  580.           former top item to the third position.
  581. FPOP      Pop the top number from the F.P. stack, and push it
  582.           onto the parameter stack as a double number.
  583. FPUSH     Pop the top double number and
  584. FPCOPY    Get a copy of the top number on th F.P. stack and push
  585.           it on the parameter stack.
  586. F0=       Pop the top member of the F.P. stack and test its value.
  587.           If the value is zero, push true, else push false onto
  588.           the parameter stack.
  589. F0<       Pop and test the number at the top of the F.P. stack.
  590.           If the sign is negative and the value is non-zero, push
  591.           a true flag.  Otherwise push a false flag.
  592. FPOP0=    Pop the top member of the F.P. stack, test, and push it
  593.           onto the parameter stack.  If the number has a value of
  594.           zero, also push a true flag; otherwise push a false
  595.           flag.
  596. F=        Pop the top two elements from the F.P. stack.  If the
  597.           two numbers are equal, push a true flag.  Otherwise,
  598.           push a false flag.
  599. F<        Pop the top two F.P. numbers from the F.P. stack and
  600.           compare them.  If the second number is arithmetically
  601.           less than the first number, push a true flag.
  602.           Otherwise push a false flag.
  603. F>        Pop the top two numbers from the F.P. stack and
  604.           compare them.  If the second number is arithmetically
  605.           greater than the top, push a true flag onto the
  606.           parameter stack.  Otherwise push a false flag.
  607. FABS      Set the sign of the top of the F.P. stack to 0.
  608. FMIN      Pop the top two members from the F.P. stack.  Push the
  609.           arithmetically smaller back onto the F.P. stack.
  610. FMAX      Pop the top two members from the F.P. stack.  Push the
  611.           arithmetically larger back onto the F.P. stack.
  612. F@        Fetch the F.P. variable at the address specified by the
  613.           top of the parameter stack.  Push the contents of the
  614.           variable onto the F.P. stack.  Pop and discard the
  615.           address at the top of the parameter stack.
  616. F!        Store the number at the top of the F.P. stack into
  617.           memory at the address at the top of the parameter stack.
  618.           Pop the number from the F.P. stack, and pop the address
  619.           from the parameter stack.
  620. FCONSTANT Create a F.P. constant with a value equal to the
  621.           number poped off the F.P. stack.
  622. FVARIABLE Create a F.P. variable.
  623. F1.0      Floating point 1.
  624. PI        Floating point pi
  625. F0.0      Floating point 0.
  626. FLOG10E   Floating point log base 10 of e
  627. FLN10.0   Floating point natural log of 10
  628. F10.0     Floating point 10.
  629. F0.5      Floating point 0.5
  630. FLOAT     Convert the double number on the parameter stack to a
  631.           floating point number on the floating point stack.
  632. DINTABS   Pop the top number from the floating point stack.
  633.           Take the absolute value and convert it to a double
  634.           number on the parameter stack.  If the resulting
  635.           number is positive, push a 0 onto the stack.
  636.           Otherwise, push a true flag (-1) onto the stack.
  637. INT       Pop a floating point number from the f.p. stack and
  638.           convert it to a double number.
  639. FINT      Convert the number at the top of the f.p. stack to its
  640.           integer part represented as a floating point number.
  641. F+        Floating point addition.
  642. F-        Floating point subtraction.
  643. FIX       Pop a number from the floating point stack, convert it
  644.           to a double number and push the result on the parameter
  645.           stack.  Issue an error message if the number cannot be
  646.           properly converted.
  647. F/        The floating point division routine.
  648. F*        Floating point multiplication function.
  649. F**+N     Raise the floating point number at the top of the f.p.
  650.           stack to the positive integer power at the top of the
  651.           parameter stack.
  652. F**N      Raise the number at the top of the f.p. stack to the
  653.           power specified at the top of the parameter stack.
  654. F**N*     Raise the number at the top of the f.p. stack to the
  655.           power specified at the top of the parameter stack,
  656.           then multiply by the number second on the f.p. stack.
  657. FSQRT     Replace the number at the top of the f.p. stack with
  658.           its square root.
  659. FLN       Replace the number at the top of the f.p. stack with
  660.           its natural logarithm.
  661. FLOG      Replace the number at the top of the f.p. stack with
  662.           its common (base 10) logarithm.
  663. FPARTS    An auxillary function for  (E.) .
  664. E.        The floating point output routine. Scientific notation.
  665. E.R       floating point output right justified. Sientific notation
  666. F.        Another floating point output routine.
  667. F.R       floating point output right justified.
  668. .FS       A utility for checking the contents of the F.P. stack.
  669. $F#       This function converts a counted string into a floating point
  670.           number.
  671. F#        This is the function used to get a floating point number
  672.           from the input stream.  Usage examples follow:
  673.           F# -2.34 F# 34.5e6 F# -.1E-2 F# 2.34(5)
  674. [F#]      Floating point input in a definition. Use as above, but in a
  675.           definition.
  676.  
  677.