home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / dosio.seq < prev    next >
Text File  |  1988-07-18  |  2KB  |  62 lines

  1. \ DOSIO.SEQ     DOS keyboard drivers                    by Tom Zimmer
  2.  
  3. comment:
  4.  
  5.   This file allows the use of file re-direction into forth, so a file
  6. can contain a bunch of lines of Forth commands.  Forth will automatically
  7. terminate when it sees the Control-Z at the end of the file.
  8.  
  9.   The normal form is as follows:
  10.  
  11.         PROGRAM_NAME <Input_file >Output_file  return
  12.  
  13.   Another form allows direct Forth commands on the command line:
  14.  
  15.         PROGRAM_NAME forth_words >Output_file  return
  16.  
  17.   Where the output is directed to the Output_file.
  18.  
  19.   You cannot however pass forth_words into PROGRAM_NAME, and at the
  20. same time pass in Input_file.  Input_file will then be ignored.
  21.  
  22.   Load this file, and save the resulting system using FSAVE.
  23.  
  24. comment;
  25.  
  26. : bdoskey       ( --- C1 )
  27.                 0 7 bdos dup control Z =
  28.                 if      bye             \ If Control-Z, then leave.
  29.                 then    ;
  30.  
  31. ' false         is key?                 \ Re-defer terminal input to DOS.
  32. ' bdoskey       is key
  33.  
  34. : interpx       ( --- )                 \ new INTERPRET to ignore LF
  35.                 tib c@ control J =
  36.                 if      bl tib c!       \ mask LF to blank
  37.                 then    defers interpret ;
  38.  
  39. : dosdefault    ( --- )                 \ allows auto leave after execution
  40.                 dos>tib
  41.                 >in @ bl word swap >in ! c@
  42.                 if      interpret
  43.                         bye
  44.                 then    ;
  45.  
  46. : dosbye        ( --- )                 \ eliminates the "Goodaye" message
  47.                 restore_vectors
  48.                 0 0 bdos ;
  49.  
  50. ' interpx       is interpret            \ Filters out line feeds
  51. ' noop          is .hello               \ Quiet .HELLO
  52. ' noop          is .curfile             \ Quiet .CURFILE
  53. ' noop          is dark                 \ Disable screen clear
  54. ' dosdefault    is default              \ Enable auto leave after interpret
  55. ' dosbye        is byefunc              \ Quiet BYE
  56.  
  57. slow                                    \ Select terminal output to DOS.
  58. statoff                                 \ Turn OFF status display
  59.  
  60. cr .( You can now save this DOS re-directable system with FSAVE. ) cr
  61.  
  62.