home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol171 / list2.lst < prev    next >
Encoding:
File List  |  1984-05-30  |  20.6 KB  |  722 lines

  1. Screen # 0
  2.  
  3.  0 ( M68K Cross compiler -- Copyright Notice )
  4.  1 ;S
  5.  2 FORTH based cross compiler for the Motorola 68000 microprocessor
  6.  3 
  7.  4 Copyright 1983 by   Raymond L. Buvel
  8.  5                     Box 3071
  9.  6                     Moscow, ID 83843
  10.  7 
  11.  8 All rights reserved except as stated below.
  12.  9 
  13. 10 This compiler may be distributed to anyone provided this
  14. 11 copyright notice is included and the distribution is not for
  15. 12 profit.  Contact me concerning royalties for commercial
  16. 13 distribution.  There is no royalty on code produced with this
  17. 14 compiler provided the compiler itself is not SOLD as an integral
  18. 15 part of a software package.
  19.  
  20. Screen # 8
  21.  
  22.  0 ( M68K Cross Compiler -- Vocabulary definition )
  23.  1 VOCABULARY M68K IMMEDIATE
  24.  2 M68K DEFINITIONS
  25.  3 HEX
  26.  4 -->
  27.  5 Note.. the compilation words listed below are contained in
  28.  6 the FORTH vocabulary and cause entries to be made in the
  29.  7 M68K vocabulary.
  30.  8 
  31.  9 :M68K   :M68MAC M68VAR  M68DVAR M68CON  M68DCON
  32. 10 M68ARY  M68DARY M68CARY
  33. 11 
  34. 12 
  35. 13 
  36. 14 
  37. 15 
  38.  
  39. Screen # 9
  40.  
  41.  0 ( M68K Cross Compiler -- Variable definitions )
  42.  1 M68K DEFINITIONS
  43.  2 ( Code pointer in M68000 -- note relative addressing ! )
  44.  3 0 VARIABLE M68PCODE
  45.  4 ( Variable pool pointer in M68000 -- relative to A5 )
  46.  5 0 VARIABLE M68PVAR
  47.  6 ( Entry point of the subroutine being defined )
  48.  7 0 VARIABLE M68ENTRY
  49.  8 ( Parameter field address [ in HOST ] of word being defined )
  50.  9 0 VARIABLE M68PFA
  51. 10 -->
  52. 11 
  53. 12 
  54. 13 
  55. 14 
  56. 15 
  57.  
  58. Screen # 10
  59.  
  60.  0 ( M68K Cross Compiler -- Variable definitions )
  61.  1 M68K DEFINITIONS
  62.  2 ( Error checking variables )
  63.  3 0 VARIABLE M68?MAC ( True if in a MACRO definition )
  64.  4 0 VARIABLE M68K?   ( True if in a SUBROUTINE definition )
  65.  5 0 VARIABLE M68?PAIRS ( Count of incomplete branching ops. )
  66.  6 -->
  67.  7 
  68.  8 
  69.  9 
  70. 10 
  71. 11 
  72. 12 
  73. 13 
  74. 14 
  75. 15 
  76.  
  77. Screen # 11
  78.  
  79.  0 ( M68K Cross Compiler -- Error checking )
  80.  1 M68K DEFINITIONS
  81.  2 : ?M68PAIRS ( Check for unbalanced control structures )
  82.  3         M68?PAIRS @ IF
  83.  4           ." Error! unbalanced control structure "
  84.  5           0 M68?PAIRS ! ABORT ENDIF ;
  85.  6 : ?M68K ( Check for errors in compiling a subroutine )
  86.  7         M68K? @ 0= IF ( Check if compiling a subroutine )
  87.  8           ." Error! not compiling a SUBROUTINE "
  88.  9           ABORT ENDIF ;
  89. 10 : ?M68MAC ( Check for errors in compiling a macro )
  90. 11         M68?MAC @ 0= IF ( Check if compiling a macro )
  91. 12           ." Error! not compiling a MACRO "
  92. 13           ABORT ENDIF ;
  93. 14 -->
  94. 15 
  95.  
  96. Screen # 12
  97.  
  98.  0 ( M68K Cross Compiler -- Compile constants )
  99.  1 M68K DEFINITIONS
  100.  2 ( n -- c )
  101.  3 : HIGH-BYTE 8 SHIFT ;  ( Leave high byte of n on stack )
  102.  4 ( n -- )
  103.  5 : $CON  DUP HIGH-BYTE C, C, ; ( Compile const high-byte first )
  104.  6 ( d -- )
  105.  7 : $DCON $CON ( Compile high word )
  106.  8         $CON ; ( Compile low word )
  107.  9 -->
  108. 10 Note.. to transport the compiler to other FORTH systems the
  109. 11 word HIGH-BYTE must be written so that it takes the number off
  110. 12 the top of the stack and leaves the high byte of that number.
  111. 13 On some FORTH systems HIGH-BYTE may have to be a CODE
  112. 14 definition.
  113. 15 
  114.  
  115. Screen # 13
  116.  
  117.  0 ( M68K Cross Compiler -- Compiling Words )
  118.  1 M68K DEFINITIONS HEX
  119.  2 ( address -- )
  120.  3 : M68MAC ( Compile MACRO code into any definition )
  121.  4         DUP @ SWAP 2+ OVER HERE SWAP CMOVE ALLOT ;
  122.  5 : M68SUB ( Compile SUBROUTINE code into subroutine definition )
  123.  6         ?M68K 61 C, 00 C,  ( BSR  addr )
  124.  7         HERE M68PFA @ 2+ -  ( Compute code length )
  125.  8         M68ENTRY @ + SWAP @ SWAP - ( Compute displacement )
  126.  9         $CON ; ( Compile displacement )
  127. 10 -->
  128. 11 Note.. the memory image of a MACRO to be compiled is:
  129. 12   addr    Number of bytes of code to compile
  130. 13   addr+2  Bytes of code to be compiled.
  131. 14 The memory image of a SUBROUTINE to be compiled is:
  132. 15   addr    Address of subroutine relative to start of code
  133.  
  134. Screen # 14
  135.  
  136.  0 ( M68K Cross Compiler -- MACRO Compiling Words  )
  137.  1 FORTH DEFINITIONS
  138.  2 ( Create header and set compiler variables )
  139.  3 : :M68MAC ( Begin a MACRO definition )
  140.  4         [COMPILE] M68K DEFINITIONS
  141.  5         M68K 1 M68?MAC ! <BUILDS HERE M68PFA !
  142.  6         0 , ( Initialize the number of bytes field )
  143.  7         DOES> M68MAC ;
  144.  8 M68K DEFINITIONS
  145.  9 : ;M68MAC ( terminate a MACRO type definition )
  146. 10         ?M68PAIRS ?M68MAC 0 M68?MAC ! ( Error check & reset )
  147. 11         HERE M68PFA @ 2+ -  ( Compute code length )
  148. 12         M68PFA @ !  ( Store in length field )
  149. 13         [COMPILE] FORTH DEFINITIONS ;
  150. 14 -->
  151. 15 
  152.  
  153. Screen # 15
  154.  
  155.  0 ( M68K Cross Compiler -- Compiling words - constants    )
  156.  1 FORTH DEFINITIONS HEX
  157.  2 : M68CON ( Define a single precision constant )
  158.  3         :M68MAC 3D C, 3C C, ( MOVE.W #const,-[A6] )
  159.  4         M68K $CON ( Compile constant )
  160.  5         ;M68MAC ;
  161.  6 FORTH DEFINITIONS
  162.  7 : M68DCON ( Define a double precision constant )
  163.  8         :M68MAC 2D C, 3C C, ( MOVE.L #const,-[A6] )
  164.  9         M68K $DCON ( Compile double constant )
  165. 10         ;M68MAC ;
  166. 11 -->
  167. 12 
  168. 13 
  169. 14 
  170. 15 
  171.  
  172. Screen # 16
  173.  
  174.  0 ( M68K Cross Compiler -- Compiling words - variables    )
  175.  1 FORTH DEFINITIONS
  176.  2 ( n -- )
  177.  3 : M68ALLOT ( Allot n-bytes in variable pool )
  178.  4         DUP 1 AND IF 1+ ENDIF ( Byte allign )
  179.  5         M68K M68PVAR +! ; ( Update pointer )
  180.  6 FORTH DEFINITIONS
  181.  7 : M68VAR ( Define a single precision variable )
  182.  8         M68K M68PVAR @ 2 M68ALLOT ( Get and update pointer )
  183.  9         M68CON ( Define the address as a constant ) ;
  184. 10 FORTH DEFINITIONS
  185. 11 : M68DVAR ( Define a double precision variable )
  186. 12         M68K M68PVAR @ 4 M68ALLOT ( Get and update pointer )
  187. 13         M68CON ( Define the address as a constant ) ;
  188. 14 -->
  189. 15 
  190.  
  191. Screen # 17
  192.  
  193.  0 ( M68K Cross Compiler -- SUBROUTINE Compiling Words  )
  194.  1 FORTH DEFINITIONS
  195.  2 ( Create header and set compiler variables )
  196.  3 : :M68K ( Begin a SUBROUTINE definition )
  197.  4         [COMPILE] M68K DEFINITIONS
  198.  5         M68K 1 M68K? ! ( Set to compiling )
  199.  6         <BUILDS HERE M68PFA ! M68PCODE @ DUP
  200.  7         M68ENTRY ! , ( Store subroutine address )
  201.  8         DOES> M68SUB ;
  202.  9 -->
  203. 10 Note.. a SUBROUTINE definition may call itself if there are
  204. 11 no side effects.  This means that all data altered by the
  205. 12 defined word should be on the stack, not stored in variables.
  206. 13 
  207. 14 
  208. 15 
  209.  
  210. Screen # 18
  211.  
  212.  0 ( M68K Cross Compiler -- Code output )
  213.  1 M68K DEFINITIONS
  214.  2 ( byte to be sent to code output file -- )
  215.  3 : M68OUT ( Link to the code output file )
  216.  4         BASE @ >R HEX . CR R> BASE ! ;
  217.  5 -->
  218.  6 Note.. the code in the above definition should be replaced
  219.  7 with the appropriate words to send the compiler output to the
  220.  8 code file of your choice.  This could be a disk file, a tape,
  221.  9 your MC68000 computer, a printer, or any other output sink you
  222. 10 may want to use.  The protocall is determined by your output
  223. 11 word.  The compiler does not assume any protocall so it is a
  224. 12 general purpose tool for generating MC68000 code.
  225. 13 
  226. 14 
  227. 15 
  228.  
  229. Screen # 19
  230.  
  231.  0 ( M68K Cross Compiler -- SUBROUTINE Compiling Words  )
  232.  1 M68K DEFINITIONS HEX
  233.  2 : ;M68K ( Terminate a SUBROUTINE definition )
  234.  3         ?M68PAIRS ?M68K 0 M68K? ! ( Error check & reset )
  235.  4         4E C, 75 C,  ( Compile an RTS instruction )
  236.  5         HERE M68PFA @ 2+ -  ( Compute code length )
  237.  6         DUP M68PCODE +! ( Update code pointer )
  238.  7         M68PFA @ 2+ ( Start of compiled code )
  239.  8         SWAP 0 DO
  240.  9                 DUP C@ M68OUT 1+ ( Output a byte of code )
  241. 10         LOOP DROP
  242. 11         M68PFA @ 2+ DP ! ( Delete code from dictionary )
  243. 12         [COMPILE] FORTH DEFINITIONS ;
  244. 13 -->
  245. 14 
  246. 15 
  247.  
  248. Screen # 20
  249.  
  250.  0 ( M68K Cross Compiler -- EXTERNAL )
  251.  1 M68K DEFINITIONS
  252.  2 : $EXTERNAL ( Define entry point as a constant in FORTH voc. )
  253.  3         [COMPILE] FORTH DEFINITIONS
  254.  4         M68ENTRY @ CONSTANT ;
  255.  5 FORTH DEFINITIONS
  256.  6 : EXTERNAL ( Compile an external reference )
  257.  7         M68K M68K? @ M68?MAC @ OR
  258.  8         IF ." Can't use EXTERNAL while compiling"
  259.  9            CR ABORT ENDIF
  260. 10         $EXTERNAL ;
  261. 11 -->
  262. 12 Note.. to send the external reference list somewhere else,
  263. 13 replace $EXTERNAL with the appropriate word.  Make sure its
  264. 14 function is equivalent to the above, i.e. it must take the
  265. 15 next word in the input stream as the identifier.
  266.  
  267. Screen # 21
  268.  
  269.  0 ( M68K Cross Compiler -- Words - literals )
  270.  1 M68K DEFINITIONS HEX
  271.  2 : LITERAL ( Define a single precision literal )
  272.  3         3D C, 3C C, ( MOVE.W #const,-[A6] )
  273.  4         $CON ; ( Compile constant )
  274.  5 : DLITERAL ( Define a double precision literal )
  275.  6         2D C, 3C C, ( MOVE.L #const,-[A6] )
  276.  7         $DCON ; ( Compile double constant )
  277.  8 : BYTES 0 DO 20 WORD HERE NUMBER DROP C, LOOP ;
  278.  9 -->
  279. 10 Note.. Used as n BYTES followed by bytes to be compiled into
  280. 11 the HOST dictionary.  This word may be used within a :M68K
  281. 12 or :M68MAC definition but NOT within a colon definition.
  282. 13 
  283. 14 
  284. 15 
  285.  
  286. Screen # 22
  287.  
  288.  0 ( M68K Cross Compiler -- Compiling words - arrays )
  289.  1 M68K DEFINITIONS HEX
  290.  2 ( adr -- )
  291.  3 : $M68ARY ( Define code for a single precision array )
  292.  4         :M68MAC 30 C, 3C C, ( MOVE.W #const,D0 )
  293.  5         $CON ( Compile address )
  294.  6         D0 C, 56 C, D1 C, 56 C,
  295.  7         ;M68MAC ;
  296.  8 ( adr -- )
  297.  9 : $M68DARY ( Define code for a double precision array )
  298. 10         :M68MAC 30 C, 3C C, ( MOVE.W #const,D0 )
  299. 11         $CON ( Compile address )
  300. 12         32 C, 16 C, E5 C, 41 C, D0 C, 41 C, 3C C, 80 C,
  301. 13         ;M68MAC ;
  302. 14 -->
  303. 15 
  304.  
  305. Screen # 23
  306.  
  307.  0 ( M68K Cross Compiler -- Compiling words - arrays )
  308.  1 FORTH DEFINITIONS
  309.  2 ( n -- )
  310.  3 : M68ARY ( Define a single precision array n cells long )
  311.  4         M68K M68PVAR @ ( Get base address )
  312.  5         $M68ARY ( Define the referencing code )
  313.  6         2* M68ALLOT ( Update variable pointer ) ;
  314.  7 FORTH DEFINITIONS
  315.  8 ( n -- )
  316.  9 : M68DARY ( Define a double precision array n cells long )
  317. 10         M68K M68PVAR @ ( Get base address )
  318. 11         $M68DARY ( Define the referencing code )
  319. 12         4 * M68ALLOT ( Update variable pointer ) ;
  320. 13 -->
  321. 14 
  322. 15 
  323.  
  324. Screen # 24
  325.  
  326.  0 ( M68K Cross Compiler -- Compiling words - arrays )
  327.  1 M68K DEFINITIONS HEX
  328.  2 ( adr -- )
  329.  3 : $M68CARY ( Define code for a byte array )
  330.  4         :M68MAC 30 C, 3C C, ( MOVE.W #const,D0 )
  331.  5         $CON ( Compile address )
  332.  6         D1 C, 56 C, ;M68MAC ;
  333.  7 FORTH DEFINITIONS
  334.  8 ( n -- )
  335.  9 : M68CARY ( Define a byte array n cells long )
  336. 10         M68K M68PVAR @ ( Get base address )
  337. 11         $M68CARY ( Define the referencing code )
  338. 12         M68ALLOT ; ( Update variable pointer )
  339. 13 ;S
  340. 14 
  341. 15 
  342.  
  343. Screen # 25
  344.  
  345.  0 ( M68K Cross Compiler -- Control error checking )
  346.  1 M68K DEFINITIONS HEX
  347.  2 ( Error checking codes )
  348.  3 1 CONSTANT $ECD-IF
  349.  4 2 CONSTANT $ECD-BEGIN
  350.  5 3 CONSTANT $ECD-DO
  351.  6 4 CONSTANT $ECD-WHILE
  352.  7 : $ERR-?PAIRS ( Abort if no control structure is started )
  353.  8         M68?PAIRS @ 0=
  354.  9         IF ." No control structure! " ABORT CR ENDIF ;
  355. 10 : $ERR-ABT ( Complete error message and abort )
  356. 11         ." expected " CR ABORT ;
  357. 12 : $ERR-IF ( Abort if no IF structure )
  358. 13         $ERR-?PAIRS $ECD-IF -
  359. 14         IF ." IF structure " $ERR-ABT ENDIF ;
  360. 15 -->
  361.  
  362. Screen # 26
  363.  
  364.  0 ( M68K Cross Compiler -- Control error checking )
  365.  1 : $ERR-BEGIN ( Abort if no BEGIN structure )
  366.  2         $ERR-?PAIRS $ECD-BEGIN -
  367.  3         IF ." BEGIN structure " $ERR-ABT ENDIF ;
  368.  4 : $ERR-DO ( Abort if no DO structure )
  369.  5         $ERR-?PAIRS $ECD-DO -
  370.  6         IF ." DO structure " $ERR-ABT ENDIF ;
  371.  7 : $ERR-WHILE ( Abort if no WHILE structure )
  372.  8         $ERR-?PAIRS $ECD-WHILE -
  373.  9         IF ." WHILE structure " $ERR-ABT ENDIF ;
  374. 10 -->
  375. 11 
  376. 12 
  377. 13 
  378. 14 
  379. 15 
  380.  
  381. Screen # 27
  382.  
  383.  0 ( M68K Cross Compiler -- Control structures )
  384.  1 ( adr -- )
  385.  2 : $FOR-RES ( Resolve a foreward branch )
  386.  3         HERE OVER - ( Compute relative address )
  387.  4         SWAP OVER HIGH-BYTE OVER C! ( Store high byte )
  388.  5         1+ C! ; ( Store low byte )
  389.  6 ( adr -- )
  390.  7 : $BAK-RES ( Resolve a back branch )
  391.  8         HERE - ( Compute relative address )
  392.  9         $CON ; ( Compile address )
  393. 10 -->
  394. 11 
  395. 12 
  396. 13 
  397. 14 
  398. 15 
  399.  
  400. Screen # 28
  401.  
  402.  0 ( M68K Cross Compiler -- Control structures )
  403.  1 ( -- adr ecd )
  404.  2 : IF    ( Compile IF structure, leave address to be resolved )
  405.  3         ( and an error checking code )
  406.  4         4A C, 5E C, 67 C, 00 C,
  407.  5         HERE $ECD-IF 1 M68?PAIRS +!
  408.  6         0 , ; ( Leave space for branch address )
  409.  7 : ELSE  ( Compile an ELSE structure )
  410.  8         $ERR-IF 60 C, 00 C,
  411.  9         HERE SWAP ( Save current location and get IF adr )
  412. 10         0 , ( Leave space for branch address )
  413. 11         $FOR-RES ( Resolve IF branch )
  414. 12         $ECD-IF ;
  415. 13 : ENDIF ( Resolve an IF structure )
  416. 14         $ERR-IF $FOR-RES -1 M68?PAIRS +! ;
  417. 15 : THEN  ENDIF ;         -->
  418.  
  419. Screen # 29
  420.  
  421.  0 ( M68K Cross Compiler -- Control structures )
  422.  1 ( -- adr ecd )
  423.  2 : BEGIN ( Compile a BEGIN structure )
  424.  3         HERE $ECD-BEGIN 1 M68?PAIRS +! ;
  425.  4 : UNTIL ( Resolve BEGIN .. UNTIL loop )
  426.  5         $ERR-BEGIN 4A C, 5E C, 67 C, 00 C,
  427.  6         $BAK-RES ( Resolve BEGIN branch )
  428.  7         -1 M68?PAIRS +! ;
  429.  8 : AGAIN ( Resolve BEGIN .. AGAIN loop )
  430.  9         $ERR-BEGIN 60 C, 00 C,
  431. 10         $BAK-RES ( Resolve BEGIN branch )
  432. 11         -1 M68?PAIRS +! ;
  433. 12 -->
  434. 13 
  435. 14 
  436. 15 
  437.  
  438. Screen # 30
  439.  
  440.  0 ( M68K Cross Compiler -- Control structures )
  441.  1 : WHILE ( Compile WHILE section of loop )
  442.  2         DUP $ERR-BEGIN 4A C, 5E C, 67 C, 00 C,
  443.  3         HERE $ECD-WHILE 0 , ; ( Leave space for address )
  444.  4 : REPEAT ( Resolve BEGIN .. WHILE .. REPEAT loop )
  445.  5         $ERR-WHILE SWAP $ERR-BEGIN
  446.  6         60 C, 00 C, ( Code for back branch )
  447.  7         SWAP $BAK-RES ( Resolve BEGIN branch )
  448.  8         $FOR-RES ( Resolve WHILE branch )
  449.  9         -1 M68?PAIRS +! ;
  450. 10 -->
  451. 11 
  452. 12 
  453. 13 
  454. 14 
  455. 15 
  456.  
  457. Screen # 31
  458.  
  459.  0 ( M68K Cross Compiler -- Control structures )
  460.  1 : DO ( Compile a DO structure )
  461.  2         2F C, 1E C,
  462.  3         HERE $ECD-DO 1 M68?PAIRS +! ;
  463.  4 : LOOP ( Terminate a DO .. LOOP )
  464.  5         $ERR-DO  52 C, 57 C, 4C C, 97 C, 00 C, 03 C,
  465.  6         B0 C, 41 C, 6D C, 00 C,
  466.  7         $BAK-RES ( Resolve DO branch )
  467.  8         58 C, 8F C,  ( Drop index and limit )
  468.  9         -1 M68?PAIRS +! ;
  469. 10 -->
  470. 11 
  471. 12 
  472. 13 
  473. 14 
  474. 15 
  475.  
  476. Screen # 32
  477.  
  478.  0 ( M68K Cross Compiler -- Control structures )
  479.  1 : +LOOP ( Terminate a DO .. +LOOP )
  480.  2         $ERR-DO  30 C, 1E C, D1 C, 57 C, 4C C, 97 C,
  481.  3         00 C, 06 C, 4A C, 40 C, 6E C, 04 C, B4 C, 41 C,
  482.  4         60 C, 02 C, B2 C, 42 C, 6D C, 00 C,
  483.  5         $BAK-RES ( Resolve DO branch )
  484.  6         58 C, 8F C,  ( Drop index and limit )
  485.  7         -1 M68?PAIRS +! ;
  486.  8 
  487.  9 :M68MAC LEAVE 4 BYTES 3F 57 00 02 ;M68MAC
  488. 10 -->
  489. 11 
  490. 12 
  491. 13 
  492. 14 
  493. 15 
  494.  
  495. Screen # 33
  496.  
  497.  0 ( M68K Cross Compiler -- Control structures )
  498.  1 :M68MAC JSR.W 4 BYTES 30 5E 4E 90 ;M68MAC
  499.  2 :M68MAC JSR.L 4 BYTES 20 5E 4E 90 ;M68MAC
  500.  3 :M68MAC JMP.W 4 BYTES 30 5E 4E D0 ;M68MAC
  501.  4 :M68MAC JMP.L 4 BYTES 20 5E 4E D0 ;M68MAC
  502.  5 ;S
  503.  6 
  504.  7 
  505.  8 
  506.  9 
  507. 10 
  508. 11 
  509. 12 
  510. 13 
  511. 14 
  512. 15 
  513.  
  514. Screen # 34
  515.  
  516.  0 ( M68K Cross Compiler -- Initialization words )
  517.  1 M68K DEFINITIONS HEX
  518.  2 ( d -- )
  519.  3 : A5LD  ( Load variable pool pointer )
  520.  4         2A C, 7C C, $DCON ;
  521.  5 : A6LD  ( Load data stack pointer )
  522.  6         2C C, 7C C, $DCON ;
  523.  7 : A7LD  ( Load return stack pointer )
  524.  8         2E C, 7C C, $DCON ;
  525.  9 -->
  526. 10 Note.. to create true modular programs there should be an
  527. 11 operating system that loads the appropriate registers and then
  528. 12 calls the module.  In that case these words should be discarded
  529. 13 since the address is determined at compile time instead of run
  530. 14 time.
  531. 15 
  532.  
  533. Screen # 35
  534.  
  535.  0 ( M68K Cross Compiler -- Arithmetic words )
  536.  1 HEX
  537.  2 :M68MAC + 4 BYTES 30 1E D1 56 ;M68MAC
  538.  3 :M68MAC - 4 BYTES 30 1E 91 56 ;M68MAC
  539.  4 :M68MAC * 6 BYTES 30 1E C1 D6 3C 80 ;M68MAC
  540.  5 :M68MAC / 8 BYTES 4C 9E 00 03 83 C0 3D 01 ;M68MAC
  541.  6 :M68MAC D+ 4 BYTES 20 1E D1 96 ;M68MAC
  542.  7 :M68MAC D- 4 BYTES 20 1E 91 96 ;M68MAC
  543.  8 :M68MAC */ A BYTES 32 1E 30 1E C1 D6 81 C1 3C 80 ;M68MAC
  544.  9 :M68MAC /MOD 8 BYTES 42 80 32 1E 30 1E 80 C1
  545. 10              4 BYTES 48 40 2D 00 ;M68MAC
  546. 11 :M68MAC MOD 8 BYTES 42 80 32 1E 30 1E 80 C1
  547. 12             4 BYTES 48 40 3D 00 ;M68MAC
  548. 13 :M68MAC */MOD 8 BYTES 32 1E 30 1E C0 DE 80 C1
  549. 14               4 BYTES 48 40 2D 00 ;M68MAC
  550. 15 -->
  551.  
  552. Screen # 36
  553.  
  554.  0 ( M68K Cross Compiler -- Arithmetic words )
  555.  1 :M68MAC U* 6 BYTES 30 1E C0 DE 2D 00 ;M68MAC
  556.  2 :M68MAC U/MOD A BYTES 32 1E 20 1E 80 C1 48 40 2D 00 ;M68MAC
  557.  3 :M68MAC 1+ 2 BYTES 52 56 ;M68MAC
  558.  4 :M68MAC 1- 2 BYTES 53 56 ;M68MAC
  559.  5 :M68MAC 2+ 2 BYTES 54 56 ;M68MAC
  560.  6 :M68MAC 2- 2 BYTES 55 56 ;M68MAC
  561.  7 :M68MAC 2* 2 BYTES E1 D6 ;M68MAC
  562.  8 :M68MAC 2/ 2 BYTES E0 D6 ;M68MAC
  563.  9 :M68MAC NEGATE 2 BYTES 44 56 ;M68MAC
  564. 10 :M68MAC MINUS NEGATE ;M68MAC
  565. 11 :M68MAC DNEGATE 2 BYTES 44 96 ;M68MAC
  566. 12 :M68MAC DMINUS DNEGATE ;M68MAC
  567. 13 :M68MAC ABS 6 BYTES 4A 56 6C 02 44 56 ;M68MAC
  568. 14 :M68MAC DABS 6 BYTES 4A 96 6C 02 44 96 ;M68MAC
  569. 15 -->
  570.  
  571. Screen # 37
  572.  
  573.  0 ( M68K Cross Compiler -- Stack manipulation )
  574.  1 :M68MAC DROP 2 BYTES 54 8E ;M68MAC
  575.  2 :M68MAC 2DROP 2 BYTES 58 8E ;M68MAC
  576.  3 :M68MAC DUP 2 BYTES 3D 16 ;M68MAC
  577.  4 :M68MAC 2DUP 2 BYTES 2D 16 ;M68MAC
  578.  5 :M68MAC SWAP 6 BYTES 20 16 48 40 2C 80 ;M68MAC
  579.  6 :M68MAC 2SWAP A BYTES 20 16 2C AE 00 04 2D 40 00 04 ;M68MAC
  580.  7 :M68MAC OVER 4 BYTES 3D 2E 00 02 ;M68MAC
  581.  8 :M68MAC 2OVER 4 BYTES 2D 2E 00 04 ;M68MAC
  582.  9 :M68MAC >R 2 BYTES 3F 1E ;M68MAC
  583. 10 :M68MAC R> 2 BYTES 3D 1F ;M68MAC
  584. 11 :M68MAC I 2 BYTES 3D 17 ;M68MAC
  585. 12 :M68MAC I' 4 BYTES 3D 2F 00 02 ;M68MAC
  586. 13 :M68MAC J 4 BYTES 3D 2F 00 04 ;M68MAC
  587. 14 -->
  588. 15 
  589.  
  590. Screen # 38
  591.  
  592.  0 ( M68K Cross Compiler -- Comparison operations )
  593.  1 :M68MAC = 6 BYTES 30 1E 32 1E B2 40
  594.  2           8 BYTES 57 C0 02 40 00 01 3D 00 ;M68MAC
  595.  3 :M68MAC < 6 BYTES 30 1E 32 1E B2 40
  596.  4           8 BYTES 5D C0 02 40 00 01 3D 00 ;M68MAC
  597.  5 :M68MAC > 6 BYTES 30 1E 32 1E B2 40
  598.  6           8 BYTES 5E C0 02 40 00 01 3D 00 ;M68MAC
  599.  7 :M68MAC MIN 6 BYTES 30 1E 32 16 B0 41
  600.  8             6 BYTES 6F 02 C1 41 3C 80 ;M68MAC
  601.  9 :M68MAC MAX 6 BYTES 30 1E 32 16 B0 41
  602. 10             6 BYTES 6C 02 C1 41 3C 80 ;M68MAC
  603. 11 -->
  604. 12 
  605. 13 
  606. 14 
  607. 15 
  608.  
  609. Screen # 39
  610.  
  611.  0 ( M68K Cross Compiler -- Comparison operations )
  612.  1 :M68MAC D= 6 BYTES 20 1E 22 1E B2 80
  613.  2            8 BYTES 57 C0 02 40 00 01 3D 00 ;M68MAC
  614.  3 :M68MAC D< 6 BYTES 20 1E 22 1E B2 80
  615.  4            8 BYTES 5D C0 02 40 00 01 3D 00 ;M68MAC
  616.  5 :M68MAC D> 6 BYTES 20 1E 22 1E B2 80
  617.  6            8 BYTES 5E C0 02 40 00 01 3D 00 ;M68MAC
  618.  7 -->
  619.  8 
  620.  9 
  621. 10 
  622. 11 
  623. 12 
  624. 13 
  625. 14 
  626. 15 
  627.  
  628. Screen # 40
  629.  
  630.  0 ( M68K Cross Compiler -- Comparison operations )
  631.  1 :M68MAC 0= 2 BYTES 4A 5E
  632.  2            8 BYTES 57 C0 02 40 00 01 3D 00 ;M68MAC
  633.  3 :M68MAC NOT 0= ;M68MAC
  634.  4 :M68MAC 0< 2 BYTES 4A 5E
  635.  5            8 BYTES 5D C0 02 40 00 01 3D 00 ;M68MAC
  636.  6 :M68MAC 0> 2 BYTES 4A 5E
  637.  7            8 BYTES 5E C0 02 40 00 01 3D 00 ;M68MAC
  638.  8 :M68MAC D0= 2 BYTES 4A 9E
  639.  9             8 BYTES 57 C0 02 40 00 01 3D 00 ;M68MAC
  640. 10 :M68MAC D0< 2 BYTES 4A 9E
  641. 11             8 BYTES 5D C0 02 40 00 01 3D 00 ;M68MAC
  642. 12 :M68MAC D0> 2 BYTES 4A 9E
  643. 13             8 BYTES 5E C0 02 40 00 01 3D 00 ;M68MAC
  644. 14 -->
  645. 15 
  646.  
  647. Screen # 41
  648.  
  649.  0 ( M68K Cross Compiler -- Comparison operations )
  650.  1 :M68MAC AND 4 BYTES 30 1E C1 56 ;M68MAC
  651.  2 :M68MAC OR  4 BYTES 30 1E 81 56 ;M68MAC
  652.  3 :M68MAC XOR 4 BYTES 30 1E B1 56 ;M68MAC
  653.  4 :M68MAC 1'S 2 BYTES 46 56 ;M68MAC
  654.  5 -->
  655.  6 
  656.  7 
  657.  8 
  658.  9 
  659. 10 
  660. 11 
  661. 12 
  662. 13 
  663. 14 
  664. 15 
  665.  
  666. Screen # 42
  667.  
  668.  0 ( M68K Cross Compiler -- Memory and I/O operations )
  669.  1 :M68MAC ! 6 BYTES 30 1E 3B 9E 00 00 ;M68MAC
  670.  2 :M68MAC @ 6 BYTES 30 16 3C B5 00 00 ;M68MAC
  671.  3 :M68MAC 2! 6 BYTES 30 1E 2B 9E 00 00 ;M68MAC
  672.  4 :M68MAC 2@ 6 BYTES 30 1E 2D 35 00 00 ;M68MAC
  673.  5 :M68MAC +! 8 BYTES 30 1E 32 1E D3 75 00 00 ;M68MAC
  674.  6 :M68MAC C! 8 BYTES 30 1E 32 1E 1B 81 00 00 ;M68MAC
  675.  7 :M68MAC C@ A BYTES 30 16 42 41 12 35 00 00 3C 81 ;M68MAC
  676.  8 :M68MAC FILL 8 BYTES 30 1E 32 1E 30 5E D1 CD
  677.  9              8 BYTES 60 02 10 C0 51 C9 FF FC ;M68MAC
  678. 10 -->
  679. 11 
  680. 12 
  681. 13 
  682. 14 
  683. 15 
  684.  
  685. Screen # 43
  686.  
  687.  0 ( M68K Cross Compiler -- Memory and I/O operations )
  688.  1 :M68MAC AW! 4 BYTES 30 5E 30 9E ;M68MAC
  689.  2 :M68MAC AW@ 4 BYTES 30 56 3C 90 ;M68MAC
  690.  3 :M68MAC AL! 4 BYTES 20 5E 30 9E ;M68MAC
  691.  4 :M68MAC AL@ 4 BYTES 20 5E 3D 10 ;M68MAC
  692.  5 :M68MAC CAW! 6 BYTES 30 5E 30 1E 10 80 ;M68MAC
  693.  6 :M68MAC CAW@ 8 BYTES 30 56 42 40 10 10 3C 80 ;M68MAC
  694.  7 :M68MAC CAL! 6 BYTES 20 5E 30 1E 10 80 ;M68MAC
  695.  8 :M68MAC CAL@ 8 BYTES 20 5E 42 40 10 10 3D 00 ;M68MAC
  696.  9 :M68MAC 2AW! 4 BYTES 30 5E 20 9E ;M68MAC
  697. 10 :M68MAC 2AW@ 4 BYTES 30 5E 2D 10 ;M68MAC
  698. 11 :M68MAC 2AL! 4 BYTES 20 5E 20 9E ;M68MAC
  699. 12 :M68MAC 2AL@ 4 BYTES 20 56 2C 90 ;M68MAC
  700. 13 :M68MAC AFILL 8 BYTES 30 1E 32 1E 20 5E 60 02
  701. 14               6 BYTES 10 C0 51 C9 FF FC ;M68MAC
  702. 15 ;S
  703.  
  704. Screen # 44
  705.  
  706.  0 ( Definitions required for FORTH-79 )
  707.  1 : <BUILDS CREATE SMUDGE 0 , ;
  708.  2 : ENDIF [COMPILE] THEN ; IMMEDIATE
  709.  3 ;S
  710.  4 Note.. the above definitions work on my system which is a
  711.  5 combination fig FORTH and FORTH-79.  However, the definition
  712.  6 of <BUILDS may not work with a true FORTH-79 system.  The
  713.  7 compatability depends on how the word DOES> operates in your
  714.  8 system.  For the system described in Leo Brodie's book Starting
  715.  9 FORTH the definition would be:
  716. 10 : <BUILDS CREATE ;
  717. 11 You will need to write an appropriate definition for your
  718. 12 system, the ones given above should serve as guides.
  719. 13 
  720. 14 
  721. 15 
  722.