home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / sboot.seq < prev    next >
Text File  |  1988-12-01  |  4KB  |  95 lines

  1. \ SBOOT.SEQ             Sample User BOOT                by Tom Zimmer
  2.  
  3. comment:
  4.  
  5.  This file contains an example of how to make F-PC perform your own
  6. function in place of starting F-PC and just running Forth.
  7.  
  8.   Before describing how to modify F-PC, I will present a description of
  9. the things F-PC does at BOOT time so you can have a better understanding
  10. of the startup process.
  11.  
  12.   At BOOT time F-PC proceeds through the following sequence:
  13.  
  14.         ----------------------------------------------------
  15.  
  16.       : COLD
  17.  
  18. {defered}       SETSEG
  19.                         Setup Segments
  20.                         Verify DOS > 2
  21.                         Adjust memory allocation
  22.                         Seg cursor position
  23.                 VMODE.SET
  24.                         test Video mode
  25.                         Adjust display attributes
  26. {defered}                       >COLOR
  27.                                 or
  28. {defered}                       >MONO
  29.                         Set the Video segment
  30. {defered chain} INITSTUFF
  31.                         Various initializations, performed in a chain
  32.                         through this DEFERed word. Things like:
  33.                                 MACROS
  34.                                 EDITOR
  35.                                 SAVE SCREEN
  36.                                 READ BUFFER SIZE
  37.                                 FILE SYSTEM
  38.                                 DIRECTORY BUFFER etc.
  39. {defered}       BOOT
  40.                         HELLO
  41.                                 Initialize TIB
  42.                                 Initialize VOCABULARY to FORTH
  43. {defered chain}             *** DEFAULT ***
  44.                                         HDEFAULT
  45.                                                 Move command line to TIB
  46.                                                 OPEN a file if available
  47. {defered}                               .HELLO
  48.                                                 Display signon message
  49. {defered}                               .CURFILE
  50.                                                 Display current file
  51. {defered}                               INTERPRET
  52.                                                 Process command line
  53.                 QUIT ;
  54.  
  55.         ----------------------------------------------------
  56.  
  57.   As you can see from the above sequence, there are several places you can
  58. modify what F-PC does at BOOT time. A substantial portion of the above
  59. process MUST be done, and so we want to be careful to tie in at the right
  60. point.  In general eveything before BOOT must be done for F-PC to operate
  61. properly. If we tie in at BOOT though we will have to do some additional
  62. initialization to specifically much of the stuff done by HELLO.  If we tie
  63. in at DEFAULT, we usually still want the DOS command line to be moved to
  64. TIB, and probably still want a file to be OPENed, so my normal choice
  65. would be to use DEFERS to link into DEFAULT without eliminating the
  66. function that is already there.  This will then turn DEFAULT into a
  67. DEFERed chain.  If we want to in addition have our own signon message, we
  68. can replace the functions in .HELLO and/or .CURFILE although a user
  69. application need not return from the chained DEFAULT, and as such .HELLO
  70. will never get performed.  Here then without further delay is MYDEFAULT.
  71.  
  72. comment;
  73.  
  74. : mydefault     ( --- )
  75.                 defers default          \ link into default as additional
  76.                                         \ stuff to be done.
  77.  
  78. \ Your program stuff goes here. *****************************
  79.  
  80.                 cr ." This is my program "
  81.                 cr ." Press a key to terminate "
  82.                 key drop                \ wait for a key before leaving
  83.                 cr
  84.  
  85. \ This ends your program, so leave. *************************
  86.  
  87.                 bye ;                   \ got it so leave
  88.  
  89. ' mydefault is default
  90.  
  91. \ Now save the system back to disk with the name MYBOOT.EXE.
  92.  
  93. FSAVE MYBOOT.EXE
  94.  
  95.