home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol150 / z8kforth.doc < prev   
Encoding:
Text File  |  1984-04-29  |  5.5 KB  |  125 lines

  1. Here is a Z8001 forth adapted from that in Dr Dobbs No 71, Sept 1982, 
  2.  originally by Lou Odette.
  3.  
  4. It was developed by John Way (of Way Engineering Inc, 213-245-1480)
  5.  (to whom should be directed all technical queries)
  6.  
  7. In addition to all of Lou's basic dictionary he has added SEGMENT, 
  8.   ?TERMINAL and several others.
  9.  
  10. He has also cleaned up several bugs, added documentation and written
  11.   I/O drivers for a polled SIO chip.
  12.  
  13. For more info see the Dr Dobbs Article...
  14.  
  15. Bug reports, enhancements to:
  16. Trevor Marshall, SYSOP, Thousand Oaks Tech RBBS, (805-492-5472),  6/24/83
  17.  
  18. ;-------->
  19.  
  20. Z8000 COMMENT FILE                                      30 Jun 83
  21.  
  22.      L.  L.  Odette's  FORTH  ( LLO_FORTH ) does not include  I/O 
  23. drivers,  hence  we have supplied them for use with a  Z80-SIO  / 
  24. Z80001 combination.  In this configuration polling of the console 
  25. rather  than  an  interrupt scheme is used.   These  drivers  are 
  26. listed only as a guide and are in the public domain.
  27.      Some  changes  to the source list were  implemented  -partly 
  28. because  we used a different assembler,  the  Adv.  Micro-Devices 
  29. MACZ vers. 3.0.
  30.      See  Ref.  #4 below for a more thoroughly commented  listing 
  31. and for copyright exclusions on the FORTH portion.
  32.      In  LLO_FORTH  line 941,  the word OVER was coded in  a  way 
  33. which  will work only if it is assembled below 8000H.   This  was 
  34. changed.  LEAVE on line 1302 LLO_FORTH has been changed also.
  35.      In  MACZ  we  were  unable to assemble  code  using  address 
  36. offsets,  e.g.  in  the coding of QUIT.   Address constants  were 
  37. therefore created by assembling or ORG'ing symbols at appropriate 
  38. origins such as NUM0 or NUM1.  There is probably a better way...
  39.      Our  MACZ does not support ( at least we couldn't get it  to 
  40. support ) LDA instructions (e.g.  line 260,  CRLF ) so these were 
  41. changed  to load immediate instructions wherever  encountered  in 
  42. LLO_FORTH.   This  is  unimportant unless a Z8001 is operated  in 
  43. segmented mode.  MACZ is unwilling to generate absolute HEX files 
  44. when  a  segmented mode Z8001 is specified by the "S"  option  at 
  45. assembly time.  To do this requires the use of the linker LNKZ on 
  46. a .REL file which we will not cover here.
  47.      A  few FORTH words were added after SEMI1 at the end of  the 
  48. source list to improve usefulness- TICK ( ' ) and an interpretive 
  49. DUMP.  As there is no FORTH code compiler here, to add a new word 
  50. to the listing- create it and dump the code.   Then add the  code 
  51. to the list as is done for FIND,  FORGET, etc.  Of course you may 
  52. hand  code  it  and add it into the miscellaneous  word  area  or 
  53. wherever appropriate.
  54.      To  exit FORTH without pushing the reset  button,  the  null 
  55. character control-shift-@ is used ( at NECHO:  ).  This character 
  56. directs  the Z8000 to a utility program if one is resident.   Our 
  57. utility program uses console interrupts so it is necessary to re-
  58. enable  interrupt  on character received in  the  Z80-SIO  before 
  59. exiting.  STARTX: sends an 18H to Reg. 1 in SIO-A.
  60.      To  re-enter FORTH and retain any new words ( warm  start  ) 
  61. change  the  JP  INIT  to JP ABORT in the third  line  down  from 
  62. FORTH:.   When you tire of this, a forth word could be devised or 
  63. it can be made automatic.   However should you crash you may want 
  64. to  change  it  back to JP INIT to try  a  cold  recovery  before 
  65. throwing  in  the towel and re-loading.   P.S.- By loading  BASE: 
  66. with  a  zero  rather than just allocating space as  is  done  in 
  67. LLO_FORTH,  the  warm  start  should  be  automatic  since  INIT: 
  68. examines  BASE  and then initializes it or  ABORTs  depending  on 
  69. whether it has been set >0.
  70.  
  71. Known Bugs:
  72.      This  version  will  not access newly defined  variables  or 
  73. constants  until  a word has been created.   Then  previously  or 
  74. subsequently  defined variables or constants  become  accessible.  
  75. After log-in use : Z ; as a temporary fix.  Something is probably 
  76. wrong in the initialization process.
  77.      If  Wordstar 2 is used in modifying the source list prior to 
  78. assembly  with  MACZ,  be  sure to PIP Z8k.zsc  =  Z8k.zsc[z]  to 
  79. suppress  control  characters  which  will  otherwise  throw  the 
  80. resulting code out of registration with its respective mnemonics.  
  81. You may also try entering Wordstar in the 'N' non-document mode.
  82.      Some  labels  in  LLO_FORTH  required  changing  because  of 
  83. conflicts with MACZ reserved pseudo-ops.   The word " HEADER " is 
  84. an example and generates a warning message from MACZ.
  85.  
  86.      This  FORTH  on a Z8000 in non-segmented mode with a  4  MHz 
  87. clock  will  run the "Sieve of Eratosthenes"3 and  will  generate 
  88. 1000 ( base ten ) primes in 13.8 seconds.
  89. Sieve of Eratosthenes-
  90.  
  91. ( INTERFACE AGE BENCHMARK PROGRAM JUNE, 1980 )
  92. : BENCH DUP 2 / 1+ SWAP ." Starting " CR
  93.      1 DO DUP I 1 ROT
  94.           2 DO DROP DUP I /MOD
  95.                DUP 0= IF DROP DROP 1 LEAVE
  96.                     ELSE 1 = IF DROP 1
  97.                          ELSE DUP 0 > IF DROP 1
  98.                               ELSE 0= IF 0 LEAVE
  99.                                    THEN
  100.                               THEN
  101.                          THEN
  102.                     THEN
  103.                LOOP
  104.           IF . ELSE DROP THEN
  105.      LOOP DROP CR ." Finished " ;
  106.  
  107. ( Replace . ELSE above with DROP ELSE to remove I/O time dependence )
  108.  
  109.  
  110.  
  111.  
  112.      John L. Way
  113.      2011 Tulip Tree Lane
  114.      La Canada-Flintridge
  115.      California 91011
  116.      ( 213 ) 245-1480
  117.  
  118.  
  119. -------------
  120. 1. Z80 and Z8000 are copyrights of the Zilog Corp.
  121. 2. Wordstar is a copyright of MicroPro International Corp.
  122. 3. Forth Dimensions Vol II, No. 4, page 112.
  123. 4.  L.  L. Odette, "Z8000 Forth", Dr. Dobb's Journal No. 71,
  124.     Sept 1982, pp48,63.
  125.