home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / language / forst / vars.s < prev    next >
Encoding:
Text File  |  1993-10-23  |  6.6 KB  |  219 lines

  1. ; VARS.S: system variables and access words,
  2. ; last update 3/11/90
  3. ; Copyright <C> John Redmond 1989,1990
  4. ; Public domain for non-commercial use.
  5. ;
  6.         section text
  7.         even
  8. ;
  9. ;*******************************************************;
  10. ;                                                       ;
  11. ; System variables                                      ;
  12. ;                                                       ;
  13. ;*******************************************************;
  14. ;
  15. base:   dc.l    10      ;decimal
  16. state:  dc.l    0
  17. mcro:   dc.l    0       ;no macro expansion
  18. longest: dc.l   8       ;max macro length 8 words
  19. hp:     dc.l    0       ;offset^ header space
  20. cp:     dc.l    0       ;offset^ code space
  21. entry:  dc.l    0       ;actual address where find will start looking
  22. fence   dc.l    0
  23. span:   dc.l    0
  24. toin:   dc.l    0       ;input buffer offset
  25. htib:   dc.l    0
  26. tib:    dc.l    0       ;input buffer pointer
  27. macptr: dc.l    0       ;macro pointer
  28. hmac:   dc.l    0       ;length of macro
  29. macin:  dc.l    0       ;macro buffer offset
  30. csp:    dc.l    0
  31. src:    dc.l    0       ;default to keyboard input
  32. dest:   dc.l    1       ;default to console output
  33. delim:    dc.l    $5d    ;[ is default delimier for replace
  34. auto:   dc.l    0       ;no auto start
  35. dpl:    dc.l    0
  36. stack:  ds.l    1       ;base of return stack
  37. dstack: ds.l    1       ;base of data stack
  38. rstck:  dc.l    rspace  ;defined in GLOBALS
  39. heads:  dc.l    hspace  ;size of header space
  40. work:   dc.l    wspace  ;size of work space
  41. origin: dc.l    0       ;start of application code
  42. pocket  ds.l    1       ;^stored word
  43. ;
  44. ;system convenience words:
  45. ;
  46. _macros: lea    mcro,a0
  47.         move.l  #-1,(a0)
  48.         rts
  49. _calls: lea     mcro,a0
  50.         clr.l   (a0)
  51.         rts
  52. _mode:  lea     mcro,a0
  53.         push    (a0)
  54.         rts
  55. _system: lea    stack,a0
  56.         move.l  (a0),a7
  57.         bra     finish
  58. _tib:   lea     tib,a0
  59.         push    (a0)
  60.         rts
  61. ;
  62. stateat: lea    state,a0        ;internal use only
  63.         tst.l   (a0)
  64.         rts
  65. ;
  66. ;direct address access words (not just offsets):
  67. ;
  68. _here:  move.l  cp(pc),a0
  69.         adda.l  a5,a0
  70.         push    a0
  71.         rts
  72. ;
  73. _there: move.l  hp(pc),a0
  74.         adda.l  a5,a0           ;make an address
  75.         push    a0
  76.         rts
  77. ;
  78. _top:   lea     entry,a0
  79.         push    (a0)            ;returns ^end of latest header
  80.         rts
  81. ;
  82. ;String to initialize screen behaviour:
  83. ;
  84. iostring: dc.b  6,27,'E',27,'e',27,'v'  ;clear screen, line wrap
  85. ;
  86. ;Sign-on message string:
  87. ;
  88. signon: dc.b    signend-signon-1
  89.         dc.b    'ForST, a 32-bit optimising Forth,',13,10
  90.         dc.b    '(version 1.37, 24 November 1990).',13,10
  91.         dc.b    'Copyright <C> John Redmond, Sydney, Australia.',13,10
  92.         dc.b    'Public domain for non-commercial use.',13,10
  93. signend:
  94. ;
  95.         even
  96. ;
  97. ;leave and loop stacks:
  98. ;
  99.         ds.l    16              ;leave stack space
  100. lstkptr: ds.l   1               ;leave stack pointer
  101.         ds.l    16              ;loop stack space
  102. lpstkptr: ds.l  1               ;loop stack pointer
  103. ;
  104. ;instack and    file structures
  105. ;
  106. bufflgs: dc.b   nobuffs                 ;are f1 (etc) in use?
  107.         even
  108. inbott: ds.l    4*nobuffs               ;bottom of in stack space
  109. instkptr: ds.l  1                       ;in stack pointer
  110. f1:     ds.b    bsize*(nobuffs+4)       ;8 buffers for system use
  111. ;
  112. ;internal variables:
  113. ;
  114. oldlen: ds.l    1               ;length of old keyboard input
  115. headmark: ds.l  1               ;nfa of last colon definition
  116. todepth: ds.l   1               ;link marker
  117. tothere: ds.l   1               ;start of temporary heads
  118. store:  dc.w    0               ;stack frame or register store or fetch
  119. locsused: dc.w  0               ;flag for ; and exit
  120. ;
  121. hbase:  ds.l    1               ;4 words for header movement
  122. hnow:   ds.l    1
  123. hlen:   ds.l    1
  124. chop:   ds.l    1
  125. ;
  126. ;
  127.         section data
  128.         even
  129. ;
  130.         dc.b    $84,'MODE',$a0
  131.         ptrs    _mode,18                ;-1: macros, 0: calls
  132. ;
  133.         dc.b    $84,'HERE',$A0          ;address of free code space
  134.         ptrs    _here,18
  135. ;
  136.         dc.b    $85,'THER','E'!$80      ;address of free head space
  137.         ptrs    _there,18
  138. ;
  139.         dc.b    $83,'TO','P'!$80        ;return the value in ENTRY
  140.         ptrs    _top,16
  141. ;
  142.         dc.b    $c2,'HP',$a0            ;offset to free head space
  143.         vptrs   hp,16
  144. ;
  145.         dc.b    $c5,'ENTR','Y'!$80      ;address to pass to FIND
  146.         vptrs   entry,18
  147. ;
  148.         dc.b    $c5,'DELI','M'!$80      ;delimiter for replace
  149.         vptrs   delim,18
  150. ;
  151.         dc.b    $c2,'CP',$a0            ;offset to free code space
  152.         vptrs   cp,16
  153. ;
  154.         dc.b    $c5,'FENC','E'!$80      ;code address barrier
  155.         vptrs   fence,18
  156. ;
  157.         dc.b    $c4,'BASE',$a0          ;for integer i/o
  158.         vptrs   base,18
  159. ;
  160.         dc.b    $c5,'STAT','E'!$80      ;operation state
  161.         vptrs   state,18
  162. ;
  163.         dc.b    $c4,'AUTO',$a0          ;offset to autoexec code
  164.         vptrs   auto,18
  165. ;
  166.         dc.b    $c4,'#TIB',$a0          ;# chars from query
  167.         vptrs   htib,18
  168. ;
  169.         dc.b    $c6,'#MACRO',$a0        ;# chars in macro
  170.         vptrs   hmac,20
  171. ;
  172.         dc.b    $c6,'>MACRO',$a0        ;macro pointer
  173.         vptrs   macptr,20
  174. ;
  175.         dc.b    $c4,'SPAN',$a0          ;# chars from expect
  176.         vptrs   span,18
  177. ;
  178.         dc.b    $c3,'>I','N'!$80        ;input character pointer
  179.         vptrs   toin,16
  180. ;
  181.         dc.b    $83,'TI','B'!$80        ;keyboard buffer
  182.         ptrs    _tib,16
  183. ;
  184.         dc.b    $c3,'DP','L'!$80        ;for integer input
  185.         vptrs   dpl,16
  186. ;
  187.         dc.b    $c3,'CS','P'!$80        ;not used internally
  188.         vptrs   csp,16
  189. ;
  190.         dc.b    $c3,'SR','C'!$80        ;in file
  191.         vptrs   src,16
  192. ;
  193.         dc.b    $c4,'DEST',$a0          ;out file
  194.         vptrs   dest,18
  195. ;
  196.         dc.b    $c6,'RETURN',$a0        ;base of return stack
  197.         vptrs   stack,20
  198. ;
  199.         dc.b    $c4,'DATA',$a0          ;base of data stack
  200.         vptrs   dstack,18
  201. ;
  202.         dc.b    $c5,'STAC','K'!$80      ;size of return stack
  203.         vptrs   rstck,18
  204. ;
  205.         dc.b    $c4,'WORK',$a0          ;space for new code
  206.         vptrs   work,18
  207. ;
  208.         dc.b    $c5,'HEAD','S'!$80      ;space for heads
  209.         vptrs   heads,18
  210. ;
  211.         dc.b    $c7,'LONGES','T'!$80    ;word size of longest macro
  212.         vptrs   longest,20
  213. ;
  214.         dc.b    $c6,'ORIGIN',$a0        ;start of application code
  215.         vptrs   origin,20
  216. ;
  217.         dc.b    $c6,'POCKET',$a0        ;^last input word
  218.         vptrs   pocket,20
  219.