@L}5 _$% l0$)$$Hȱ$ UhL" `e$$%`$%`  R@P!( L(1   Y I`  d  Ld M * @  $ % CC$$)%1 Udߥ$9%: !0 S$% DD˙`  }J)Lr d M * @  $ % CC$$)%1 Udߥ$9%: !0 S$%} DD˙`  }J)Lr J  ((  p L ()   J}L= ( L 0q A    IB JC;? D W } LL  ` W )LA!  ߰")-݆ p" } $G@LL 08`Q")<2Q0 -G$Ș݆ UL# ; p8(()(0ʥ)NQ` }$GȘ݆LU )L ݆ L GȘ ݆LL )W>Z   HH)H }p h  hyhy D L> L JJ    ! LA*` BF }7'8  M HN H` 8 Z  \LdJJ!"! GFE@F (!L }EE !E^ ^ E E7EȩEdE/EȩE  D } .L }  ;F d  ;?F7F? ( .   Z D LL d } . D  L    p  E` , d)  D L) 0BM݊L݉} ML  N݆ L NLML [ TEqEHȱEqEh 0Gȹ G} HLL GɛL  LFREE SECTORS G) *Gȩ GȽG GȌ*jj >G} C8jJ3j2CD( C202C ԠBX` N 1? l LlD:RAMDISK}.COMLu L1 L ;LHL  T`  `8  ɐ     `TU  } L ? .  t`GBJ ~DEHI B V0dV!}QDEHI VF9 ,0 ,0 s0hhL  L` H hDHEh"}DEL8HI4 0 HI,0 0  9 .G VLO#},0 L4*IJ`llD1:AUTORUN.SYSNEED MEM.SAV TO LOAD THIS FILE.D8:MEM.SAV J y08 B|DEHI$} V0 0`B;DEL`?<0LV`@ʆ v s? F0Ξ05: [ BDEHI%} VY8 B V  @  /DE `E:D8:DUP.SYSERROR-SAVING USER MEMORY ON DISKTYPE Y TO &}STILL RUN DOS B;DE J  (` 9 V⪍ ઍ  -'}LLu ÝDEHILV 9 .l 9 .l  `` s$B BH(}I|DE V BLV nB,DE JLV B V BLVDEIʩ BꭝLu } 3E:}DISK OPERATING SYSTEM II VERSION COPYRIGHT 1984 ATARI CORP.A. DISK DIRECTORY I. FORMAT DISKB. RUN CARTRIDG*}E J. DUPLICATE DISKC. COPY FILE K. BINARY SAVED. DELETE FILE(S) L. BINARY LOADE. RENAME FILE M. RUN AT ADDRES+}SF. LOCK FILE N. CREATE MEM.SAVG. UNLOCK FILE O. DUPLICATE FILEH. WRITE DOS FILES P. FORMAT SINGLEL !N',}#"&))9(&*)/h)''-&؆莟R'S  vL/ˢ L }Insert DOS 2.0s, type Y Λx -}DEfHI 1莏#q! @ y0ɛ8A0,' ȅ 1 1ild! 1L!NO SUCH ITEMSELECT.} ITEM OR FOR MENU! 0 .z:*{}.|{ 1 0 0JB 18L%|DL/}%DIRECTORY--SEARCH SPEC,LIST FILE?[# 0 0 &|D3" 1L!NOT A DISK FILEN !B 1L!E# 1 !BD0}ED:}:1BJ|DE 1DEBHI 1 h0ߢ 0.1}  0?詛 1 y0YЛ 1 ;#L" ;#L! BL1TYPE "Y" TO DELETE...DELETE FILE SPEC2}COPY--FROM, TO?OPTION NOT ALLOWED394 FREE SECTORS COPYING---D1:DIRSORT.COMl# 0|D .L/%#3}##JB|DE 1BHID#E 1#0: B 1L!#͑### B 1#c$0SY4}S1}:## # # .#Ƚ# # 𩛙## 1,#PD#ELJ- <.BJD#E 5}1 1HH 0hh|DL%1}:̳# L% #D#EL% 1 0 . .0O% 1L!WILD CARDS NOT A6}LLOWED IN DESTINATION 0 <.|K}N 2 FORMAT. t* 5) 1L!`) 0NΞ 0 L1) 1 L!BAD LOAD FILELOAD FROM WHAT FILE?) 0 ?}0#B 1L!WHAT FILE TO LOCK?) 0 0$B 1L!WHAT FILE TO UNLOCK?DUP DISK-SOURCE,DEST DRIVES?TYPE "Y" IF OK TO US@}E PROGRAM AREACAUTION: A "Y" INVALIDATES MEM.SAV.FE! +L1   `*  70 2 2A} 0.* 1 y0 0)INSERT BOTH DISKS, TYPE RETURN^, 1 y038逍 N, 1L! ,B}C, t*  Lx+, 0 ^, 1 y0 , ,0,0 ,L+ ,I0 ,Vǭ0C}Ξ, 0 }, 1 y0C,ШC, 0K'!" H H 'h h Lx+!EF 5L1L!D,I,HhD}` NOT ENOUGH ROOMINSERT SOURCE DISK,TYPE RETURNINSERT DESTINATION DISK,TYPE RETURNE}`  `8 rL1`-* 1P* 1 y0Y`hhL!NAME OF FILE TO MOVE?- 0 0|DL% <.F},^ 1 70 0 .@L# .BJ 1  DEHIB V L1 ,} 1 70,L.  G}JB|,#P#DE 1 HI BDEHHII 1 B 1 ,^ 1 70,0La- B V,#PH},^ 1 70 0L#L!-* 1P* 1 y0Yj383}mm ݭI}}`8}``|* ? ɛ,`|:-)| / 1L!`DESTINATION CANT BE DOJ}S.SYS0 0H{ 24Δ 28/L!/) 2 Π 2 0 ξK}hAΞB,0 J 1 BDEHI,HÝDE 1HIHIDELSAVE-GIVE L}FILE,START,END(,INIT,RUN)O S0 1`BDEPHI V` S0H 1 L!M}0 0 1L~0`PLEASE TYPE 1 LETTER,0`hhL! 70 1L0L<1 ,;ɛ7,"ɛ:ݦ1ݥN}A"D|ݤD|ȩ:|ȩ|ɛ,,(/+.ީ1 1,ɛ`轤{NAMEO} TOO LONG B VL!` L1I H1EΝDL1|mDiE` V0`8d/8 i:222 1 LP}!ERROR- 128ɛ+,' 20*.. өr2 1``2TOO MANY DIGITSINVALID HEXAQ}DECIMAL PARAMETER800 0 8 00`,0'D800 H,ɛh`2L1NEED D1 THRU D8uR} ECIMAL PARAMETER800 0 8 00`,0'D800 H,ɛh`2L1NEED D1 THRU D8u05  15 2 2151^116115ύ011$r2ԭ5 3)5)5ԭx GT}@@L00)+& 2 L0=ɛ -L!1LV1L1 /3 3ȹ441L-4 v3 25 2H 2h͔5U}L3L3 2 k3U hh`DOC`QL3P1Lk0S1H /3h0B k3@ VL0LU!#$53 1181118V}1111Ε5 1Lk0552 1Ȍ1i111i11115Lk0pppB4f5&&&&&&&&^6f^6&&&&&W}&&A1@BJ D2ELVK@BHILV^Щ6 2BD2EJ VBD5EHI0 V0%5X}5 2iХiL[2 25 25`D:*.*` i@`8 ``@i `8@`0 BLV525<4Y}5`HH i ԍΗ552 ԍhh@ Lح1Э1Ѣ 24.4 24Z}4`D4E` 2BJ k3LVRH` 2BD4EhK)I JLV333 BASIC languag i}e OBJ > MACHINE language DOC > DOCumentation PIC|MIC|FNT|MVM > Graphics AMS|MUS|MBD > Music LST j} > BASIC LISTing -Some MACHINE language programs can only be run by booting the disk MENU "without" BASIC! -For s k}ome programs, XL/XE models may require a "TRANSLATOR" program to be booted first! [Also available from BELLCOM] - l}Most programs are relatively self-explanatory; however, some have separate DOCumentation files available. Some BASIC m} programs may contain instructions in their program listings. -To use this great MENU program on your own disks, n}simply copy the file "AUTORUN.SYS" onto your disk. * MENU written by DAVID CASTELL * program on your own disks, ^ MesaForth 11/22/81 Page 1-1 Chapter 1~ p} Introduction~ MesaForth is based on the 6502 fig-Forth model. The major q}difference from the model is in the size of the screen on disk (512 bytes instead of 1024 bytes). You should rer}fer to fig-Forth documentation for a complete description of Forth and the standard words provided in fig-s}Forth. This document will describe the special features provided in MesaForth. A major difference t} between MesaForth and other Forth's available for ATARI is that MesaForth runs under ATARI DOS 2.0S. u}Forth source files and data files are written on standard DOS formatted diskettes. This means that Forthv} files can be interchanged with any other program that uses DOS files (ATARI BASIC, Assembler/Editor,w} Music Composer, ATARI Word Processor, etc.). This can make MesaForth a powerful tool in producing x}efficient software on your ATARI. Your MesaForth system diskette contains more than the fig-Forth model. y} It also contains some additional software:  1. Complete CIO interface to ATARI Operating System and DOS z} 2. Support of Graphics/Sound/Joystick routines in O.S. 3. Complete support of character string mani{}pulation 4. Interface to Disk Handler routines in O.S. 5. Screen editor for modification of For|}th files 6. Text formatter for use with on-line documentation 7. Turnkey support to create appl}}ication programs6. Text formatter for use with on-line documentation 7. Turnkey support to create applJ7r for use with on-line documentation 7. Turnkey support to create appl( MesaForth 12/03/81 Page 2-1 Chapter 2~  } Booting MesaForth~  Before you use your MesaForth disk for the first} time, you should make sure it is write-protected so that you can't accidentally destroy it. It is} suggested that you duplicate this disk and store the original and use it only as a master disk. You should }use another disk when you are running MesaForth. To boot MesaForth, follow these steps:  1. Turn o}n disk drive and insert MesaForth diskette 2. Turn on any other peripherals 3. Turn on computer} DOS will boot up first. It will execute the AUTORUN.SYS file on the system disk. This will lo}ad and execute files with extensions of .IN0, .IN1, .IN2, .IN3, and .IN4 until it finds no files with t}hese extensions. If you have an Interface Module (850), you will need the file INTRFACE.IN0 on your system di}sk. If you have any other special boot files, they should be loaded next. Then the MesaForth object file }will be loaded and executed last (FORTH.IN1 on standard system disk). You will then see a message (fig-F}ORTH x.x) which announces that you are now in Forth. At this point, you can enter any existing Forth word or enter} a colon definition.  Defining system words~ When you first boot up your MesaForth, y}ou will have the minimum subset of Forth words defined. Before you can do anything else, you will probably n}eed to add the system extensions. These words are contained in the SYSTEM.4TH file. This file also }contains in screens 4 through 6 the system error messages (you should usually leave DR0 selected to SYSTEM.}4TH). This file defines some useful extensions to Forth such as character string manipulation and the :SEL}ECT word. These will be described later. To load these words, type:  1 LOAD MesaForth wi}ll then go out to the disk and load the words from SYSTEM.4TH. After it is finished loading, it will ty}pe OK. This indicates that it is finished with the previous command(s) and is ready to accept new instruct}ions.  ates that it is finished with the previous command(s) and is ready to accept new instruct MesaForth 12/03/81 Page 2-2 Defining the screen editor words~ Now t}hat you have loaded the system words, you can load the MesaForth editor. To do this, type:  LOAD}-ED This will select EDITOR.4TH as DR1 and execute a LOAD for that file.  Defining the DOS} words~ Often you will want to perform some standard DOS operations on your disk. You can do these by} loading the DOS words. This can be done by typing:  LOAD-DOS This will load the wo}rds from DOS.4TH. The words available will allow you to do directories, deletes, renames, locks, unl}ocks, and some copying. These words are designed to be forgotten when you are finished with them. This wil}l release the memory used by these functions so that you can use it for you program. To forget DOS, typ}e:  FORGET DOS by these functions so that you can use it for you program. To forget DOS, typ!J7ese functions so that you can use it for you program. To forget DOS, typ ( MesaForth 11/22/81 Page 3-1 Chapter 3~  $} MesaForth file format~  Some differences have been made in the Forth file st$}ructure in MesaForth. First, the screen size has been modified to 512 bytes. This change is primarily du$}e to the problem of displaying an entire Forth screen at one time. Fig-Forth suggests using a screen$} size of 1024 bytes (16 lines of 64 characters each). Since the ATARI line width is at most 40 characters, using 6$}4 character lines would cause some confusion. In MesaForth, the line size is 32 characters. Each screen sti$}ll has 16 lines, producing a screen size of 512 bytes. Another major change is having Forth run under $}the ATARI DOS. Using DOS gives you access to files used by other ATARI DOS-supported programs. $} But, running under DOS adds some additional changes to Forth. First, DOS must be booted before Fo$}rth. DOS requires some memory; you lose this memory for use by your Forth programs. Also, Forth usually performs r$}andom accesses to screens on disk. But under ATARI DOS, files are normally accessed sequentially. Mes$}aForth will simulate the random access, by creating an internal screen list showing the position of each sc$}reen within an ATARI file. After the list has been made (it is made automatically), then accesses to individual $}screens will be very fast (random access). Note that since MesaForth supports all CIO functions, includin$}g the DOS file accesses, you will normally use Forth files for only your Forth sources (word definitions). D$}ata files will usually by normal DOS files. Forth files for only your Forth sources (word definitions). D$7J7 DOS files. Forth files for only your Forth sources (word definitions). D(( MesaForth 12/03/81 Page 4-1 Chapter 4~  ,} Character strings~  A useful extension to Forth in MesaForth is the ,}support of character string operations. Since Forth is stack-oriented for its numeric operations, it i,}s natural to add character string words as stack-oriented operations. A special string stack is set up sepa,}rate from the numeric stack. It has its own stack pointer ($SP). The size of the string stack is defined by th,}e variable *$*. The string stack and words are established when you load SYSTEM.4TH. You can change the,} size of the stack, or change/add words by changing SYSTEM.4TH. Refer to Appendix A for a complet,}e list of the string operations. For efficiency, no special checks are performed on the string stac,}k. If you exceed its size, or pop too many elements off of the string stack, your program will probably,} crash. Remember, you can add these checks by modifying the words in SYSTEM.4TH. The following sections w,}ill describe the string operations provided in MesaForth.   Stack Manipulaton~  ,} " text" ( -$> $ ) This operation pushes a quoted text string on top of the string sta,}ck. The string must be terminated by a double quote ("). NOTE that there must be a space between the first quo,}te mark (") and the first character in the text string. Examples:  " This is a text string",} " D1:EDITOR.4TH"  "" ( -$> $ ) This word pushes an empty (zero,}-length) string on top of the string stack.  $DROP ( $2 $1 -$> $2 ) This,} is like the DROP word, except it drops the top string off the string stack.  $DUP ,}( $1 -$> $1 $1 ) This is like the DUP word, except that it duplicates the top string on the stack. ,}  $1 $1 ) This is like the DUP word, except that it duplicates the top string on the stack. , MesaForth 12/03/81 Page 4-2 $FILL ( n c --> ) 0} ( -$> $ ) This operation, takes the number of characters (n) and the character (c) off th0}e numeric stack, and produces a string at the top of the string stack which contains the indicated number of 0} characters c. Example:  20 BL $FILL This will put a string of 20 blanks on top of t0}he string stack.  $SWAP ( $1 $2 -$> $2 $1 ) Just like the SWAP word, except0} that it swaps the top two strings on the string stack.   String operations~  0} $+ ( $1 $2 -$> $1+$2 ) This operation is similar to the + word; it concatenates the 0} top string on the stack onto the end of the second string on the string stack. Example:  0} " a" " b" $+ ( this produces "ab" on the string stack )  $. ( $ -$> ) This 0}prints the top string on the string stack.  $< ( --> f ) ( $0}1 $2 -$> ) This operation compares the top two string on the string stack. If $1 is less than $2, then th0}e result (f) will be true(non-zero), otherwise the result will be false (zero).  $= 0} ( --> f ) ( $1 $2 -$> ) Similar to $<, except the result will be true if $1 is eq0}ual to $2.  $COMPARE ( --> n ) ( $1 $2 -$> ) T0}his word is the internal comparison function. It is called by $< and $= to perform the actual comparison. It com0}pares the top two strings on the string stack and returns -1 if $1<$2, 0 if $1=$2, and 1 if $1>$2. 0}  the top two strings on the string stack and returns -1 if $1<$2, 0 if $1=$2, and 1 if $1>$2. 0 MesaForth 12/03/81 Page 4-3 $FETCH ( addr len --> ) 4} ( -$> $ ) This word is used to fetch strings not stored in string variables. It 4}takes a string starting at the address (addr), and pushes it on top of the string stack. Its length will len. 4}  $LEN ( --> n ) This returns the length of the top string on the string stack. 4}  $P! ( --> ) This word resets the string stack pointer (makes the string 4} stack empty). This is automatically done whenever a warm-restart (or cold-start) is performed. You can als4}o do this yourself anytime, but be warned that anything that was on the string stack will be lost. 4} $P@ ( --> n ) This word returns the value of the string stack pointer (which i4}s pointing to the address of the top string on the string stack). NOTE that you will probably never need to use th4}is word since all of the string operations can be performed without knowing the address of the string 4}stack. This word is used in defining the string operations like $DROP or $SWAP.  $P2 4} ( --> n ) This word returns the address of the second string on the string stack. NOTE that4} you will probably never need this word. It is used to define other string operations.  $STORE 4} ( addr max --> actlen ) ( $ -$> ) This word is used to store strings4} into non-string variable locations. The top string on the string stack is stored into memory at the add4}ress (addr). The maximum string size allowed for storage is max. This word will return the actual length of the4} data stored on top of the numeric stack (actlen).   Variable operations~ $! 4} ( vaddr --> ) ( $ -$> ) This operation stores the top string on the4} string stack into the string variable whose address is on top of the numeric stack. If the string is larger4} than the size of the string variable, only the leftmost part of the string will be kept. string is larger4m MesaForth 12/03/81 Page 4-4 $+! ( vaddr --> ) 8} ( $ -$> ) This operation concatenates the top string on the string stack onto the end of the8} string of the string variable whose address is on the top of the numeric stack. If the resulting string will be 8} larger than the string variable, only the leftmost part of the string will be stored.  $@ 8} ( vaddr --> ) ( -$> $ ) This is similar to the @ word, except 8}that the string in the string variable is fetched and put on the top of the string stack.  $EXTRACT 8} ( vaddr offset char  --> offset true ) ( -$> wd ) 8} --> false ) ( -$> ) This operation extracts a substring from a string variable. For example8}, it can be used to extract words from a line (using a blank as a separator). This operation uses the string va8}riable (vaddr), starting at the indicated position within the string (offset, 0 is the first charact8}er). It looks for the next occurrence of the character (char). If it finds it, it will return tru8}e on top of the numeric stack, and also the current position in the string. The substring between the previous 8}offset and the current offset is put on top of the string stack. If no more characters (char) are found i8}n the string variable, then a false is returned on top of the numeric stack. Example:  30 $V8}ARIABLE LINE ( defines LINE as a string variable ) " word1 word2" LINE $! ( puts "word1 word2" into LINE ) 8} LINE 0 BL $EXTRACT ( will return 5 1 on top of the numeric stack for true, an8}d next offset is 5, "word1" will be on top of string stack) DROP $DROP ( d8}rop true, and "word1" ) LINE SWAP BL $EXTRACT ( will return 11 1 on top of the numeric 8} stack for true, and next offset is 11, "word2" will be on top of strin8}g stack) DROP $DROP LINE SWAP BL $EXTRACT ( will return 8}0 on top of the numeric stack, false indicates no words 8} in LINE )  $VARFILL ( vaddr c --> ) Fills the string variable (8}vaddr) with the character c. RFILL ( vaddr c --> ) Fills the string variable (8) MesaForth 12/03/81 Page 4-5 $VARIABLE xxx ( len --> ) <} Similar to the VARIABLE word, except that the numeric value on top of the stack indicates how many characters to=} allocate to the string variable. This will limit the size of the string which may be stored in the string =}variable. But it does not mean that all strings need to be this size. The actual length is also kept for =}each string variable. Example:  10 VARIABLE NAME ( define 10 character string variable =} called NAME ) " Smith" NAME $! ( store 5 character string in NAME ) NAME $V=}ARLEN ( this will return 5, since the actual length is only 5 ) " Smith,=} Jonathan" ( this will only store the leftmost 10 characters into NAME, since its max =} length is 10 )  $VARLEN ( vaddr --> len ) =} Returns the actual length of the string variable (vaddr).  $VARMAX ( vaddr --> max =}) Returns the maximum length of the string variable (vaddr).   ( vaddr --> max <]J7' of the string variable (vaddr).   ( vaddr --> max @( MesaForth 12/03/81 Page 5-1 Chapter 5~  E } MesaForth Editor~  You will be using the MesaForth Editor to create aE }nd modify your Forth source files. This editor is a screen editor; it allows you to make changes E }to your source by using the cursor controls and making changes by typing on the screen without using specialE} editing commands. The screen editor is similar to the functions provided by ATARI BASIC or the Assembler/EditorE}. To use the editor on a source file, you must first select the file you wish to edit. This can be E}done using the $SETDR1 word. For example:  " D1:FILE.4TH" $SETDR1 DR1 This will loE}ok for the file FILE.4TH on D1:. It will be used as DR1. DR1 is then selected as the active file. Now to invoE}ke the editor, you use a special word:  EDIT ( screen --> ) This word inE}vokes the editor on the indicated screen in the currently active file (DR0 or DR1). The television display wilE}l be cleared and the Forth screen will be displayed. All 16 lines of the screen will be shown, with a box aE}round it (so that you can tell what is part of the screen, and what is information shown by the editor. TE}he bottom of the display will show what special editor commands are available.   StandarE}d editing commands:~ While you are in the editor, any character you type (except special control chaE}racters) while be entered into the screen at the current position of the cursor. It will replace whatever was E} in that position of the screen. The editor control characters are:  arrows The E} arrows (control characters left of the RETURN key) will move the cursor the appropriate direction in the screen. E}  DELETE/BACK-SPACE This key will delete the character preceeding the cursor in the screenE}.  DELETE/BACK-SPACE This key will delete the character preceeding the cursor in the screenD  MesaForth 12/03/81 Page 5-2 SHIFT DELETE/BACK-SPACE Holding the shiftI} key down while hitting the DELETE/BACK-SPACE key will cause the entire line on which the cursor is positioned I} to be deleted. All lines below it on the screen will move up to fill in.  SHIFT INSERT I } Holding the shift key down while hitting the INSERT key will insert a blank line at the line on which the cI!}ursor is positioned. All lines (including the line currently holding the cursor) will move down. Note thaI"}t the last line in the screen will be moved outside of the screen. The editor will hold that line for you in I#} case you accidentally inserted a line. To restore the screen to its original state, delete the line you just iI$}nserted.  CTRL DELETE/BACK-SPACE Holding the ctrl key down while hitting the DELETE/BACK-SPACEI%} key will delete the character currently under the cursor in the screen.  CTRL INSERT I&} Holding the ctrl key down while hitting the INSERT key will cause a space to be inserted at the cursor. I'}All characters after the cursor (including the character under the cursor) will shift right one position.I(} The editor will not allow you to shift a character off the end of the line. You will have to split the I)} line up if it gets full and you still need to add something to it.   Special Editing commands~I*} There are some additional editing commands available. To enter these commands, first hit the ESCAPE keI+}y. Then enter one of the following commands:  X (eXit) This command saves all of the I,} screens that have been edited, and exits the editor mode, returning you to normal Forth command mode. YoI-}u must enter this command before leaving the editor. Otherwise not all of the screens you have updated will get I.}flushed to the disk.  A (Abort) This command aborts editing of the current screen. I/}It will save all of the other screens that have been updated though. ts editing of the current screen. HW MesaForth 12/03/81 Page 5-3 C (Copy) This command allows you to M1} move screens around within your file. It will ask you for the starting and ending screen numbers to be movM2}ed. It will also you ask you for the number of the first target screen. Enter each of these numbers, hitting M3}a RETURN after each.  E (Erase) This command erases the current screen. It fills thM4}e entire screen with blanks.  S (Search) This command is not yet implemented, it M5}would be a search through the file for a particular string of characters.  < (preceeding screen) M6} Use this command to move to the preceeding screen in the file.  > (following screen) UseM7} this command to move to the next screen in the file.  number (move directly to a screen) After M8}hitting the ESCAPE key, enter a number, then a RETURN. The EDITOR will move directly to that screen. After LrJ7'r, then a RETURN. The EDITOR will move directly to that screen. After P( MesaForth 12/03/81 Page 6-1 Chapter 6~  U;} ATARI Input/Output~  MesaForth provides a complete set of Forth U<} extensions interfacing to the ATARI Operating System. The Input/Output (I/O) words fall into the following cU=}ategories:  1. Central Input/Output (CIO) 2. Disk Handler 3. Disk OperatU>}ing System (DOS) 4. Special I/O (sound, graphics, joysticks) Refer to Appendix A for a complete U?}summary of these functions. The remainder of this chapter will give a brief description of the features proviU@}ded in MesaForth.  CIO functions~ The interface to CIO provides both input and output similar UA} to what is available in ATARI BASIC. The ATARI Operating System allows up to 8 files/devices to be opeUB}rated at a time. They are identified by individual I/O Control Blocks (IOCB). These IOCB's are identifiedUC} by #0, #1, ... #7. MesaForth and the ATARI O.S. use some of these internally. The IOCB's available for your UD}use are #0, #3, #4, #5, and #6. These words are defined for you convenience. The functions UE}provided are:  CLOSE close file/device GET get character(byte) UF} GETBUF get buffer from file/device GETREC get record (terminated by End-Of-Line) UG} JSRCIO call CIO (assumes IOCB set-up) NOTE note position in disk file UH} OPEN open file/device POINT point to position in disk file PUT UI} write character(byte) PUTBUF write buffer to file/device PUTREC write recorUJ}d (terminated by End-Of-Line) STATUS return status of file/device XIO call CUK}IO (like BASIC XIO) For a detailed description of OPEN, CLOSE, NOTE, POINT, and XIO refer to the ATARI BAUL}SIC manual. The calling sequence and meaning of arguments is similar, with the exception of the file name UM} arguments. The ATARI O.S. requires that file name be terminated by an EOL. A special string function is pUN}rovided ($FILE) which converts the top string on the string stack into a file name, and returns the address oUO}f the name on the top of the numeric stack. You can use this address in OPEN (or XIO). Then use a $DROP to UP} drop the file name from the string stack. Example: this address in OPEN (or XIO). Then use a $DROP to TC MesaForth 12/03/81 Page 6-2 #3 4 0 " D:FILE" $FILE OPEN $DROP YR} #3 GET #3 CLOSE The above example opens D:FILE and gets the first byte from the file. YS}The file is then closed. Another word (?DISKERROR) can be used to abort your program if a disk error occurs.  YT} Disk Handler~ The disk handler words interface to the ATARI O.S. disk handler routines. They suppYU}ort reading and writing of individual sectors on a disk (without using the DOS). Two extra words are defined YV} which will dump sectors from disk, and do a sector by sector copy of a disk.  DOS Functions~YW} Some of the DOS functions are supported in MesaForth. You can delete, lock, rename, and unlock filYX}es. You can also do a directory of your disks. These functions use the string stack for the name of the YY}file(s). For example:  " D:*.*" DIR " D:*.BAK" DELETE An additional functiYZ}on (SCRCOPY) can be used to create a copy of the currently selected file (DR0/DR1).  Special I/O~Y[} Words have been defined to access the sound, graphics, and joystick functions provided by the Y\}ATARI O.S. These words are similar to the ATARI BASIC commands providing the same features:  CY]}OLOR selects color DR. draws line (DRAWTO) GR. opens screen for Y^}graphics (GRAPHICS) LOC. locates color at point (LOCATE) PL. plots point (Y_}PLOT) POS. positions graphics cursor (POSITION) SE. sets color register (SY`}ETCOLOR) SO. sets voice for sound (SOUND) STICK tests joystick position Ya} STRIG tests joystick trigger An additional word (CVTSTK) has been provided to convert thYb}e joystick position values to something more meaningful. dditional word (CVTSTK) has been provided to convert thXBJ7'ething more meaningful. dditional word (CVTSTK) has been provided to convert th\( MesaForth 11/30/81 Page 7-1 Chapter 7~  ae} Miscellaneous Functions~  MesaForth provides two additional features useful af} for creating turnkey applications in Forth. A text formatter is provided to support on-line documentatioag}n to the screen or to a printer. A TURNKEY word is provided to save a set of loaded Forth words. A NEW-aq}3B%DOS SYSB*)DUP SYSB SAUTORUN SYSB_HELP DOCBoFORTH1 001B~FORTH1 DOCBFORTH2 001B FORTH2 002BFORTH2 DOCBFORTH3 001BFORTH3 DOCBFORTH4 001BFORTH4 002BFORTH4 003BFORTH4 004B FORTH4 005B FORTH4 DOCB FORTH5 001BFORTH5 002B 0FORTH5 003B9FORTH5 DOCB:FORTH6 001BQFORTH6 002BcFORTH6 DOCBdFORTH7 001BFORTH7 DOCBFORTHA 001BFORTHA 002BFORTHA 003B%FORTHA 004BFORTHA 005B# FORTHA 006B"0FORTHA 007BRFORTHA 008BnFORTHA DOCB.oPRINTER ABORT word allows you to chain your own functions into the warm restart sequence (SYSTEM RESET). Thear} Text Formatter reads a file generated using the MesaForth Editor (i.e., a Forth file of screens with no carriagas}e returns). It looks for a small set of commands starting in column 1 of a line:  .BREAK at} pause on screen (so it can be read) .CENTER text center text on line .END end of file au} .FILL begin filling of text (right-margin justify) .NOFILL end filling of text .PAGE av} force a start of a new page (clear screen) . force a blank line Use the text formatteraw} to generate instructions for programs you have written. You call the text formatter (after it is lax}oaded) by using the FORMAT word. It will display the text on the screen or print it on a printer. It will stop foay}rmatting if the BREAK key is hit. To save your own turnkey programs, use the TURNKEY word. It az} will save the currently loaded Forth words to a binary file on disk. Usually you will have a blank disk (forma{}atted, with DOS). You will use TURNKEY to save your Forth program as AUTORUN.SYS. TURNKEY sets the fence a|}so that your words cannot be deleted when you load the new file. Example:  " D:AUTORUN.SYS" a}}TURNKEY A useful feature is to create programs that can be run, but that can be set so that the usea~}r cannot enter Forth to see what you are doing. This can be done by using the NEW-ABORT word. To automatia}cally call one of your words when the SYSTEM RESET key is hit (or when the program is first loaded), define the a}following word:  : START NEW-ABORT yourword ; The START word will automaticallya} be executed whenever Forth restarts (on SYSTEM RESET or initial load). This can be used to prevent someoa}ne from ever getting into Forth. It can also be used to reset some application specific feature (like the sta}ring stack). o Forth. It can also be used to reset some application specific feature (like the st`J7' also be used to reset some application specific feature (like the std( MesaForth 11/22/81 Page A-1 i} Appendix A -- MesaForth Reference~ The following reference table describes all of the Forth words i}available on the Forth system disk. This version of the Forth Interest Group Forth (figFORTH) is based on Forth 78. Thei} difference (from figFORTH) is the block and screen size (512 bytes). Some of the words are defined in the standard Foi}rth object file, others are defined in Forth source files on the system disk and can be modified and loaded. i} The first column contains the name of the word. The second column describes the stack operation:  i} ( input --> output ) ( $input -$> $output ) The normal stack is described with -->, the i} string stack is described by -$>. The top of the stack is the rightmost item in a list. The input items reflect thei} stack before the word is executed. The output items indicate the stack state after the word is executed. The operandi}s are defined as follows:  n, n1, ... 16-bit signed integer numbers i} d, d1, ... 32-bit signed integer numbers u 16-bit unsignedi} integer number addr 16-bit address b i} 8-bit byte c 8-bit ATASCII character f i} boolean flag (0 is false) iocb offset of I/O control block (i.e., hex 00, i}10, 20, ...) The third column indicates the source of the word. The values for this column are:  i} fig fig-Forth word in normal Forth object file ext i} MesaForth extensions in Forth object file SYS in SYSTEM.4TH, words usually needei}d DISK in DISK.4TH, disk handler interface DOS i} in DOS.4TH, ATARI DOS words EDIT in EDIT.4TH, Forth screen editor i} FORM in FORMAT.4TH, text-formatting words for use in program HELP files i} TURN in TURNKEY.4TH, saves current Forth words for turnkey operation   Stack Manipulati}ion~ -DUP ( n --> n ? ) fig Duplicate only if non-zero >R ( n --> ) i} fig Move top item to "return stack" for temporary storage (use caution) DUP ( n --> n n ) i} fig Duplicate top of stack DROP ( n --> ) fig Throw away top of stack OVER i} ( n1 n2 --> n1 n2 n1 ) fig Make copy of second item on top PICK ( nm...n1 --> nm...n1 nm ) exti} Pick the mth item into the stack and copy it to the top of the stack R> ( --> n ) fig i} Retrieve item from return stack R ( --> n ) fig Copy top of return stack onto stack i} ROT ( n1 n2 n3 --> n2 n3 n1 ) fig Rotate third item to top SWAP ( n1 n2 --> n2 n1 ) i}fig Reverse top two stack items  fig Rotate third item to top SWAP ( n1 n2 --> n2 n1 ) h. MesaForth 11/22/81 Page A-2 Number Bases~ BASE m}( --> addr ) fig System variable containing number base DECIMAL ( --> ) fim}g Set decimal base HEX ( --> ) fig Set hexadecimal base   Arithmetic andm} Logical~ * ( n1 n2 --> prod ) fig Multiply */ ( n1 n2 n3 --> quot ) fig m} Multiply, then divide (n1*n2/n3), using double-precision intermediate */MOD ( n1 n2 n3 --> rem quot ) fig m} Multiply, then divide (n1*n2/n3), using double-precision intermediate + ( n1 n2 --> sum ) fig m}Add - ( n1 n2 --> diff ) fig Subtract (n1-n2) / ( n1 n2 --> quot ) fim}g Divide (n1/n2) /MOD ( n1 n2 --> rem quot ) fig Divide (n1/n2), giving both remainder and quotientm} 1+ ( n --> n+1 ) fig Increment number by 1 2+ ( n --> n+2 ) fim}g Increment number by 2 ABS ( n --> absolute ) fig Absolute value of n AND ( n1 n2m} --> and ) fig Logical AND (bitwise) D+ ( d1 d2 --> sum ) fig Add double-precisionm} numbers D+- ( d1 n --> d2 ) fig Apply the sign of n to d1, leaving it as d2 DABS m}( d --> absolute ) fig Absolute value of double precision number DMINUS ( d --> -d ) m} fig Change sign of double-precision number M* ( n1 n2 --> d ) fig Multiplies two numbers, pm}roducing a double-precision number M/ ( d n1 --> rem quot ) fig Divide double precision number by sim}ngle precision number, producing single-precision numbers M/MOD m} ( ud1 u2 --> u3 ud4 ) fig Unsigned divide of double-precision number, producing single precision m} remainder(u3) and double-precision quotient(ud4) MAX ( n1 n2 --> max )m} fig Maximum of n1 and n2 MIN ( n1 n2 --> min ) fig Minimum of n1 and n2 MINUS m} ( n --> -n ) fig Change sign of number MOD ( n1 n2 --> rem ) fig Modulm}o (i.e. remainder of n1/n2) OR ( n1 n2 --> or ) fig Logical OR (bitwise) U* ( u1m} u2 --> ud ) fig Unsigned multiplication of two numbers, producing unsigned double-precision m} number U/ ( ud u1 --> u2 u3 ) fig Unsigned divide of double-pm}recision number by single-precision number, producing unsigned remaindem}r (u2) and quotient (u3) XOR ( n1 n2 --> xor ) fig Logical exclusive OR (bitwise)   m}Comparison~ 0< ( n --> f ) fig True if number is negative 0= ( n --> f ) m} fig True if top number zero (i.e., reverses truth value) < ( n1 n2 --> f ) fim}g True if n1 less than n2 = ( n1 n2 --> f ) fig True if n1 equals n2 > ( n1m} n2 --> f ) fig True if n1 greater than n2   fig True if n1 equals n2 > ( n1lG MesaForth 11/22/81 Page A-3 Memory~ ! ( n adq}dr --> ) fig Store word value at address in memory +! ( n addr --> ) fig Addq} number to value of word at address in memory ) SYS Like CMOVE, except bytes q}moved starting at high address first ? ( addr --> ) fig Print numeric value of word at addq}ress in memory @ ( addr --> n ) fig Fetch one word from memory at indicated address BLANq}KS ( addr u --> ) fig Fill u bytes in memory with blanks C! ( b addr --> ) q} fig Store byte value at address in memory C@ ( addr --> b ) fig Fetch one byte at addreq}ss from memory CMOVE ( from to u --> ) fig Move u bytes in memory ERASE ( addr u --> ) q} fig Fill u bytes in memory with zeroes FILL ( addr u b --> ) fig Fill u bytes inq} memory with a byte value   Control Structures~ BEGIN until: ( f --> ) fig Loop back q}to BEGIN until true at UNTIL ...UNTIL BEGIN while: ( f --> ) fig Loop while true at WHILE q} ...WHILE ...REPEAT DO...+LOOP do: ( end+1 start --> ) fig Like DO...LOOP, except adds stack value toq} index at end of loop +loop: ( n--> ) DO...LOOP do: ( end+1 start --> ) fig Set up loop, gq}iven index range I ( --> index ) fig Place current index value on stack IF...(true) iq}f: ( f --> ) fig If top of stack is true (non-zero), execute ...ENDIF IF...(true) if: ( f --> )q} fig Like IF...ENDIF, except if false, the ELSE clause is executed ELSE...(false) ...ENDIF q}LEAVE ( --> ) fig Terminate loop at next LOOP or +LOOP  false) ...ENDIF pc MesaForth 11/22/81 Page A-4 Terminal Input-Output~ . u} ( n --> ) fig Print number ." ( --> ) fig Print messageu} (terminated by ") .R ( n fieldwidth --> ) fig Print number, right-justified in field ?TERMINALu} ( --> f ) fig True if terminal break request present BELL ( --> ) u} SYS Ring console bell BL ( --> n ) fig Leaves the ATASCII value of blank on the su}tack COUNT ( addr --> addr+1 u ) fig Change length-byte string to TYPE form CR ( --> ) u} fig Do a carriage return D. ( d --> ) fig Print double-precision u}number D.R ( d fieldwidth --> ) fig Print double-precision number, right-justified in field DUMPu} ( addr u --> ) SYS Dump u bytes starting at address EMIT ( c --> ) u} fig Type character c EXPECT ( addr n --> ) fig Read n characters (or until a carriage returu}n) from input to address KEY ( --> c ) fig Read key, put ATASCII value on stack PR-u}OFF ( --> ) SYS Turn the printer off (for terminal I/O) PR-ON ( --> ) u} SYS Turn the printer on (for terminal I/O). All output from TYPE, EMIT, etc. u} will appear on the screen and the printer. All keyboard input will also be u} echoed on the printer SPACE ( --> ) fig Type a space SPACES u} ( n --> ) fig Type n spaces SPEMIT ( c --> ) SYS Allows special u}characters to be sent to the screen TYPE ( addr u --> ) fig Type string of u characters startinu}g at address U. ( u --> ) SYS Type the unsigned number WORD ( c --> ) u} fig Read one word from input stream, stopping at character c (usually blank)   Input-Output Foru}matting~ # ( d --> d ) fig Convert next digit of double-precision number and add characteu}r to output string #> ( d --> addr u ) fig u} Terminate output string (ready for TYPE) #S ( d --> 0 0 ) fig Convert all significant digiu}ts of double-precision number to output string <# ( --> ) fig Start output string u}HOLD ( c --> ) fig Insert ATASCII character into output string NUMBER ( addr - d u}) fig Convert string at address to double-precision number SIGN ( n d --> d ) u} fig Insert sign of n into output string   Disk Handling~ B/BUF ( --> n ) fig u} System constant giving disk block size in bytes B/SCR ( --> n ) fig System constant givinu}g blocks per editing screen BLK ( --> addr ) fig System variable containing current block nuu}mber BLOCK ( block --> addr ) fig Read disk block to memory address DR0 ( --> ) u} fig Selects use of file 0 for LIST, LOAD, and EDIT DR1 ( --> ) fig u} Selects use of file 1 for LIST, LOAD, and EDIT EMPTY-BUFFERS ( --> ) fig Erase all buffersu} FLUSH ( --> ) fig Write all updated buffers to disk INDEX ( from to --> ) u} fig Lists the first line of the screens indicated LIST ( screen --> ) fig List a du}isk screen (512 bytes) LOAD ( screen --> ) fig Load disk screen (compile or execute) PLISu}T ( strt end --> ) SYS List the screens from strt to end to the printer (and screen) SCR u} ( --> addr ) fig System variable containing current screen number UPDATE ( --> ) u} fig Mark last buffer accessed as updated  rrent screen number UPDATE ( --> ) tB MesaForth 11/22/81 Page A-5 Defining Words~ : xxx y}f pointer to context vocabulary (searched first) CURRENT ( --> addr ) fig Returns address of poiy}nter to current vocabulary (where new definitions are put) DEFINITIy}ONS ( --> ) fig Sets CURRENT vocabulary to CONTEXT FORTH ( --> ) y}fig Main Forth vocabulary (execution of FORTH sets CONTEXT vocabulary) VLIST ( --> ) fig y} Print names of all words in CONTEXT vocabulary VOCABULARY ( --> ) fig Create new vocabulary y}named xxx   Miscellaneous and System~ ' xxx ( --> addr ) fig Find address of xxx y}in dictionary; if used in definition, compile address ( ( --> ) fig Begin comment, tey}rminated by right paren on same line; space after ( , ( n --> ) fig Compile a number iny}to the dictionary ABORT ( --> ) fig Error termination of operation ADDBLKS ( 0/y}1 n --> ) EDIT Adds n blocks (screens) to the end of DR0(0) or DR1(1) ALLOT ( --> ) z} fig Leave a gap of n bytes in the dictionary COLD ( --> ) fig Performs a sysz}tem cold start (erases application program and restarts) EDIT ( n --> ) EDIT Enters screen z}editor for screen n of the current file (DR0/DR1) FORGET xxx ( --> ) fig Forget all definitionz}s back to and including xxx FORMAT ( filespec -$> ) FORM Read the file, and format the text on the sz}creen or printer FREE ( --> n ) SYS Returns the number of free bytes left in memory HEz}RE ( --> addr ) fig Returns address of next unused byte in the dictionary IN ( -->z} addr ) fig System variable containing offset into input buffer (used by WORD) NEW-ABORT ( --> ) z} SYS This word is used when compiling another word that is to be executed on z} a warm-reset (like the SYSTEM RESET key). This word should be the very z } first word in a colon definition. The remainder of the new word definition z } will be executed each warm-restart PAD ( --> addr ) fig Rez }turns address of scratch area (usually 68 bytes beyond HERE) SP@ ( n --> ) fig Returns adz }dress of top stack item   68 bytes beyond HERE) SP@ ( n --> ) fig Returns adx& MesaForth 11/22/81 Page A-6 String Functions~ " text" ~} ( -$> $ ) SYS Pushes a string constant on top of the str ng stack "" ( -$> $ ) ~} SYS Push the empty string on top of the string stack $! ( vaddr --> ) SYS S~}tore the string at the top of the string stack into the string variable ( $ -$> ) $+ ( $1 $2~} -$> $1+$2 ) SYS Concatenate the top two strings on the string stack $+! ( vaddr --> ) ~} SYS Concatenate the top string of the string stack onto the end of the string ( $ -$> ) ~} variable $. ( $ -$> ) SYS Type the string at the top of the string stack ~} $< ( --> f ) SYS Compare the top two strings on the string stack and return true if $1 < $~}2 ( $1 $2 -$> ) $= ( --> f ) SYS Compare the top two strings on the st~}ring stack and return true if $1 = $2 ( $1 $2 -$> ) $@ ( vaddr --> ) SYS F~}etch the string from the string variable, and place it on top of the string ( -$> $ ) ~} stack $COMPARE ( --> n ) SYS Compare the top two strings on top of the string stack. Ret~}urn 1, 0, -1 ( $1 $2 -$> ) $DROP ( $2 $1 -$> $2 ) SYS Drop top value from string~} stack $DUP ( $1 -$> $1 $1 ) SYS Duplicate the string at the top of the string stack $EXTRACT~} ( vaddr offset char SYS Extracts substrings from a string, starting at the offset within the string ~} --> offset true ) ( -$> wd ) looking for the next occurrence of the character. If there is another ~} --> false ) ( -$> ) of the character (or a substring between the offset and the end of the ~} string variable), then true is returned along with the new offset. Otherwise~} false is returned. This function is useful to extract words from a sen~ }tence $FETCH ( addr len --> ) SYS Fetch the string starting at the address, with its length as indi~!}cated, ( -$> $ ) and place it on the top of the string stack $FILL ( ~"}n c --> ) SYS Create a string at the top of the string stack which has n characters (c) ~#} ( -$> $ ) $LEN ( --> n ) SYS Return length of the string on top of the string stack $~$}P! ( --> ) SYS Reset string stack pointer $P@ ( --> n ) S~%}YS Returns value of string stack pointer $P2 ( --> n ) SYS Return the address of the 2n~&}d string on the string stack (the string below the top string) $STO~'}RE ( addr max --> actlen ) SYS Store the string on top of the string stack at the indicated address. The ~(} ( $ -$> ) string will be stored up to the indicated maximum, the actual length of the~)} string stored will be returned on top of the stack $SWAP (~*} $1 $2 -$> $2 $1 ) SYS Swap the top two strings on the string stack $VARFILL ( vaddr c --> ) ~+} SYS Fill the string variable with the character (c) $VARIABLE xx ( len --> ) SYS Creates a stri~,}ng variable with maximum length as indicated $VARLEN ( vaddr --> len ) SYS Return the length of the s~-}tring currently in the string variable $VARMAX ( vaddr --> max ) SYS Return the maximum string length~.} of the string variable *$* ( --> ) SYS Variable containing the size of the string stac~/}k (512 byte default)   ( --> ) SYS Variable containing the size of the string stac|# MesaForth 11/22/81 Page A-7 ATARI Input/Output(CIO) Function1}s~ #0 ( --> ) SYS Iocb offset for #0 #3 ( --> ) S2}YS Iocb offset for #3 #4 ( --> ) SYS Iocb offset for #4 #5 ( --> ) 3} SYS Iocb offset for #5 #6 ( --> ) SYS Iocb offset for #6 $FI4}LE ( --> addr ) SYS Makes the string at the top of the string stack into a file name (terminated5} ( $ -$> $+EOL ) by an EOL) and returns the starting address on top of the stack. This f6}ile name can now be used by CIO functions (OPEN, XIO) (STAT) 7} ( --> n ) ext Status of previous CIO call ?DISKERROR ( --> ) ext Aborts8} and prints an error message if the previous CIO operation had an error CLOSE ( iocb --> ) ext 9} Closes file using iocb GET ( iocb --> b ) ext Gets a single byte using the given iocb. Check:} (STAT) for End-Of-File GETBUF ( iocb addr len --> actlen ) ext Performs a get buffer operation using the indic;}ated iocb. The buffer starts at the indicated address and has the indi<}cated length. The transfer will end when the buffer is full, or the en=}d-of-file is reached. The actual length of the data transferred will b>}e returned on the stack. GETREC ( iocb addr len --> actlen ) ext Same as GETBUF, except the transfer will be te?}rminated at an EOL (End Of Line). This is a get record operation J@}SRCIO ( iocb cmd --> ) ext Performs a call to the Operating System CIO routine. Iocb is the I/O ControA}l block offset and cmd is the CIO command code. The status is stored iB}n (STAT) NOTE ( iocb --> sector disp ) ext Notes position in disk file OPEN ( iocb aux1 aux2C} nameaddr ext Opens file using iocb, 2 auxilliary bytes (see CIO), and name (terminated by --> ) D} EOL) POINT ( iocb sector disp --> ) ext Points to position in disk file PUT E} ( iocb b --> ) ext Output a single byte using the iocb. PUTBUF ( iocb addr len --> ) F} ext Outputs the buffer using the iocb. The buffer starts at the indicated address G} and has the given length. PUTREC ( iocb addr len --> ) ext Outputs the record startiH}ng at the address, with given length. The record will be terminated byI} an EOL STATUS ( iocb --> status ) ext Performs a status I/O operation using given iocb XIO J} ( cmd iocb aux1 aux2 addr SYS Sames as BASIC XIO function. Calls CIO --> )   ATARIK} Forth File Functions~ $LOAD ( filespec -$> ) SYS Open the file as DR1, select DR1, and load the fL}ile (starting at screen 1) $SETDR0 ( filespec -$> ) SYS Open the file as DR0 $SETDR1 ( filM}espec -$> ) SYS Open the file as DR1 LOAD-ED ( --> ) SYS Load the screen ediN}tor from EDITOR.4TH LOAD-DOS ( --> ) SYS Load the DOS utilities from DOS.4TH LOAD-TURN O} ( --> ) SYS Load the turnkey software generator from TURNKEY.4TH TURNKEY ( filespec -$> P}) SYS Save the current loaded Forth words (including the entire Forth program, Q} but not including the DOS from DOS.SYS)  e Forth program, M MesaForth 11/22/81 Page A-8 General ATARI Input/Output FunctS}ions~ COLOR ( color --> ) SYS Selects color to use CVTSTK ( n1 --> n2 ) T} SYS Converts joystick value to a more usable number (0=nothing, 1=up, 2=up-right, U} 3=right, 4=down-right, 5=down, 6=down-left, 7=left, 8=up-left) DR. ( x y --> ) V} SYS Draws a line from the current position to the X-Y coord. GR. ( mode --> ) SYS OpensW} screen for graphics I/O using iocb #6 LOC. ( x y --> value ) SYS Sets the cursor to the X-Y coordX}. and determines the color of that point PL. ( x y --> ) SYS Sets the cursor to the X-Y cooY}rd. and plots the point POS. ( x y --> ) SYS Sets cursor to the X-Y coord. SE. Z} ( reg hue lum --> ) SYS Sets a color register to the indicated hue and luminosity SO. ( voice pitc[}h dist vol --> ) SYS Sets the voice to the desired pitch, distortion and volume STICK ( port --> ) \} SYS Reads the indicated joystick port (0,1,2,3) STRIG ( port --> f ) SYS Reads joystick ]}trigger port, returns true if trigger not pushed   ATARI Disk Handler Functions~ COPY ( --> ) ^} DISK Makes a bit copy of a disk from drive 1 to drive 2. It reports the status _} of each read and write on the screen. It will not abort if it should `} encounter read errors (say from a missing sector on the disk) DMP ( sector --> ) a} DISK Reads a disk sector into a buffer at hex 8000. It reads the sector from b} drive 2. The sector is then dumped to the screen GETSECTOR ( drive addr sector DISK Pec}rforms a get of the sector on the indicated disk drive (1,2,3,4). The --> status ) d}sector (128 bytes) will be read in starting at the address. The sector e} number (1 to 720) indicates the disk sector. The status of the read will f} be returned on the stack PUTSECTOR ( drive addr sector DISK Writes a sector to disk. Similar to GETSEg}CTOR --> status )   ATARI DOS Functions~ DELETE ( filespec -$> ) DOS h} Deletes the file(s). Warning there will be no confirmation like normal DOS DIR ( filespec -$> ) i} DOS Lists a directory of the given file(s) FORGET DOS ( --> ) DOS Used to forget DOS (aftj}er it has been loaded) LOCK ( filespec -$> ) DOS Locks the file(s) RENAME ( " Dn:file,k}file" -$> ) DOS Renames file(s) SCRCOPY ( strt end --> ) DOS Creates a new file, copying scrl}eens from the current file (DR0/DR1) to the ( filespec -$> ) new file UNLOCK m}( filespec -$> ) DOS Unlocks the file(s)  ec -$> ) new file UNLOCK F7/5cks the file(s)  ec -$> ) new file UNLOCK (*+UgANSFILESDRIVFILELINEPAGLINMAXCOCDATEBUFBADDTOBUPROCESSLINEOLCIOCIO2INDEBUFLEISTALENGINFp}ILOUTINOUTFILRDSUWRTSUPIXBUFHALFLINUNDERLINPIXSIZSTRTITALENDITALSTRTEXPENDEXPSTRTUNDERENDUNDERSTRTUNERADINVq}BLCENTERPICTLINEBELLSITALEITALSEXPEEXPPICTSTUNDPAGE@Ar} @s} !"#$%&t}'()*+,-./01234 Au}67B:,%@,.$9-@B:,6.7<,%4+6./ 9 @ 46.  @ 46.v}  @ 46.  @51!6-@56.>:@:,&A(,2 @9 w}6.6. #1+6.-/ 9 @ 6.   6.  $bcd""PRINT FILE(x}S) FROM W.P. DISKnRR;AP,;@,;AP,;@,;@,;B,;A,s6-@6-@y}t;@,6.>:AU,uhh;@,;@,;@,;@,;@,;@,;@,;@,z};@,v367@,.>:@',367@,.>:@R,w37@,.>:@',37@,.>:@S,x367@{},.>:@,37@,.>:@ ,y\67@,.>:@',,67@,.AD67@,.>:@,\67@,.>:|},z67@,.>:AU,{37@,.>:@',37@,.>:@P,|(6.>:@: ,%A(,(6.>:@$,}}~<<;@,;@,;@,;@,;@,N6.>:AS,!6.>:A',06.>:A&,?6.>:@(,N6~}.>:@),;@,6.>:@,(Drive # (1,2,3,4)55@*@*@*@A }&&(Enter file names, separated by++(#commas. If a file is to be printed((( in condensed print, enter a star}''(before the file name. Example:(CHAP1,CHAP2,*APPENDA(Enter your file(s)"(Enter date (mm/dd/yy})"0(Print picture(s) (Y/N),;@,0 ASET UP MX80, PROCESS ONE FILE AT A TIME64}A @&*@@&ASSUME 10 CPIJI7@<@,4*/*@@>6.7@,I16.7 CPITBU}ILD FILE NAME^ 6.D :h67@<@,.=:,4A57@<@,4,+6.7@,5 A}((67B:,%@,.7@<@,+B:,!@!6.7@,+ A0 6. A))PROCESS DOCU}MENT STARTING AT PAGE 1(6-(67B:,%@,..0006-%@ @67B:,,.=:,&&@}&67B:,&@,.=:,04 A*@@4 B5(:6-6.D BX PR}OCESS ONE LINE AT A TIMEb$ A@$ Bl'6-%@"@' A q&B:,"6.} & AvP7@<@,4$ A0PFIX CENTERING WITH DOUBLE SIZE CHARACTERSwI7@<@,4367@}<@,. IIGNORE PAGE COMMAND{JB:,!@64Y*7@<@,4!PICT=@ BJ AH6-}HINDICATE FIRST PASS THROUGH LINE, RESET UNDERLINE FLAG1 1PRINT LINE, HANDLING SPECIAL CHARACTERS"}AE6(@6. (6-6@, 26.6 Z(@6.ZFLUSH BUFFER EACH LINE (REMOVE THIS }LINE TO BUFFER ENTIRE PAGE) AEND OF FILE+(@+FLUSH BUFFER TO PRINTER4 @f%-%@}@f0(@4 @ A GET NEXT PAGE END OF DOCUMENT%@*( A}$$END OF FILE LIST, ALL FINISHED(DONE9*@@')*@@d9RESET PRINTER@}!!SET MX-80 TO CENTRONICS 737FOR ESCAPE CODES##@@P:(SET TO TOP OF FORM};@,$9*@@')*@@d9RESET PRINTER0( FINAL DRAFT10YA4F*@}@')*@@qFGO INTO DOUBLE STRIKE MODE5C*@@')*@@iCGO INTO EMPHASIZED M}ODE8$))SCAN FOR DATE ON FIRST LINE OF PAGEB:, @$-@B:,&@7<,0/A!}((7%@<%@,0/A!67&@<%@,. $4  00FIX CENTERING WITH DOUBLE WIDTH CHARAC}TERS 6-DOUBLE FLAG (6-(# OF DOUBLE SIZE CHARS -@B:, 7<,46- }!6-%@ 7<,46-@   "$ ;#-@+'@,%@;REMOVE LEADIN}G SPACES $7<,4 $67<,.>:,&  0 $'##PROCESS PICTURE STARTING WITH'LINE: !PICT=Dx:xxxxxx.xxx$}'$$NEXT 15 LINES OF DOCUMENT WILL.'BE IGNORED8'))@@7@,B' (@ FLUSH BUFFERP}'6-@$$AV'P*@@')*@@e<*@@PLINE SPACING TO 8`'9-@A}924 GRAPHIC LINES (8 DOT HIGH)j'7&(@ 7CENTER PICTUREt'-A@A@'n*}@@')*@@v<*@A@O*@n960 DOT GRAPHICS (240 BYTES)'@(}@' '(*@AU(CARRIAGE RETURN' 'S*@@')*@@e<*@@S}RESTORE LINE SPACING'@'(-@@$@( '6-%@6.'$ D2:PRINTERS|