home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / FFB.ZIP / FFHLP.ARC / KERNEL2.HLP < prev    next >
Encoding:
Text File  |  1987-12-23  |  16.1 KB  |  394 lines

  1.  
  2.  
  3. TOS      Saved during Task switching.
  4. ENTRY    Jumped to during multitasking.
  5. LINK     Points to next task in the circular queue
  6. SP0      Empty parameter stack for this task.
  7. RP0      Empty return stack for this task.
  8. DP       Size of dictionary.  Next available location.
  9. #OUT     Number of characters sent since last CR.
  10. #LINE    Number of CR's sent since last page.
  11. OFFSET   Added to all block references.
  12. BASE     The current numeric base for number input output.
  13. HLD      Points to a converted character during numeric output.
  14. FILE     Allows printing of one file while editing another.
  15. IN-FILE  Allows printing of one file while editing another.
  16. PRINTING  indicates whether printing is enabled.
  17. YDP      Size of headers.  Next available location.
  18. EMIT     Sends a character to the output device.
  19.  
  20. SCR      Holds the screen number last listed or edited.
  21. PRIOR    Points to the last vocabulary that was searched.
  22. DPL      The decimal point location for number input.
  23. WARNING  Checked by WARN for duplicate warnings.
  24. R#       The cursor position during editing.
  25. HLD      Points to a converted character during numeric output.
  26. LAST     Points to the name of the most recently CREATEd word.
  27. CSP      Used for compile time error checking.
  28. CURRENT  New words are added to the CURRENT vocabulary.
  29. #VOCS    The number of elements in the search order array.
  30. CONTEXT  The array specifying the search order.
  31.  
  32. 'TIB     Points to characters entered by user.
  33. WIDTH    Number of characters to keep in name field.
  34. VOC-LINK Points to the most recently defined vocabulary.
  35. BLK      If non-zero, the block number we are interpreting.
  36. >IN      Number of characters interpreted so far.
  37. SPAN     Number of characters input by EXPECT.
  38. #TIB     Used by WORD, when interpreting from the terminal.
  39. END?     True if input stream exhausted, else false.
  40.  
  41. BL
  42. BS
  43. BELL     Names for BLank, BackSpace, and BELL
  44. CAPS           If true, then convert names to upper case
  45. FILL
  46.    FILL the string starting at start-addr for count bytes
  47.    with the character char.  Both BLANK and ERASE are
  48.    special cases of FILL.
  49.  
  50. ERASE      Fill the string with zeros
  51. BLANK      Fill the string with blanks
  52. COUNT     Given the address on the stack, returns the address
  53.    plus one and the byte at that address.  Useful for strings.
  54. LENGTH    Given the address on the stack, returns the address
  55.    plus two and the two byte contents of the address.
  56. MOVE
  57.    Move the specified bytes without overlapping.
  58.  
  59. >UPPER
  60.    subroutine which converts character in AX to upper case.
  61. UPC
  62.    Convert a Char to upper Case
  63. UPPER
  64.    Take the string at the specified address and convert it to
  65.    upper case.  It converts the string in place, so be sure to
  66.    make a copy of the original if you need to use it later.
  67. HERE      Return the address of the top of the dictionary
  68. PAD       Floating Temporary Storage area.
  69. -TRAILING   Return the address and length of the given string
  70.    ignoring trailing blanks.
  71.  
  72. COMP   This performs a string compare.  If the two strings are
  73.    equal, then COMPARE returns 0.  If the two strings differ,
  74.    then COMPARE returns -1 or +1.  -1 is returned if string 1
  75.    is less than string 2.  +1 is returned if string 1 is
  76.    greater than string 2.  All comparisons are relative to
  77.    ASCII order.
  78. CAPS-COMP
  79.    The code on this screen handles the case where case is not
  80.    significant.  Each character is converted to upper case
  81.    before the comparison is made.  Thus, lower case a and upper
  82.    case A are considered identical.
  83. COMPARE
  84.    Performs a string compare. If CAPS is true, characters from
  85.    both strings are converted to upper case before comparing.
  86.  
  87. OSF    Operating Sys call in progress flag.
  88. FCDOS called by other assembler code to do INT 21 (DOS call).
  89.   BP and SI are the critical FORTH registers.  Create is used
  90.   here to force force lable into target dictionary. OSF is set
  91.   during the DOS call, can be tested by interrupt routines
  92.   which call non-reentrant DOS functions.
  93. XFDOS : call INT 21 with most any reg combination used.
  94. ?CS: : leave FORTH CS on stack
  95. @L : ( seg adr - n ) load word long
  96. C@L : ( seg adr - byt) char load long
  97.  
  98. C!L : ( byt seg adr -) char store long
  99. !L : ( n seg adr -- ) word store long
  100.  
  101. BDOS     Load up the registers and do a DOS system call.
  102.    return the result placed in the A register on the
  103.    stack.
  104.  
  105. (KEY?)
  106.    Returns true if the user pressed a key, otherwise false.
  107. (KEY)
  108.    Pauses until a key is ready, and returns it on the stack.
  109. (EMIT)   Sends the character to the terminal.
  110.  
  111. CMOVEL : ( sseg sptr dseg dptr cnt ) move char block long.
  112. YSTART : if non-zero, ptr to start of headers after dictionary.
  113.    Used to set DP in this case.
  114. YSEG : SEG for header segment
  115. MEMCHK : abort with memory error message if true
  116. DOSVER : get DOS version number
  117. SETYSEG : move headers after dictionary to their own segment.
  118.   Reserves 100k space (DOS 2.x required).  Copies headers to
  119.   the alloted space
  120.  
  121.  
  122. Probably should have YALLOT also for completeness.  Wasn't
  123.    needed very often.
  124.  
  125. KEY?  Usually set to (KEY?), to sense keyboard status.
  126. KEY   Usually set to (KEY) to get a character from the user.
  127. CR     Typically set to CRLF, above.
  128. PR-STAT  Return printer status, if implemented, else TRUE
  129. (PRINT)  The value of the DEFERRED word EMIT when you
  130.    want to send a character to the printer.
  131. (EMIT)  sends a character to both the console and the printer.
  132.  
  133. CRLF     Sends a carriage return line feed sequence.
  134. TYPE   Display the given string on the terminal.
  135. SPACE        Send a space to the terminal
  136. SPACES       Send a set of spaces to the terminal
  137. BACKSPACES   Send a set of Backspaces to the terminal.
  138. BEEP         Ring the bell on the terminal
  139.  
  140. BS-IN
  141.    If at beginning of line, beep, otherwise back up 1.
  142. (DEL-IN)
  143.    If at beginning of line, beep, otherwise back up and erase 1.
  144. BACK-UP
  145.    Wipe out the current line by overwriting it with spaces.
  146. RES-IN
  147.    Reset the system to a relatively clean state.
  148. P-IN
  149.    Toggle the printer on or off
  150.  
  151. CR-IN
  152.    Finish input and remember the number of chars in SPAN
  153. (CHAR)
  154.    Process an ordinary character by appending it to the buffer.
  155. CHAR  is usually (CHAR). Executed for most characters.
  156. DEL-IN is usually (DEL-IN). Executed for delete characters.
  157.  
  158. CC   Points to current control character table.
  159. CC-FORTH
  160.    Handle each control character as a special case.  This
  161.    generates an execution array which is indexed into by
  162.    EXPECT to do the right thing when it receives a control
  163.    character.
  164.  
  165. EXPECT
  166.    Get a string from the terminal and place it in the buffer
  167.    provided.  Performs a certain amount of line editing.
  168.    Saves the number of characters input in the Variable SPAN.
  169.    Processes control characters per the array pointed to by CC.
  170.  
  171. TIB     Leaves address of text input buffer.
  172. QUERY   Get more input from the user and place it at TIB.
  173.  
  174. These variables are used by the BLOCK IO part of the system.
  175. Unlike FIG Forth the buffers are managed in a true least
  176. recently used scheme.  The are maintained in memory as an array
  177. of 8 byte entries, whose format is defined at left.  Whenever
  178. a BLOCK is referenced its pointer is moved to the head of the
  179. array, so the most recently used buffer is first. Thus multiple
  180. references are very fast.  Also we have eliminated the need for
  181. a null at the end of each BLOCK buffer so that the size of a
  182. buffer is now exactly 1024 bytes.
  183. The format of entries in the buffer-pointer array is:
  184.    0-1 is Block Number         2-3 is Pointer to File
  185.    4-5 is Address of Buffer    6-7 is Update Flag
  186. BUFFER#   Return the address the the nth buffer pointer.
  187. >END      Return a pointer to just past the last buffer packet.
  188. >UPDATE   Return a pointer to the update flag.
  189.  
  190. READ-BLOCK   performs physical read.
  191. WRITE-BLOCK   performs physical write.
  192. .FILE   (S adr -- )
  193.   print filename in fcb at adr.
  194. FILE?   (S -- ) print name of current file.
  195. SWITCH   exchange in-file and file.
  196.  
  197. DOS  vocabulary for native file system interface words.
  198. !FILES  sets both file pointers to the specified file.
  199. DISK-ABORT   (S fcb a n -- )
  200.   print error message and file name.
  201. ?DISK-ERROR  (S fcb n -- )
  202.   report disk error.
  203.  
  204.  
  205. CLR-FCB      Initialize the specified FCB.
  206. SET-DMA      CP/M system call to set dma address
  207. RECORD#      Pointer to the specified Ramdom Record
  208. MAXREC#      Pointer to the largest record allowed
  209. IN-RANGE     Makes sure that the Random Record is
  210.    within Range.  Issues error message if it isn't.
  211. REC-READ     Do a Random Access read
  212. REC-WRITE    Do a Random Access write
  213.  
  214. SET-IO  common set-up for file reads and writes.
  215.  
  216. FILE-READ  read 1024 bytes from a file.
  217.  
  218. FILE-WRITE  write 1024 bytes to a file.
  219.  
  220. FILE-IO  set block read and writes to use files.
  221.  
  222.  
  223. CREATE SOURCE-BUF 1026 ALLOT      SOURCE-BUF 1026 ERASE
  224.  
  225. : GET-BLOCK     (S BLK# -- )
  226.                 [ DOS ] MYBUFFER (SET-DMA)
  227.                 IN-FCB @ >R
  228.                       R@ RECORD# !
  229.                 B/REC R@ BREC#   !
  230.                       R> 33 BDOS ;
  231.  
  232. ( .EXE file support                            12:19 04/22/86 )
  233. XCKSUM  checksums a block of memory using word addition ( cnt
  234.    must be even )
  235. SUVEC  startup vector, for a long jump to HEX 100 to set up
  236.    CS correctly.  Currently the .EXE header has CS set at
  237.    0FFF0h which fakes out the loader to set CS to the same
  238.    as the Program Sement Prefix.  This makes the long jump
  239.    unnecessary, but we put it in so we could easily make
  240.    the .EXE header more conventional.
  241. SEXE  entry point specified by .EXE header.  Sets the seg part
  242.    of SUVEC, moves FORTH headers up to seg after DS (YSEG),
  243.    does long jump thru SUVEC to start system.
  244. EHMT  empty .EXE header.  Entries 0Eh and 16h are SS and CS,
  245.    set to -10h, somewhat questionable.  If they are changed,
  246.    10h and 14h must be changed to compensate.
  247.  
  248.  
  249. CAPACITY     The number of blocks in the current file
  250. LATEST?   For increased performance we first check to see if the
  251.    block we want is the very first one in the list.   If it is
  252.    return the buffer address and false, and exit from the word
  253.    that called us, namely ABSENT?.  Otherwise we return as
  254.    though nothing had happened.
  255. ABSENT?
  256.    Search through the block/buffer list for a match.  If it is
  257.    found, bring the block packet to the top of the list and
  258.    return a false flag and the address of the buffer.  If the
  259.    block is not found, return true, indicating it is absent,
  260.    and the second parameter is garbage.
  261.  
  262. UPDATE   Mark the most recently used buffer as modified.
  263. DISCARD  Mark the most recently used buffer as unread.
  264. MISSING   Writes the least recently used buffer to disk if it
  265.    was modified, and moves all of the buffer pointers down by
  266.    one, making the first one available for the new block.  It
  267.    then assigns the newly available buffer to the new block.
  268. (BUFFER)  assigns a buffer to the specified block in the given
  269.   file. No disk read is performed. Leaves the buffer address.
  270. BUFFER  assigns a buffer to the specified block.
  271.   No disk read is performed. Leaves the buffer address.
  272. (BLOCK) Leaves the address of a buffer containing the given
  273.   block in the given file. Reads the disk if necessary.
  274. BLOCK   Leaves the address of a buffer containing the given
  275.   block. Reads the disk if necessary.
  276. IN-BLOCK  like BLOCK, but for the IN-FILE.
  277. EMPTY-BUFFERS
  278.    First wipe out the data in the buffers.  Next initialize the
  279.    buffer pointers to point to the right addresses in memory
  280.    and set all of the update flags to unmodified.
  281. SAVE-BUFFERS
  282.    Write back all of the updated buffers to disk, and mark them
  283.    as unmodified.  Use this whenever you are worried about
  284.    crashing or losing data.
  285. FLUSH     Save and empties the buffers. Used for changing disks.
  286.   The phrase " 0 BLOCK DROP " is a kludge for CP/M. Some
  287.   systems do extra buffering in the BIOS, and you must access
  288.   a new block to be sure the old one is actually written to disk
  289. VIEW#  returns address of the view# field for this file.
  290.  
  291.  
  292. FILE-SIZE    Return the size of the file in records.
  293. DOS-ERR?     Returns true if a DOS error occurred.
  294. OPEN-FILE
  295.    Open the current file and tell user if you can't.
  296.    Determine the size of the file and save it for error check.
  297. DOS-FCB      The address where the DOS puts a parsed FCB
  298. DEFAULT   Opens the default file per the execute line.  Move the
  299.    already parsed file control block into FCB1, and open the
  300.    file.  This does nothing if no file was given.
  301. (LOAD)
  302.    Load the screen number that is on the stack.  The input
  303.    stream is diverted from the terminal to the disk.
  304. LOAD    Interpret a screen as if it were type in .
  305.  
  306. DIGIT
  307.   Returns a flag indicating whether or not the character is a
  308.   valid digit in the given base.  If so, returns converted
  309.   value and true,  otherwise returns char and false.
  310. DOUBLE?   Returns non-zero if period was encountered.
  311. CONVERT
  312.    Starting with the unsigned double number ud1 and the string
  313.    at adr1, convert the string to a number in the current base.
  314.    Leave result and address of unconvertable digit on stack.
  315.  
  316. (NUMBER?)
  317.    Given a string containing at least one digit, convert it
  318.    to a number.
  319. NUMBER?
  320.    Convert the count delimited string at addr to a double
  321.    number.  NUMBER? takes into account a leading minus sign,
  322.    and stores a pointer to the last delimiter in DPL.
  323.    The string must end with a blank.
  324.    Leaves a true flag if successful.
  325. (NUMBER)
  326.    Convert the count delimited string at addr to a double
  327.    number.  (NUMBER) takes into account a leading minus sign,
  328.    and stores a pointer to the last period in DPL.  Note the
  329.    string must end with a blank or an error message is issued.
  330. NUMBER   Convert a string to a number.  Normally (NUMBER)
  331. HOLD     Save the char for numeric output later.
  332. <#       Start numeric conversion.
  333. #>       Terminate numeric conversion.
  334. SIGN     If n1 is negative insert a minus sign into the string.
  335. #        Convert a single digit in the current base.
  336.  
  337. #S       Convert a number until it is finished.
  338.  
  339. HEX        All subsequent numeric IO will be in Hexadecimal.
  340. DECIMAL    All subsequent numeric IO will be in Decimal.
  341. OCTAL      All subsequent numeric IO will be in Octal.
  342.  
  343. (U.)   Convert an unsigned 16 bit number to a string.
  344. U.     Output as an unsigned single number with trailing space.
  345. U.R    Output as an unsigned single number right justified.
  346.  
  347. (.)    Convert a signed 16 bit number to a string.
  348. .      Output as a signed single number with a trailing space.
  349. .R     Output as a signed single number right justified.
  350.  
  351. (UD.)  Convert an unsigned double number to a string.
  352. UD.    Output as an unsigned double number with a trailing space
  353. UD.R   Output as an unsigned double number right justified.
  354.  
  355. (D.)   Convert a signed double number to a string.
  356. D.     Output as a signed double number with a trailing space.
  357. D.R    Output as a signed double number right justified.
  358. DONE
  359.    A common exit routine for SKIP and SCAN.
  360. SKIP
  361.    Given the address and length of a string, and a character to
  362.    look for, run through the string while we continue to find
  363.    the character.  Leave the address of the mismatch and the
  364.    length of the remaining string.
  365.  
  366. SCAN
  367.    Given the address and length of a string, and a character to
  368.    look for, run through the string until we find
  369.    the character.  Leave the address of the match and the
  370.    length of the remaining string.
  371.  
  372. /STRING     Index into the string by n.  Returns addr+n and
  373.    len-n.
  374. PLACE       Move the characters at from to to with a preceding
  375.    length byte of len.
  376. (SOURCE)    Returns the string to be scanned.  This is the
  377.    default value of the deferred word SOURCE.
  378. SOURCE      Return a string from the current input stream.
  379. PARSE-WORD
  380.    Scan the input stream until char is encountered.  Skip over
  381.    leading chars.  Update >IN pointer.
  382.    Leaves the address and length of the enclosed string.
  383. PARSE
  384.    Scan the input stream until char is encountered.
  385.    Update >IN pointer.
  386.    Leaves the address and length of the enclosed string.
  387.  
  388. 'WORD   Leaves the same address as WORD.
  389.    In this system, 'WORD is the same as HERE.
  390. WORD
  391.    Parse the input stream for char and return a count delimited
  392.    string at here.  Note there is always a blank following it.
  393.  
  394.