INTRODUCTION Max-FORTH for the 68HC11 is a ROM based operating system and lan- guage. When combined with a 68HC11, whether in internal or exter- nal ROM, Max-FORTH creates a complete development enviroment. Max-FORTH programs can be written, tested and run under its con- trol. Although usual development configurations would include external RAM and mass storage (either on the 68HC11 system or on the host terminal), short programs can actually be developed on a 68HC11 system using Max-FORTH with no extra support (beyond XTAL cir- cuit, pull ups, power and serial I/O connections). Max-FORTH produces compact code that is suitable for ROMing or EEPROMing. Both "Headed" and "Target Compiled" code applications can be created. While the compiled programs may not execute as fast as well-written assembly language programs, they do compare favorably with the results from other compiled languages. They are usually more compact, more quickly written, and more easily tested in Max-FORTH's interactive programming environment. Max-FORTH closely follows the FORTH-83 Standard in order to be compatible with other FORTH's, also, to be easily supported, learned and used. In addition to the FORTH-83 Required Word Set, Max-FORTH also contains all the FORTH-83 Extension Word Sets, all the Controlled Reference Words and some of the Uncontrolled Reference Words. It also has many single chip specific exten- sions and operating system words not found in the standard. Max-FORTH is available in several versions: Version 1.0 is supplied in an external ROM for use on systems such as Motorola's EVB system or the New Micros, Inc. NMIX-0021 and NMIX-0022 single board computers. This version does not have an autostart capability. It is otherwise "full featured". Version 2.0 is also supplied in external ROM for use on the same type systems. This version will autostart a user program at any 1K boundry, or in the EEPROM. This version is suitable for volume production use under a license agreement. The license agreement requirements to acquire the Version 2.0 ROM's are, therefore, stricter than for Version 1.0. Version 2.0 is essen- tially identical to Version 3.0 which is supplied in the NMI F68HC11 MCU. Version 3.0 is supplied in the internal ROM of the NMI F68HC11 MCU. These chips are manufactured by Motorola for sale by New Micros, Inc. These chips will autostart a user program at any 1K boundry, or in the EEPROM and are suitable for volume produc- tion use under license agreement. Version 4.0, not yet released, will allow the user to target com- pile up to 5K bytes of program on a 3K byte Max-FORTH kernel, which may be submitted to Motorola for production as an internal single chip ROM code in the MC68HC11A8, under license agreement for the kernel with New Micros, Inc.. 1 This manual is suitable for use with Versions 1.0, 2.0 and 3.0. 2 GETTING STARTED In order to run the 68HC11 version of Max-FORTH, a working 68HC11 based hardware system is required. With Versions 1.0 and 2.0, this system can be a Motorola EVB, a New Micros, Inc. NMIX-0021/22/23 or similar single board level computer system. The Max-FORTH ROM needs to be installed in the $E000 - $FFFF portion of the memory map. The MODA and MODB pins on the 68HC11 need to be strapped high (i.e.: to VDD, usually through pullups) to put the chip in the expanded multi- plexed mode. The internal ROM, if any, must be disabled (EEPROM bit 1 of the CONFIG Register = 0), which may need to be accomplished on a Motorola EVM if not so set by the factory. With Version 3.0, this system can be a Motorola EVB or New Micros, Inc. NMIX-0021 or similar single board level computer system. The Max-FORTH is resident in the NMI 68HC11 MCU, which must be installed as the microprocessor of the board. Internally, the ROM occupies the $E000 - $FFFF portion of the memory map. The MODA and MODB pins on the 68HC11 can be: both strapped high (i.e.: to VDD) to put the chip in the expanded multiplexed mode or MODA strapped low and MODB strapped high to put the chip in the single chip mode. The internal ROM, which contains the Max-FORTH code, must NOT be disabled (EEPROM bit 1 of the CONFIG Register = 1), which may need to be accomplished on a Motorola EVM if acci- dently changed from factory setting. When the Max-FORTH ROM is properly installed in the memory map of the 68HC11, a reset will cause the FORTH system to take control. If there is no user program in external memory or the internal EEPROM, the outer interpreter of Max-FORTH will be entered. The start-up message "Max-FORTH Vx.x" will be sent out to the system serial com- munications interface at 9600 baud (that assumes an 8 MHz XTAL, 2 MHz internal operation) with 1 start, 8 data, and 1 stop bit. The system is now ready for input on the serial communications inter- face. At this point, entering WORDS followed by a carriage return will display all the words in the language in tabular form. (It is psychologically very reassuring, for some reason, to type in a few letters and watch the computer respond with pages of information. The long listing of words can be interrupted by pressing the any key... ) At this point, the entire language is running out of the internal 256 bytes of 68HC11 RAM. Because of this limited amount of RAM available, the amount of room for the Terminal Input Buffer and the dictionary is small. The Terminal Input Buffer is set to 16 charac- ters. The dictionary has room for only a few short definitions. The Data Stack is limited to 39 entries and the Return Stack to 28 words. Any or all of these RAM based areas may be moved to external locations to allow expansion. After they have been arranged to satisfaction, programming can begin. 3 USING THIS MANUAL Read what ever you want to. You don't have to read it in order either. 4 USING EXTERNAL MEMORY The internal RAM and EEPROM of the 68HC11 is limited. Many ap- plications will require more RAM for program development. Using a Terminal Input Buffer longer than 16 characters is also desire- able. The following brief listing moves the internal pointers for TIB , and the dictionary to use external memory. The input line is also extended to 80 (decimal) characters. If the RAM is installed at 0100-1FFF (factory default for single 8K RAM in the NMIX-0023) the following will accomplish that. HEX 100 TIB ! 50 TIB 2+ ! 200 DP ! In the next example, the memory is located at $C000 (as in the case with the Motorola EVB, and as can be set on the NMIX-0023 boards as well). PAD is moved as well. Other addresses for RAM could be accomodated by changing the listed $Cxxx constants ac- cordingly. HEX C004 1C ! ( TIB MOVE ) 50 1E ! ( C/L CHANGE ) C060 22 ! ( PAD MOVE ) FORGET TASK C080 DP ! ( DICTIONARY MOVE ) Note that the first four locations at $C000 are left unassigned so that an autostart pattern can be placed there ($C000 is a 1K boundary) after the program is complete. If a Battery RAM were used in that socket, the program would be saved through power down. If autostarting is not done, the address of the main routine to be run can be EXECUTE'ed from the terminal, or it can be run by its name if the dictionary pointers are intact. To be able to use the Battery RAM words' heads, the USER area must be battery backed, otherwise, the dictionary pointers must be relinked. If the program is ROM'ed later, it should allow for the locations $C004 through $C080 to become "unwritable". Ofcourse applications that will have one RAM for variables and one RAM that will be later ROM'ed will probably assigned TIB to the low RAM with other variables (see Preparing a Program for ROM) and the Dictionary Pointer to the high RAM. The USER area can also be moved to give more room in the data stack, although, it is not normally necessary to do so. 5 AFTER THE CRASH You may occasionally experience a system crash, from which it is difficult to recover. A simple reset may give you a Max-FORTH Vx.x prompt and a carriage return may even give you an "OK", however, Max-FORTH doesn't seem to understand anything typed in that's over 1 character long. (A no Max-FORTH prompt condition probably means an autostart problem or hardware failure.) This is usually the result of a blown dictionary link. If the linked list of the dictionary is opened (ie: one of the link fields is erased, written over, badly manipulated, etc.), Max- FORTH will accept your input and then go on a wild goose chase looking for a match with your word all over memory until it finds a $0000 in a link field which indicates "end of dictionary" (which, coincidentally, may never be found). It will either lock up or echo the entry with a question mark. This can be simulated by doing: 0 LATEST PFAPTR LFA ! . You might want to wait a minute before you try this, however, until you know how to recover ... Another problem can be experienced when the dictionary pointer gets out of RAM if, for instance, you did a HEX E000 DP ! (which puts the dictionary pointer in ROM). The problem is that the outer interpreter takes your input line in TIB and parses a word at a time out of it. It moves the parsed word to HERE which is an exceptionally bad idea if DP is in ROM. ROM is funny that way, no matter what you write to it, it never takes it. When the dictionary search compares the dictionary list with the word at HERE , the result has nothing to do with the characters (and num- ber of them) of word you typed in. It prints junk and a question mark. A similar thing can happen if a word is moved to EEPROM with EEWORD and then forgotten. Guess where DP ends up? Putting a bad value in UP can be interesting. Changing UEMIT or UKEY to some erroneous values can have some extremely quiet results, too. If any of the above conditions occur, the only way to recover is to power down and re-power or to force a cold reset. A -G key combination in the Serial Communications Interface input register will force a cold reset. (-G is the ASCII "BELL" character, $07 hex.) By entering the -G and hitting reset again, one should recover from any badly modified variable, blown dictionary links, crashed processor, etc. problems. A bad autostart, however, can only be rectified by disabling the offending memory device. If the autostart pattern is in the part's EEPROM, it may be erased using a Motorola EVM for recovery. 6 TOUR OF THE 68HC11 Max-FORTH MEMORY MAP A first step in preparing to use a dedicated computer system is to learn the system's memory map. This is an easy task with the use of the Max-FORTH DUMP command. Remember that DUMP displays one or more lines each containing 16 memory locations (8 words) which are most easily read when in hex mode, so begin by entering HEX . Starting in low memory, examine the contents of the first three words (six memory locations --- one byte or two hex digits per location which means two locations per word) by entering 0 6 DUMP . (This displays a full dump-line of 16 memory locations --- 8 words, $0000-$000F. Leading zeros at each location are not displayed.) Examine the first three words ($0000-$0006), ignor- ing the others for the moment. From the manual's Appendix ???, it is seen that these locations contain the system variables of Max-FORTH, namely: W (Word Pointer, $0000-$0001) IP (Instruction Pointer, $0002-$0003); and UP (User Pointer, $0004-$0005). Any two bytes of memory reserved to hold only the address of a particular item (word, block, stack, etc.) is refered to as a pointer. Thus, W and IP are pointers whose contents change every time FORTH executes a new definition. Programmers rarely have need to use W or IP . Advanced programmers might use them in code level definitions when making multitaskers, etc.. UP points to the USER area. By modifying UP to point to another area, the values that user variables return will be a different set. This again is useful in multitaskers. Be sure that the new USER area is initialized with its set of values before changing UP to point to it, otherwise, the systems will crash and be dif- ficult to recover. It is worth mentioning that if you ex- perience a system crash from which it is difficult to recover with a simple reset, a -G key combination in the Serial Communications Interface input register will force a cold reset. (-G is the ASCII "BELL" character, $07 hex.) By entering -G and hitting reset again, you should recover from any badly modified variable, blown dictionary links, crashed processor, or similar problems. A bad autostart, however, can only be rectified by removing or disa- bling the offending memory device. Notice that UP points to the current USER memory area starting at $0006. To examine this area, enter 6 74 DUMP . The first four words ($0006, $0008, $000A and $000C) are zero'ed by the cold 7 download. They represent DNLINK , UPLINK , PRIORITY and RPSAVE which are user variables reserved for multitasking. These vari- ables are not used by the Version 1.0 Max-FORTH implementation. The following two words ($000E and $0010) are the default stack values, R0 and S0, assigned by ABORT . They can be modified to point into RAM if larger stack areas are desired. They will not be put into effect until ABORT is executed. Normally, the stacks should stay in internal RAM. TIB , PAD and the dictionary areas can be moved to external RAM which will allow room for 28 Return Stack words and 39 Data Stack words. The next two word locations ($0012 and $0014), KEY-CB-PTR and EMIT-CB-PTR, point to control blocks that determine how the built-in I/O routines work. Alternate control blocks can be con- structed to handle alternate I/O devices without modifying the I/O routines. Each control blocks are six bytes long and con- tains the following: 1) a two-byte address of the I/O device status register to be read, 2) a one-byte mask with which the status value read will be AND'ed to screen out extraneous bits, 3) a one-byte mask with which the AND'ed result will be XOR'ed to obtain a non-zero result when the device is ready for trans- fer, and 4) a two-byte address of the I/O device data register. These pointers (KEY-CB-PTR and the EMIT-CB-PTR) are initialized to point to the beginning of the default Serial Communications Interface control blocks. The pointer can be modified to point to control blocks that handle LCD displays and keypad controllers or alternate serial chips, etc. to redirect system I/O. The next three word locations ($0016, $0018 and $001A) are the actual machine level vectors to the I/O subroutines that provide the functions mentioned above. If a control block solution is not sufficient, you may write your own machine code subroutine. Its address is installed in UKEY , UEMIT or U?TERMINAL as ap- propriate. Following is the pointer (at $001C) to the Terminal Input Buffer, TIB, and normally contains an address pointing to the RAM just beyond the bottom of the Return Stack. It is limited by UC/L ($001E) to 16 characters. TIB can be moved to external RAM and made larger by modifying these USER variables. The USER variable which indicates that a COLD reset has been per- formed is called CLD/WRM ($0020). As long as it contains a $A55A pattern and there is no -R in the SCI, the system will not do a cold download of system variables at every reset. PAD in most FORTH systems is a fixed distance above the diction- ary pointer, but in Max-FORTH that would be impossible with the limited internal RAM, so PAD is restricted to be at a "fixed" location, which can be "moved" by changing UPAD ($0022). Since 8 the user may work "above" PAD with temporary variables and the system works "below" PAD when doing output number conversions, ensure that PAD has free RAM on both sides of its new setting. BASE , the current number base, is kept in the next location ($0024) and performs as per most other FORTH's. The next location ($0026) is used in conjunction with the Timer Output Capture 5 in EEPROM programming words to time the number of cycles to program the EEPROM. It is called C/10MS for "Cycles Per 10 Milliseconds delay". You should decrease this value from the default decimal value of 20000 if your system has a clock slower than 2 Mhz. The line termination character can be changed from a carriage return to any other character by modification of the next loca- tion ($0028). Similarly, the backspace character can be changed from a backspace to a delete by modifying the following location ($002A). The Dictionary Pointer, DP , and the heads dictionary pointer fol- low ($002C and $002E). The location after them ($0030) is the EEPROM dictionary usage pointer that is added to when a word is moved into EEPROM with EEWORD . The flag that controls header- less code generation follows ($0032). Additional standard FORTH USER definitions follow ($0034 through $0070). Following are four USER variable locations ($0072, $0074, $0076 and $0078) which are reserved for mass storage re- quirements. Only the first location ($0072) has any reference in the internal code. It is used to set the base address of the RAMDSK mass storage simulator. To use RAMDSK, which is pointed to by the default setting of UR/W ($0056), set the first location to the base address of free RAM (ie: C400 72 ! ) and clear the buffers (which are at default locations $D7FC through $E000 ) (ie: EMPTY-BUFFERS ). The RAM screens can then be listed, loaded and saved, etc.. This ends the USER area while the default location of the diction- ary begins at $007A. When a cold reset occurs, TASK is moved to the beginning of the dictionary. New entries in the dictionary will build up from TASK ($0083 and up). The Data Stack is above the dictionary. It grows down as more entries are added ($00C7 and down). There aren't many locations between the dictionary and the stack, so some care should be exer- cised. Needless to say, running the stack into the dictionary or vice versa is a very bad idea. The dictionary can be moved after a cold reset simply by forget- ing task and storing the address of the new dictionary RAM in DP (ie: FORGET TASK HEX C004 DP ! ). The area immediately above the data stack ($00C8 down from $00CF) is used by the system numeric output routines. The usage builds down from just below PAD until the number of output characters for a given print or "dot word" is reached. (Note: only 8 digit 9 numbers are provided for in the default setting.) (The two lowest locations are used as "secret" storage places for the set- tings of BLK ($00C8) and >IN ($00CA) after an error message is generated so you can look up the location of the error on mass storage after the crash. Better get them before you print any numbers after a crash... ) The beginning of TIB and PAD are both at the same location ($00D0), the idea is to prevent PAD from being used in internal RAM if TIB is in use. Sixteen bytes are reserved for TIB ($00D0 through $00DF). The Return Stack occupies the upper end of internal RAM ($00E0 through $00FF). The next location of interest in the 68HC11 map is the first loca- tion that an autostart pattern can be located ($0400). Versions 2.0 and greater do autostart pattern searches in EEPROM and then on every 1K boundary starting there and on. Since reset puts the register block of the 68HC11 at $1000 in the "middle of things", the Max-FORTH V1.0 operating system moves them to $9000. The Max-FORTH V2.3 and 3.3 operating system move them to $B000. (Originally, it was intended to put them at $B000, but the EVB has a special write latch from $A000 to $BFFF that precluded proper functioning there. References to the register block at $B000 often shut off the serial channel on the EVB. Later versions of the EVB were changed to correct the oversight.) The write that moves the register block will still affect external memory when the move is performed, so, always watch out for location $103D which will have $09 or $0B stored into it with every reset. The registers are moved into $9000 to $903F for version V1.0 and $B000 for versions V2.3 and V3.3. See the later section on programming the I/O or the appropriate Motorola documentation for their description. To look at them enter 9000 40 DUMP or B000 40 DUMP. The EEPROM is the next natural occurrence in the memory map ($B600 through $B7FF). The first word location ($B600) may hold the autostart pattern. This location is the first high level autostart location checked after power up. If the first location is the autostart pattern, the next ($B602) is the address of the CFA (code field address) of the word to be autostarted. If inter- rupts are not used, the next 247 bytes of EEPROM are unassigned. If interrupts are to be used, the particular interrupt enable must have a machine code program at its EEPROM target location. Starting at location $B7BF and thereafter for each interrupt vec- tor in ROM, three bytes are reserved. They will normally contain a jump instruction to another portion of memory which performs the appropriate interrupt function. It can return to the inter- rupted program by doing an RTI at its completion. At the very end of EEPROM, a word location ($B7FE) is checked by the reset routine for an autostart pattern which means that there is a machine code instruction in the previous three bytes ($B7FB) to be executed at power up before the write-once-only registers are modified. If that autostart pattern is present, the system jumps to subroutine to the code address. It will normally con- 10 tain a jump instruction to another portion of memory which sets the OPTIONS and INIT registers as desired. It can reenter the start up procedures by doing an RTS at it completion. To look at the EEPROM enter B600 200 DUMP . (On the Motorola EVB the area from $C000 to $DFFF is RAM. This can be used for mass storage buffers and screens, or program space or for TIB and PAD etc.) The Max-FORTH ROM runs from $E000 through $FFFF and contains the heads of Max-FORTH, followed by non-runtime words, followed by the runtime kernel. The DUMP command can be used to explore any portion of the ROM. It will be noted that the heads are made up mostly of ASCII characters and pointers. The non runtime codes are mostly pointers. The runtime codes are a mix of pointers, machine code and miscellaneous tables, etc.. 11 DOWNLOADING SOURCE CODE Development with the Max-FORTH system will normally be done using a host computer. (One alternative would be to add sufficient RAM and use the internal RAMDSK. Another alternative would be hook- ing up mass storage to the system and writing a user mass storage handler that would replace RAMDSK in the USER variable UR/W. Either method requires you to live with the limited FORTH line editors available or to write your own.) Source code text can be edited on a host PC with a familiar editor. The code can be down loaded and tested a portion at a time using a communications package. This can be continued until the program is complete. PC's are usually graced with printer, etc., so all in all, using a PC as a host can save development time. Any editor that produces an ASCII text file (ie: non-document mode) should be suitable. Communications packages should be able to handle 9600 baud transfers (or you have to run the XTAL slower) and should have file send and capture capabilities. The file send program should have a wait-for-echo'ed-character setting and a wait-at-end-of-line-for-return-character. The character to be waited for at the end of line should be a LINE FEED, ASCII $0A ( -J ). In Microstuff's Crosstalk these settings are the CWait Echo and LWait CHaracter '^J' . With those settings, a smooth down load of a code file by the SEnd command should be possible. Be sure to watch the down load as it occurs to spot any error mes- sages returned from the Max-FORTH system. 12 A BEGINNING FORTH TUTORIAL What Makes FORTH Different ? Most high level languages are very similar in nature. Since there were some applications where one programming language was inefficient, another language was written based on a new set of routines. Until FORTH, there was very little "new under the sun". There are two basic types of high level languages: compilers and interpreters. Although most languages are usually available as only one or the other type, there is no other reason a version of any language could be written as either. A compiler is a program that translates source code from a predefined file into its machine equivalent. Actually the output of a compiler may be machine code or assembly language to be further assembled to machine code. If a program had errors or did not work as desired, the programmer must re-edit the source file and again run the compilation process. An interpreter is usually more interactive, meaning it responds to the user. There are usually two distinct modes associated with an interpreter - the entry mode and run mode. In the entry mode, the programmer edits and prepares the program for execu- tion. When the run mode is entered, each line is translated into machine code routines and is executed as encountered. There is usually no intermediate step of compilation to machine code. Each line is translated and executed as a single action. The ad- vantage of an interpreter is that it is very user friendly, which makes it easy to use. The disadvantage is that it runs very slowly when compared to a compiled program. Despite the fact of whether a language is an interpreter or com- piler, most languages work in quite the same way. Their struc- ture is nearly identical in philosophy to that of straight line assembly code. The language allows for a fixed set of functions in the language just as the machine has a fixed number of instruc- tion in its instruction set. To solve this problem, the program- mer must list a sequence of these functions to be performed. The solution is defined in terms of the functions available. FORTH is a truly unique language. Programming in FORTH is quite conceptually different from using other languages. Making a long list of functions to be performed is not the usual programming method. Instead, new functions are defined based on other previ- ously defined functions. In turn, higher level functions can be defined using the new definitions just added. The language it- self is expanded and modified. In this way, the programming lan- guage FORTH might be more accurately called a programmable programing language. It is difficult to classify FORTH based on previous guidelines. Neither "interpreter" nor "compiler" can accurately describe the nature of FORTH. While FORTH has elements of being an inter- preter, it can also be argued that it's a compiler. It is often described as an interactive compiler or compiling interpreter, 13 the later probably being most accurate. FORTH has an interactive interpreter which acts like a conventional interpreter in entry mode. New definitions (called "words") can be entered in the same manner as code would be entered into an interpreter. These words can be directly entered at the system terminal and run as commands or be used in new definitions. It is difficult, there- fore, to distinguish between the entry mode and the run mode. FORTH's unique structure allows for some of the best of both worlds. FORTH runs fast during execution. It is therefore com- parable to compiled languages. On the other hand, FORTH is very user friendly and resembles an interpretive language. Because of FORTH's unique structure of programmability it is easier and, thereby, quicker to program and test applications in, than either type of previous category of languages. This new concept in programming gives FORTH an unusually wide range of applications as compared with conventional languages. The FORTH instruction set is open ended. The intent is to give the programmer not just a set of function to use but also the tools to create new functions, in fact any functions desired, in- stead. FORTH was developed by an individual (Charles Moore) in the early 70's. He found himself in the position of having a whole com- puter to his use to do a real time task. He found that conven- tional languages restricted his access to the machine to the point that they were unusable. Using a different set of base premises, he created a new language over the course of several years that was tailored to the new system requirement. How Does One Uses FORTH ? Like other user friendly interpreters FORTH is easy to get started with. You sit down at the terminal of a FORTH computer and use it as a calculator or type in a string of commands. When FORTH is done interpreting what was on the line you typed in, it says "OK" and waits for another line. FORTH is a very format free language with a minimum of restric- tion. Classification of what things can be typed in the input stream is fairly simple. Inputs can only be two things. The first are commands called "words" that have predefined meanings (a few words require inputs following them, which are strings). The other possible items entered are numbers. So with this limitation of using only words and numbers, all of FORTH can be used. The most pressing requirement in successfully typing in commands to be interpreted by FORTH is the correct use of delimiters. Most other languages have so few commands that the allowed com- mands can easily be picked out of the input stream, even in a long and run-together line of typed characters. They also often use special rules and conventions for naming words (ie: variables). The requirement that names begin with an alpha character and contain only alpha-numerics is almost a universal requirement for other high level languages. Some languages re- 14 quire even more difficult conventions, such as variables be in capital letters and constants in lower case, or special charac- ters, like "$" to indicate a string variable, etc.. FORTH re- quires each word or number entered to be separated from others around it by delimiting characters. At least one delimiting character must intervene between each unique entry and the next, but use of more than one is not prohibited. FORTH recognizes blanks as delimiting characters. (thisisratheraconvenientconventiontakenfromenglish.onemustwonder- whyotherlanguagesletallinputtoberuntogether.) By virtue of this unique, but very simple requirement, FORTH words can use any characters as part of their names. Only blanks, backspaces and null characters can not to be used in a words name. Extremely useful names can be given to words on this basis. The name of the subtraction function can be therefore be written as - and the operation that prints a title as ." and the operation that indicates the compiler should continue on the next screen of text as --> . Since FORTH allows you to define new words to those already in the language as you program, the same opportunities are yours. Very meaningful names can be assigned to newly defined functions. FORTH allows up to 31 characters to be used in naming words. Names such as CALCULATE-NET-PROFIT*%OF-RETURN are not only pos- sible, but add a great deal of meaning to the program to casual readers. Without forcing such liberal use of the keyboard, FORTH would equally as well deal with words named A, B or C. These simple rules suffice for all the syntax required by a FORTH system. Anything typed into FORTH to interpret must either be a word (a word may be followed by a string as required by its definition) or a number. Anything else will cause an error. Each item must be separated from another by at least one space. Names of words can be any character except a space, a backspace, a null character, and of course, a carriage return which is used to ter- minate (enter) a line typed into FORTH. How Much is There to FORTH ? As with any language, the most difficult part of using it is learning it. Unlike other computer languages such as BASIC, which has a few functions (or operators) and lots of syntax rules, there are many functions built into FORTH, and just a little syntax (which you just learned). These functions are the building blocks which you must use to solve your programming problem. With BASIC it is fairly easy to look at a list of valid commands, picking a few to start with, learn what are valid names for vari- ables, acquire a very basic understanding of syntax and how line numbers work, and then begin programming. The effective range of program solutions based on such a brief exposure is, to say the least, quite limited. The key how to do more in BASIC is by not only recognizing the command words and understanding their pur- pose, but also in understanding some very complex relational ef- fects and detailed syntactical rules. Learning the commands and their purpose is not extremely difficult because of their small 15 numbers (usually 15 to 40 depending on the level of implementa- tion or version). Learning a new syntactical set of rules for each command is difficult. For instance, the operator + (plus) in BASIC may be used to calculate the sum of two variables or terms in an equation giving a numerical result. This same operator may also be used to append one string of characters to another. Whether this operator has other uses and effects, using it to add a variable to a string can be quite another problem. The answer to these questions varies from BASIC to BASIC depend- ing on the attittudes of the programmer who implemented it. The more "powerful" the BASIC, the more "complex" the syntax. With the exception of the brief rules mentioned in the earlier section, FORTH is nearly syntax free. Inputs are words (and their strings) and numbers. There is no particular requirement that a word be on one line, or the next. Words are executed in their order of entry. Little else in the way of format is re- quired. So if syntax is not a great problem, what is necessary to learn FORTH? Although each word has a fairly distinct unique action, there are many words to learn, over 200 in most FORTH im- plementation. It is difficult to directly relate word count to language "power" but it is probably correct to say: the more "fully developed" the FORTH, the greater the number of words. Then the opposite of BASIC is true of FORTH, after a few basic principles are learned about the language you must learn more words rather than more syntax. This way, the learning of FORTH is much more akin to a language like French, a few basic words from the language must be known and a few rules learned about using them. This is enough to get by. More words must be under- stood to become fluent in the language. FORTH words can be likened to verbs. They represent the actions, the functions to be performed. Numbers and strings are similar to nouns. They usually indicate where the action of the words will be directed. There are, of course, words that you may never need to learn. The same is true of French. There are details of any language in which only scholars find interest. There are primitive words in FORTH which only those most curious about FORTH's structure bother to learn. Some areas of programming may be of no par- ticular applicability in another discipline. Output formatting may be of no use to a programmer doing real time process control. There would be no more use in a detailed study of formatting for him than would the French word for "polar bear" to someone who never speaks of animals. One of the largest differences between FORTH and conventional lan- guages is the handling of temporary data storage. Almost all con- temporary languages use variables. FORTH uses a data stack. Using the stack is simple and a major part of FORTH fundamentals. Unfortunately, many new students of FORTH, who have programmed in other high level languages before, decide that the stack hinders their efforts to ever successfully use FORTH. Beginning program- mers often adapt to stack based operations more quickly than ex- perienced programmers because they have not learned prejudices based on variable based languages. A brief look of the begin- nings of the two philosophies may be of benefit. 16 Many of the basic computing concepts came from the days of cal- culators. Most calculations are performed one step at a time. With standard four function calculators there are only two num- bers, the last result and the number now being entered. (More advanced calculators have a memory for temporary storage of results.) In this way, one result can be held while another is entered. Then the two can be operated on together. This is the point at which the two philosophies split. If more than one memory and one entry are to be maintained, there are two ways to handle it. Either each memory locations can be given names (i.e., 1, 2, 3, ... or A, B, C etc.) or the entire memory can be treated as a single sequential file. With the latter method, if two memory locations are in use and another is needed, the third location is automatically selected. If contents from two memory locations are to be taken, the contents of the third and then the second locations are retrieved. The second location is now available for use again. Both methods are widely used by calculator manufacturers today. The first method (widely used by Texas Instrument) is closest in format to the teaching of modern algebra. Unknown or temporary values are given names. By using mid-fix notation, calculations bear a strong resemblance to algebraic statements, i.e., to solve A = B + C the following entries would by made : B + C = . This result is displayed on the calculator (instead of being assigned to A). Assignments to B and C would already have been assigned values. The more complex equation A = (B + C) * (D + E) requires parenthesis to indicate the correct precedence of operation. The second method (extensively used by Hewlett-Packard) is more difficult to give examples for, since quantities go without names, but are ordered by time and level of entry. Although mid- fix operators and even prefix notation (called Reverse Polish Notation) are possible with this method, the most commonly used is post fix notation (sometimes called Reverse Polish Notation or RPN). To illustrate the first example given for the algebraic method, you will have to imagine that the results B and C are already in the first and second sequence memory locations. To add them only the entry of + is required, since + always adds the last two numbers entered, or "on the top of the stack". To il- lustrate the more complex example a method of entering numbers into memory locations is necessary. For the purpose of this ex- ample merely stating the number will enter it into the next avail- able memory location. Instead of using actual numbers, we will use substitute names. Remember these names are substitutes for the numbers, not the memory location that the numbers go in. En- tering B C + carriage return (ret for short) would put the number " B " in the first memory location. " C " would follow in the next. The + would add the top two numbers on the stack, " B " and " C " , and place the result in the now unused first location. Further entry of D E + ret 17 would store " D " in the open second location and " E " in the third with the " + " operator completing the addition. The result is stored in the once again vacant second location. Finally, entry of * would multiply the two temporary results together (again these are the top two on the stack) and leave the results in the first location. The total entry was B C + D E + * No parentheses were required because the stack of memory loca- tions itself provided for even the machines temporary results. This is the total complexity of the stack. If the previous ex- ample can be understood, FORTH stack operation can be under- stood. FORTH uses a data stack and RPN almost exclusively for all operations. Variables and constants are provided in FORTH for your use but are for storage of a more permanent nature. Tem- porary storage using the stack is much more efficient. By using post fixed notation (RPN) there is no ambiguity concerning priority of operations, without the use of cumbersome nested parenthesis. In summary, in learning FORTH you must first understand a little syntax, a little about stack operations and quite a few words. With over 200 words, there must be at least 2000 ways of grouping them into categories. In order to allow you to start learning FORTH quickly, the first group to be presented to you in this book will be the basic words. As they are mastered, later chap- ters will include more words until all have been presented. Beginning Words Almost all computer courses at one point or another list the major parts of a computer as being input, output, the central processor and memory. In previous discussion, the method of en- tering words and numbers in the input stream, separated by spaces, was explained. It is fitting, then, that the first word to be decribed is . (pronounced as "dot"). This word is an important FORTH word used to output a numerical value. When the dot word is executed by the interpreter, the last number entered or calculated will be output. Although the computer works only in binary, the number will be printed in the current number base. When your FORTH system is first turned on, the num- bering system will be base 10 or decimal. That means that the numbers will be accepted as inputs or printed as outputs like com- mon decimal numbers. Later you will learn how to change the base so input and output can be in other bases. It is possible to use binary, octal, hexadecimal and many other number based systems. Once the . is executed, the number that is printed is no longer in memory. It has been taken off the stack. To try an example of using . try the following. Enter 5 . ret 18 After the return is entered, FORTH begins interpreting the line looking for words and numbers. When the 5 is encountered, FORTH picks it out of the input buffer and puts it in a temporary loca- tion. There, it will be compared to all the names in FORTH's en- tire dictionary of names. When no match can be found for it, FORTH assumes it to be a number and tries to convert the current number base to binary. This is possible with the 5 entered. If the entry was not a valid entry, FORTH would give an error and wait for a new line of input. Once converted to binary, the 5 is placed on the top of the stack, the first available location in the temporary data file. No further action is required for num- bers. The interpreter continues to process the line. FORTH next picks up the . and searches the dictionary for a match. A match is found and the interpreter turns execution control over to the in- structions that make the . function. As described, this word finds the top value on the stack and converts that binary number into an output. The location on the stack is now free again for further use. The result of the example is as follows: 5 . 5 OK After the . returns control to the interpreter, the result of the carriage return will be processed. Since that indicates the end of the line of entry, FORTH puts up the message OK . The purpose of this message is to inform you that the previous com- mands have been completed successfully. FORTH is ready for another line of input. Now try a longer line of input. Enter the following: 5 . 6 . 7 . ret the interpreter will process this line by entering the 5 on the stack and then printing it. Then the 6 and printing it and finally the 7, likewise. The result looks like this: 5 . 6 . 7 . 5 6 7 OK Note that no more than one location is used on the stack. Each number is entered on the stack and immediately output before the next is added. Note also that no action is taken by the inter- preter until the ret is entered. Changing the order will change the action taken. To illustrate, try the following: 5 6 7 . . . ret The 5, 6 and 7 go on the stack in order. The 7 is on the top. When the first . is executed 7 is output since it is on top. The next . removes and prints the 6 . The last . prints the 5 and the stack is empty. If all three . had not been used, the numbers would have been left on the stack. For instance, 5 6 7 . ret 19 would show 5 6 7 . 7 OK As a result, a later entry of . ret would draw the 6 out of the stack and show . 6 OK The 5 will remain on the stack until used or an error clears the remaining numbers from the stack. Another word which would be useful to learn now is .S . This word not only outputs the value of the top number on the stack but all other numbers on the stack as well. Unlike . , it only copies the value on the stack which is not removed. This command is sometimes likened to a snapshot because a non-destructive print of the content of the stack is made. Entering .S ret will show .S 5 OK The 5 was left on the stack from the last example. Now enter a word that is not in the dictionary. If it is not a number, it will cause an error. QWERTY ret FORTH will respond with QWERTY QWERTY ? meaning that the word entered was neither a valid word nor num- ber. Now use the .S word. The stack was emptied when the error was encountered and the 5 typed earlier is now lost. The .S word is a very useful diagnostic tool. To try one more example with it, enter 5 6 .S ret and check the result: 5 6 .S 6 5 OK The 5 and 6 are still on the stack and can be further manipulated by other words or printed using . words. Now that you have learned how to input and output numbers, it is time to learn something to do with them. One of the nicer fea- tures of FORTH is the interactive way that computations can be done. In the last example, a 5 and a 6 were left on the stack. 20 We could cause the sum of those two numbers to be computed by en- tering the + word. The action taken by + when executed is to pick the top word from the stack and add it to the second number down. Like the . , when + word uses numbers from the stack, they are removed. The result of the addition after computation is put in temporary storage for further use. It is the new top number on the stack. The . word entered now will cause the result to be printed. The response should be like this: + . 11 OK To try another example, enter the following: 2 3 4 .S ret shows 2 3 4 .S 4 3 2 OK This action entered three numbers on the stack and then displayed them. These numbers are still on the stack since the .S does not remove them. It will take two + words to add the three numbers. + + . ret shows + + . 9 OK The execution of the first + adds the top number, 4, to the second number, 3, from the stack. Three numbers were on the stack. When the + returns its resulting value (7) to the stack there are two left. The second + causes the two values left on the stack (2 and 7) to be added and the result (9) returned to the stack. The result is the final remaining value, the only num- ber on the stack. It is, of course, the top number on the stack which the . caused to be printed. The stack is then empty. It is important to remember that FORTH can only recognize words if they are separated from other words and numbers by spaces (delimiters). If there are no spaces, FORTH will try to make a single word out of the entry. For instance, 5 6+ ret as an entry would give an error. FORTH look for a word named 6+ in the dictionary. When it cannot be found, FORTH will try to convert 6+ into a number which will also fail. The order in which numbers are entered on the stack makes no dif- ference in the result of an addition. This is because of commuta- tive property of addition. The operation of 6 2 + . will produce the same answer as 2 6 + . which is 8. The same is not true of all operations. The next word to be learned is logically, -. The word that al- lows subtraction operations to be performed. The commutative property does not apply to subtraction, therefore, 6 2 - . will give a result different from 2 6 - . . The function performed 21 by - is to subtract the top number on the stack from the second number on the stack. The process removes both numbers from the stack and returns the resulting value as the new top of stack. The result of 6 4 - . ret is 6 4 - . 2 OK written algebraically, the calculation would look like this: 6 - 4 = 2 An easy way to remember the order of operation is to visualize the two numbers to be operated on in relationship to the stack. Although they could have been computed or manipulated by earlier operation, imagine you just entered them by hand. Since we write left to right, imagine the stack contents displayed with the left side being the deepest or earliest entry and the right side the latest. To understand what the operator will do, imagine the two numbers (written as you would enter them) with the operator be- tween the two numbers. As an example, if the 6 is on the second number down (meaning it went on first, then became second) and the 4 is on the top of the stack, you should be able to envision the problem in algebraic format like this: 6 - 4 . This method of visualizing the numbers from the stack and the operator between them will help you to understand how - works as well as all other two number operators, all the math related words and relational operators that compare values. While multiplication is a function which is covered by the com- mutative law, division is not. The word to cause the the second number on the stack to be multiplied by the top number is * . The word / causes the second word on the stack to be divided by the top number on the stack. Just as with addition, there is no difference between the results of 2 3 * and 3 2 * . In algebraic notation, these two equations look like this 2 x 3 = 6 and 3 x 2 = 6 Again, to translate from RPN notation to algebraic, imagine the operator to be between the second and top value from the stack in that order. In the case of division, the order of the two numbers on the stack determines which number is the divisor and which is the dividend. There is indeed a difference in the result between 24 6 / and 6 24 / . The division word, / , will cause the top number to be divided into the second number on the stack. That is, the top number is the divisor. The two numbers are removed from the stack, the quotient is left on the top of the stack in their place. There will, of course, be occasions when numbers on the stack will be in the wrong order. For instance: in a lengthy calcula- tion, an intermediate value may already be on the stack. To find 22 the final value that result must be divided into 100 . Entering 100 / . will not give the correct answer. The value would be divided by 100 rather than into 100. A correct result can be ob- tained by printing the intermediate value and entering 100 and then reentering the printed value and doing the division. This, however, is not a very reasonable approach. Fortunately, there is a handy word available in FORTH to manage such problems. The word is SWAP . The execution of SWAP causes the top value n on the stack to be "swapped" with the second value on the stack. The old top value becomes the second value and vice versa. In the example, the solution to divide the inter- mediate value into 100 looks like this 100 SWAP / . ret Words such as SWAP are called stack management words because their entire functions deal with "grooming" the stack. Another important word in stack management is DUP . This word is used to duplicate the top of stack and places that value on the new top of the stack. The original value is the second number on the stack and its copy is the new top value. The two numbers are ex- actly identical. This is very useful when it is necessary to use a copy of a number to be printed, displayed or used in further calculation. The copy will be used for the operation rather than the original value which remains ready for further use on the stack. There are occasions when excess values are left on the stack by operations. These unwanted leftovers can be removed from the stack by the word DROP . To see how these stack management words work, try the following. Enter 2 3 4 .S ret which will display 2 3 4 .S 4 3 2 OK these numbers are still on the stack, now enter SWAP .S ret which displays SWAP .S 3 4 2 OK Note that the position of the top number and second number have changed. Now type DUP .S ret which displays DUP .S 3 3 4 2 OK The top value was duplicated and the copy added to the stack. Finally, try 23 DROP SWAP .S ret which shows DROP SWAP .S 4 3 2 OK The copied 3 was dropped from the stack leaving a 3 on top and a 4 then a 2 below it. The SWAP reversed the order of the 4 and 3 and coincidentally restored the numbers on the stack to their original order. A few more words should be introduced before leaving this chap- ter. You may sometimes want to put different numbers on separate lines. The word that will finish an existing line on the CRT or printer and starts a new one CR . This is short for "carriage return" and has the same meaning as if you hit the carriage return button on an electric typewritter. The printing head is returned to the left margin and the platten advanced to the next empty line of paper. If you are working on a CRT, the cursor will advance down the screen or cause a scroll to make room for a new line. Try the following entry 1 . CR 2 . CR CR Ret The FORTH interpreter will place the 1 on the stack and print it and encounter a CR . A new line will be used to print the follow- ing 2 which first goes on the stack and then is input by . . If there were no further entries on that line, the 2 would be immediately followed by FORTH's comment "OK". There are however two CR's to be processed. Two additional lines follow the 2 before the familiar "OK" is seen. The ability to title an output may be very handy. There are also times when you may just want to output a message to indicate how the program is doing or to prompt an operator for an input. The word .( is provided for this purpose. To use .( in a program you must have at least one space in front of . and one space fol- lowing the " just like the other words. This word is a special case, however, because it accepts a string following it (trailing by one space!) and outputs every character in the string until it finds a ) . The ) is not a word, therefore it does not have to be proceeded by a space. It is a special charac- ter, that .( looks for, to indicate that it is time to quit and turn control over to the interpreter again. The interpreter will begin looking for more words starting in the space after the en- ding ) . To illustrate try .( HELLO) ret which shows .( HELLO) HELLOOK Starting the output on another line will improve the readability, so try the following: CR .( HELLO) CR ret 24 which produces CR .( HELLO) CR HELLO OK More than one .( may be used to construct a line CR .( HELLO) .( THERE ) ret which produces CR .( HELLO) .( THERE ) HELLOTHERE OK Notice that there is no spare between the HELLO and THERE . This is because the first .( stopped outputting when the ) was found. The second .( started outputting again with the charac- ter following the next space after it. That space was necessary so that the interpreter could separate .( from the rest of the text and look for it in the dictionary. If you forgot the space in this case, the interpreter would try to find .(THERE in the dictionary. That of course would be unsuccessful and cause an error to output. There was a space after the end of the word THERE before the ending ) . This is what separated the THERE and the OK in the printout. If you want a space between HELLO and THERE , an extra space can be left after HELLO or before THERE , like CR .( HELLO ) .( THERE ) ret or CR .( HELLO) .( THERE ) ret If you want to separate two outputs by blanks, there is an easier way than typing. .( followed by a number of spaces and then an ending .( . The word SPACE outputs one blank space. Another similar word SPACES takes the top number from the stack and out- puts that many blank spaces. To see this, enter .( HELLO) SPACE .( THERE ) ret which outputs .( HELLO) SPACE .( THERE ) HELLO THERE OK and then CR .( HELLO) 10 SPACES .( THERE ) ret and see .( HELLO) 10 SPACES .( THERE ) ret HELLO THERE OK 25 With the words you have learned now, you can use FORTH to perform and function as a standard four function calculator can. You can also put titles and spaces in your result. Every time you wish to compute a result, though, the entire process must be typed again. You are only using the words provided in FORTH in se- quence. It is time you learned how to define your own words in- stead. Definitions To program in FORTH is to create new words. To learn the power of FORTH you must learn how to define your own words designed to perform the functions you want. So far you have only seen the first level of FORTH, using words already defined in the dictionary. The outer FORTH interpreter turned control over to a word only when found in the dictionary. After the word is complete it returns control back to the inter- preter which then looked for the next word. The second level of understanding in mastering FORTH is being able to use a special group of words, called "defining words". Defining words allow you to enter new words of your choosing into the language. When you first initialize the language FORTH, there are a fixed number of words defined in the dictionary. Most of those words can be used directly from the keyboard. In- cluded are the defining words. To see all of the words avail- able, enter the word WORDS . This word will cause the names of all the words in the language to be typed on the terminal. The name of this word WORDS is taken from its function which is to list all the names of words in FORTH's vocabulary. The vocabulary list will not only show the words that were originally provided in FORTH but also any words you may have added to the FORTH dictionary by using defining words. Notice the first word in the list. Remember the name. This is where FORTH starts looking for a match between a word you enter and the words of the entire vocabulary. This word is at the top of the dictionary. Any new words written into the language with defining words will go above it in the dictionary. To understand this concept you will now define a word. The ac- tual function for this word will be to turn control back to the controlling interpreter. Since when you enter the word, the outer interpreter finds and executes the word and this word will turn control right back to the outer interpreter the net result of using this word will essentially be of no effect on the out- come of anything (except a brief delay while the computer finds and runs the word). Therefore, an excellent name for this word will be NO-EFFECT . To define this word you must use the defin- ing word : (pronounced "colon") and the word used to terminate the effects of : which is called ; (pronounced "semi-colon"). More will be said about these new words in a bit, but first try this: : NO-EFFECT ; ret 26 FORTH should respond to your entry with a courteous "OK". The word NO-EFFECT is now a part of the FORTH language in the com- puter. To run this new word, type its name into input stream. FORTH will run the word and respond with "OK". Try using NO- EFFECT with this example 5 NO-EFFECT 4 NO-EFFECT + NO-EFFECT . ret After which FORTH will print 9 OK . The word NO-EFFECT was executed once per entry and had, of course, no effect on the final printed result of 9. Now type WORDS again. Notice the first word listed is NO- EFFECT . As you can see it is now part of this vocabulary just as + , - , and . are. The defining word : entered the name NO-EFFECT into the library for later use. (A brief note on the "NOT UNIQUE" warning message you may recieve when defining new words. FORTH allows redefinition of existing words using the same name. This allows all later references to the new definition with an old name. All previously defined references to the old word will remain unchanged. Sometimes the "NOT UNIQUE" message may be issued when there seems to be no match. For instance, : FLAGS ; , gives a not unique message. This is an anomolly of the shortened names in the internal ROM of Max-FORTH. A potential match has been found between FLAGS and FLUSH , since FLUSH is stord as "a count of 5 with first two let- ters FL___ . Do not worry about these occurances. The system is not harmed by the warning message. FLUSH can still be found in the dictionary, as can FLAGS .) It is useful to remember that the ultimate interpreter of your FORTH system is the computer itself executing machine code. There is nothing else the CPU can run directly but machine code. Any higher level program to be run must be translated into its machine code equivalents. Naturally, FORTH is written in machine code so that the computer can run it as a program. This is not as accurate a statement as might be supposed, though. It is true that the most primitive words in FORTH are written in machine code. These account for less than a quarter of the memory space used by FORTH language. That is because most of FORTH is written in FORTH. In other words, not every entry in the FORTH diction- ary is written in machine code. It may have instead been written in terms of other words already defined. Since the computer can not execute this instructions directly, each word defined in terms of other FORTH words or any structures other than machine code must have an interpreter. This interpreter will be used to "unscramble" the high level words and execute the appropriate machine code routines to accomplish the actions indicated. These interpreters are themselves machine code routines, called `inner interpreters'. Each defining word that enters the new words into the dictionary has its own inner interpreter routines associated with it. The defining word assigns its own inner interpreter to the word it creates in the dictionary. These inner interpreters are what the outer interpreter actually gives control to, in order to execute a word found in the dictionary. When the inner interpreter 27 finishes the functions indicated by the entered word, control is passed back to the calling routine. If a word is entered in machine code the CPU itself can translate the word directly. This type word must end by returning control back to the calling interpreter so the next word in line can be executed (there is a machine code defining word that allows machine code routine to be entered). All the defining words available in FORTH will be discussed in coming sections, however, you first should know that they all have some things in common. Since the purpose of making a new word is to have it available for later use. Every defining word creates a place for its new word in the FORTH dictionary. No mat- ter which defining word actually created it, the new word has a few elements of structure in common with the rest of the lan- guage. Their descriptions follow. The Name Field contains the characters that make up the name as- signed to the action of the word. It is this field that is used by the outer interpreter to determine if an entry you have made matches any in the dictionary. Closely associated with the Name Field is the Length Field which holds a count of the numbers of letters in the words name. It also usually contains two flags used in the compilation process. The Link Field holds a pointer that points to the previous word in the dictionary. By the use of this field the outer inter- preter can move from word to word in the dictionary, taking each in sequential order. Only the location of the latest word added to the vocabulary need be saved. Any other word in the diction- ary can be found by searching from there to the next, etc. Definitions, therefore, do not have to be limited to any par- ticular length. The pointer will always allow enough room for the parameters and fields used in definitions. The Parameter Field Pointer is the field that Max-FORTH uses to link the seperated heads sections (consisting of Length, Name, Link and Parameter Field Pointer) and the codes sections (consisting of Code Field and Parameter Field). The Code Field contains the address of the inner interpreter. All inner interpreters are written in machine code. Remember, the computer can execute machine code and nothing else. Each defining word has its own inner interpreter already written in machine code as part of the inner portion of the language (this portion of FORTH is often called the "KERNEL"). The Code Field then will identify the interpreter of the word that entered it into the dictionary as the one to decode and perform the func- tions it was defined to do. The actual functions which will be performed depends on the parameter(s) assigned to the word during the defining process. The Parameter Field contains the information placed in it by the defining word and required by the inner interpreter assigned to it. In other words, the Parameter Field contains specially en- coded entries that the inner interpreter of that defining word will understand. 28 Now that you have been introduced to the common elements of every FORTH language, (with the exception of the Parameter Field Pointer which is unique to Max-FORTH and RSC-FORTH) it is time to look into the defining words one at a time and learn each ones function. Since : has already been introduced and is the most commonly used, it will be taken first. When the word : is executed (i.e., found in the input stream by the outer interpreter), it creates a place for a new word in the dictionary and looks in the input stream for a string following it. This string will be used as the name of the new word. The Code Field is made to point at the inner interpreter of : (note: although this inner interpreter does not have a FORTH name, it is usually refered to by its assembly label, DOCOL or DOCOLON ). Since most of the words defined in the FORTH language itself are themselves products of colon definitions DOCOLON is the most commonly used of all inner interpreters. Besides some elementary error checking, the execution of : does one sig- nificant thing. It changes the state of the outer interpreter from its normal function to the compilation state. This is done by setting a flag. When in the compilation state, the outer interpreter checks each word found in the input stream to see if it is an "immediate" word. More will be said on immediate words in a bit, however, suffice it to say that very few words in the language are "immediates". If the word is not immediate, the more common case, instead of executing the word taken from the input stream, the outer interpreter will place the address of that word's Code Field into the next empty spot in the dictionary. Since : already put the head of a word to be defined into the dictionary, this new entry will be a part of the definition being built. The inner interpreter, DOCOLON , will use the parameters so con- structed to execute the function of this word later on. Each non-immediate word following the : will have the address of its Code Field inserted into the definition until the outer interpreter is taken out of the compilation state. The way to end a : definition is by using the word ; . This word, pronounced "semicolon", is an immediate word. As implied ear- lier, immediate words are not compiled into definitions, they are rather executed immediately by the outer interpreter regardless of its current state. The execution of ; causes some error checking to be performed to see if the definition in progress has any detectable loose ends. If none are found a terminator is added to the definition so that DOCOLON will not pass out the parameters of this word during execution and accidentally try to use a following word's fields. Like DOCOLON , this terminator has no assigned FORTH name but is refered to in conversations as SEMIS . Finally, the finishing touches are put on the newly defined colon word and FORTH pointers are updated so this word can be found when the dictionary is searched and the outer inter- preter is taken out of the compilation state. In the first example where NO-EFFECT was defined, all the ele- ments of the preceding descriptions were used. When the outer interpreter encountered : it created a spot in the dictionary built around the name NO-EFFECT with a link to the previous name 29 in the dictionary and Code Field contents that pointed to DOCOLON . The parameter field received only one entry, that of SEMIS when ; was found immediately following the name. It is just as easy to define words that do have a significant effect using the : and ; pair. If you were working on a formula and calculating the sum of a variable and constant, it might be useful to define a word that enters the constant and adds it to the value on the stack. For the sake of simplicity, suppose the constant was 3. To define a word to substitute for entering 3 + every time a new calcula- tion was started, a single word could be used instead. You would use the colon definition structure to create it. For example : CALC 3 + ; ret If you have entered this example, CALC is now a new word in your FORTH that can be used instead of 3 + . To try the new word, enter 2 CALC ret and FORTH will respond with 5 OK CALC is fully functional and as much part of the language now as any other word. In fact, once you have created a word such as CALC it can be used in other definitions. In this way, large programming tasks can be broken up into very small segments which can each be programmed and tested until the entire task can be- come a combination of smaller, already defined words built up in pyramid style. For further illustration, assume that adding 3 to the variable was only part of the required work to arrive at the computed answer. The complete function also requires the sum to be multi- plied by a constant, for this example 2 . Based on the word already done, a new word could be defined to perform this more complex function. : FUNCTION CALC 2 * ; ret The word FUNCTION , here defined , when executed causes CALC to operate, adding 3 to the number on the stack. Control returns to FUNCTION when CALC is finished (i.e., DOCOLON finds SEMIS ), a 2 is placed on the stack and that number and the previ- ously calculated mid term are multiplied. To try the new defini- tion, enter 2 FUNCTION ret The response will be 10 which is 2 with 3 added and then multi- plied by 2. Try other numbers of your choice to verify to your satisfaction how well FUNCTION works. 30 To try another example the following word will plot an asterisk in the column numbered by the value on the stack. The definiton using the colon structure is as follows: : PLOT CR SPACE ." *" ; ret The CR starts the output on a new line. The number from the stack is used by SPACES to put the spaces between the start of the line and the asterisks displayed by the ." *"structure. As you can see, with only a very few words from the original dic- tionary combined with numbers and use of the stack, very powerful new words can be made. Any previously defined word can be used in a current definition. The : defining word provides a place in the dictionary, enters the name, and causes the following words to be compiled, adding meaning to the new word under con- struction. The next defining word to be studied is CONSTANT . Sometimes in programming, a single number maybe used several places in a program in performing calculations because of its significance as a parameter. It is often much easier to assign a name to the num- ber for later use than to repeat the entry of the number at every occurence. This is particularly true in cases where the value of the number may be changed to another value after the program is tested. Rather than requiring several editing changes whenever the number is resident in the body of the program, only one line would need be modified. The assignment of a new value to the name and recompilation of the program would be the only effort required. Such an assignment could be made using a : definition, for in- stance : MULTIPLIER 300 ; . When MULTIPLIER is executed, it would leave its assigned value of 300 in the stack for use in the following computations. This is not, however, very efficient use of the computers memory space because : causes three times storage to be used in MULTIPLIER 's Parameter Fields as are really required to hold the number 300 of this example. In order to store numbers inside a : definition, the Code Field Address of a word called LIT (short for literal value) is inserted in the parameters indicating that the following location is not a Code Field Address, but instead a number to be entered on the stack. Of course, the parameter field of MULTIPLIER must be terminated with the address of SEMIS because MULTIPLIER is a : definition. This takes up a third place in this words parameter field. A better use of the computer's resources would be to use the defining word CONSTANT to enter such values into the program. Like all defining words CONSTANT creates a place in the diction- ary for the word under construction with the name assigned by the programmer. Unlike : , when CONSTANT is used to enter a word, the inner interpreter assigned to the word is a routine refered to as DOCON or DOCONSTANT . This routine performs only one function. It takes the first location in the parameter field (the only location in the parameter field, by the way) and treat- 31 ing it as a number, puts a copy of it on the stack. The number was assigned by the defining word CONSTANT when the word was created. To make a CONSTANT definition, the value to be assigned to the name is first put on the stack. The word CONSTANT is entered followed by the name to be assigned. Execution of a constant creates a name in the dictionary with the address of DOCON in the Code Field Address and the top value from the stack in the parameter field. The new definition is then complete. No equiv- alent to ; is required with CONSTANT because the state of the Outer Interpreter is not changed and DOCOL looks for only one parameter. The word written earlier with : could be rewritten as follows 300 CONSTANT MULTIPLIER ret In this format, MULTIPLIER is not only more memory efficient, it is also faster. No time is spent executing DOCOL , LIT and SEMIS . All the actions needed to put the value on the stack are programmed in DOCON which is more efficient. Once a word is defined using CONSTANT , there is no direct single word way of changing its value. Unlike other languages, however, it is possible to change a constant's value without recompiling the entire program. If the program is stored in RAM (alterable computer memory) and not ROM (permanent computer storage) and the address of the defined word's parameter field can be found, the contents of that address can be changed. In that way, at some future point when it becomes necessary to redefine the value of a constant, it is possible without major effort. In fact, the values of constants can be dynamically al- tered under program control if the program is in RAM. Although this is not a recommended procedure, there is no effort made to to FORTH to "protect" the programmer from "himself". In order to learn how to alter a FORTH constant, it will be neces- sary to learn the use of three other words. These words allow the Parameter Field Address Pointer of an Max-FORTH named word to be found, the contents of a memory location to be brought from memory to stack, and a value from the stack to be stored at a specific address in memory. The first word is ' (pronounced "tick"). This word is always followed by a string. The purpose of ' is to search the dictionary for the name of the word repre- sented by the string that follows ' . Its action is much like that of the outer interpreter when it searches the dictionary. The word ' , however, returns the value of the Parameter Field Address Pointer on the top of the stack when the word is found, rather than to actually execute the word. Assuming the word MULTIPLIER has been added to FORTH as shown above with the defining word CONSTANT , its Parameter Field Ad- dress Pointer can be found by ' . Entering ' MULTIPLIER . will cause some number to be printed. The value of the number may or may not hold significance to you, depending on your familiarity with your computer installation. This is, however, the address where the parameter assigned by CONSTANT to MULTIPLIER was 32 stored. All computer memory locations are assigned with numbers called addresses. By using the addresses, any information in the computers memory can be found. Knowing the address of a piece of data is only the first step. The actual data that is kept in that address is entirely a dif- ferent matter. By knowing the address where data is stored in memory, it is possible to call up that data or fetch it from its address. The word that allows memory to be read is @ (pronounced "fetch"). You will be able to fetch the value from MULTIPLIER's paramemter field using @ . To try this, you must again use ' to find that address. Once the address is on the stack, rather than printing the address, it can be used as the input to @ to first find out where the pointer is pointing, and then, to actually get the value for the memory read. Entering ' MULTIPLIER @ @ . will display 300, the value assigned when the word was created. The word @ always takes the top number from the stack and using it as an address, replaces it with the con- tents of that address. This is a form of indirection, using a number (i.e., address) to find a number (i.e., contents of an address). Reread the above description if you do not understand the difference between an address and the contents of that ad- dress. With addition of one more word you will learn how to actually modify memory to be whatever you want. The word ! (pronounced "store") is used for this purpose. Unlike @ which required only one parameter from the stack, ! requires two. Not only is an address needed to tell where to store a value, but the value itself must precede the address on the stack. To actually modify the way the previously defined word MULTIPLIER works, you need only enter the value you wish to change it to, its Parameter Field Address and issue a store command as follows: 50 ' MULTIPLIER @ ! OK Typing MULTIPLIER . will cause a 50 to be printed rather than the originally defined value 300. With knowledge of @ and ! also comes a grave responsibility. Indiscriminate use of these commands will surely cause a system crash. Much like the knowledge of good and evil, the ability to read and modify memory directly changes the status of the user. Responsibility for their use comes with the knowledge. If you do not thoroughly understand the significance of reading or writing some location, it is exceedingly prudent not to do so. By using @ and ! with ' it is possible to change the value of an already defined constant. Sometimes during programming, it is necessary to have an easily alterable storage without using the stack. A printing program for example may need to count the number of lines sent to the printer, but may not know the nature of "what's on the stack where" when it is called by a higher level program. A variable is needed in such ocassion. 33 The defining word VARIABLE allows for the creation of such storage structures. The structure of VARIABLE is quite similar in nature to that of CONSTANT just described. The word VARI- ABLE creates a place in the dictionary for the name contained in the string following it. The interpreter pointed to by the new variable's Code Field Address is called DOVAR or DOVARIABLE . This interpreter is similar to DOCOL with a subtle but ex- teremely important difference. The parameter field of the new VARIABLE defined word contains the value of the variable, just as a CONSTANT defined word. DOVAR , however, does not cause that value to be brought to the stack when the variable is called. Instead the address of that value is brought out by a fetch or modified by a store. A variable created by VARIABLE COUNT could be useful in mainta- ing the number of lines printed without typing out the stack. In the program where the number of lines printed was desired, COUNT @ would bring the value to the top of stack. The value could be incremented by a 1+ COUNT ! or cleared by putting a zero into the variable with 0 COUNT ! . The entry COUNT . is not par- ticularly useful. This would cause the address of the data of count to be printed. The programmer is usually much more inter- ested in what is stored in a variable, than where it is stored. The word VARIABLE creates storage for the data in the dictioa- nary itself. This may or may not be particulary desirable. If you are working in an entirely RAM based system, that is all the memory locations that can be read as well as written to. Using VARIABLE is fine. If you are, however, preparing your program for permanent storage in ROM, memory that will be set up once and can never be rewritten (Read Only Memory), using the variable structure may cause serious hardships. In such a situation, there are two possible working solutions. In both, the actual data is placed outside of the dictionary proper. If a free area of RAM is known to exist, the programmer can define a constant that will point at it. For example, if free RAM is available to the user at location 16038, the follow- ing step will give this address to the name FREE-VAR : 16384 CONSTANT FREE-VAR ret Now, the name FREE-VAR will be used as the address of the usable data. Using a constant in a ROM coded program is quite suitable as long as it is not to be changed, which is again not recommended practice. FREE-VAR can be used just as the variable defined COUNT can. Entering FREE-VAR @ will bring the data to the stack and FREE-VAR ! will put data away in that storage place. The second method is provided in most ROM based FORTH systems. Since FORTH itself maintains a number of variables in RAM, a spe- cial area is reserved to temporary storage called a user area. System variables that contain the number base for input and out- put functions, the length of characters that can be contained in a name , etc., are kept there for FORTH . 34 The user can also take advantage of some of the unassigned por- tion of that area by defining "user variables". The defining word USER is designed for this purpose. When a word defined with USER is called, the address of the data is left on the stack for fetch and store operations, just as the one defined with VARIABLE . Beyond this, the similarities of these two defining words end. When a user variable is defined, it is the offset into the user area that is taken from the stack rather than its preliminary value. The interpreter DOUSE is assigned to these words. DOUSE takes the offset to compute the actual address where the data lies. For example, if COUNT were to be designed to make use of the user area, it could be written as 64 USER COUNT , which means COUNT is kept in the sixty fourth location in the user area. Note that it is necessary to pick where in the user area each newly defined user variable is to go. It is important also to avoid conflicts with the system user variables which are usually in the first few locations in the user area. Once defined, user variables can be normally used in exactly the same way as any ordinary variable. The final defining words in FORTH will only be mentioned now. They are and a few others to be covered later. Let us suffice to say for the moment that their remarkable structure not only allow you to define new words, but also define new words that can be used to define new defining words. This proves the amazing nature of FORTH. The third level of understanding in FORTH is that, it is possible to create words which can further create new words. In this way a new data structures and other types of definition can be added as easily as the words that will eventually use them. The process of defining new words, called extensibility, of FORTH is truly remarkable. Structures At this point, you have learned how to define new words in order to program your problem in the FORTH language. Perhaps, if you are familiar with programming in some other language, you recog- nize the fact that all the examples shown thus far have been "straight line" code. That is, there have been no examples where conditional decisions have been made. Neither has there been any use of repetitive loops. Without these structures, programming is relatively useless. If the computer is not allowed to make decisions and take definitive actions based on those decisions, problems in general are more quickly solved with a hand cal- culator without the time-consumming process of programming. It is well known that the computer's power comes not from being able to make large monumental decisions at once, but rather that it takes many small iterative steps in arriving at a final solu- tion. In order to access this aspect of programming in the FORTH programming language, you must now learn the use of structures. 35 One of the reasons that structures were not taught earlier in this discourse is that, in FORTH they can only be used in defined words. They cannot be used directly from the keyboard the same way that + and - are. The reason for this lies in the way the Outer Interpreter works. In order for this interpreter to work, only one word can be recognized at a time. It can not parse out two names at once and has no way of remembering other names that have been used before hand. This ability to establish the location of the code for two different routines is necessary to make decisions. Based on the result of a decision one block of code or another will be executed. This is called "branching". Structures can be set up inside of FORTH words at the time of their compilation, however. When the Outer Interpreter is in the compilation mode rather than the execution mode it uses the Return Stack in order to remember where in the definition a branch is to be made later. The simplest form of a structure is perhaps the IF THEN construct. It will be introduced first. Quite often when making a decision, it is useful to look at the problem with all the possible alternatives carefully laid out. The simplest decision is one where, if one thing is true, a specific action will be taken. If it is not true, no special ac- tion is needed. An example of those in the English language would be "If it is raining, I will take my umbrella." The basis of the decision rests on the status of the weather. If it is raining, a special action must be performed. If it is not rain- ing, no such action is demanded. Taking the umbrella is the par- ticular action in question at the time. In FORTH, there is a word IF that causes an action to be taken based on the determined truth of a predefined term. This word is always used with the word THEN which is used to indicate the termination of the required action. IF makes its decision of whether to branch or not by taking a type of value from the stack, referred to as Boolean. A Boolean value has only two pos- sible values, true or false. Since the computer deals in 0's and 1's and doesn't understand concepts as abstract as right and wrong or true and false, the input to an IF word must be a num- ber. The way FORTH handles true and false is to assign the Boolean false to the number "0". Of course, if there are only two Boolean values in existence and the number "0" is one of them, it is totally arbitrary what the actual numerical value is assigned to true. In fact this is exactly the way FORTH treats the true Boolean value. If it is not "0" and therefore false, it must be true. To illustrate the use of the decision making power of the word IF the folowing example is exhibited: : TODAY IF ." TAKE YOUR UMBRELLA AND" THEN ." GO TO THE OFFICE" ; This definition called TODAY takes a truth value from the stack and prints the comment in the ." field if it is true. Other- wise, program control is passed to the instruction after the THEN . Here is another ." that has a comment that will be printed regardless of the value taken from the stack. To true this example, type the word TODAY preceded by a number that rep- 36 resents a Boolean truth value, i.e, 0 TODAY . The value 0 is false, meaning that it is not raining if that is what has been decided upon. The printed result will read, TODAY GO TO THE OFFICEOK If you were able to hook a rain gauge to your computer and read it with a word named CHECK which would leave a zero when it was not raining and a non-zero when it was, entering CHECK TODAY would give you your morning marching orders. Sometimes a more complex form of conditional is required than a simple IF THEN combination. It maybe necessary to take one ac- tion when a thing is true and an entirely different one if it is false. In FORTH, the structure that allows this kind of condi- tional is the IF ELSE THEN combination. Applied to English, it is similar to the biforcated statement "If it is cold I will take my fur hat, else I'd rather take my straw hat instead". An example similar to the one used for the simple IF THEN is presented as follows: : LOWTEMP ." THIS TIME I'LL TAKE MY" IF ." FUR " ELSE ." STRAW " THEN ." HAT! " ; To test the operation of the IF ELSE THENstructure enter: 1 LOWTEMP ret and notice the comment about the fur hat. To use a false value with LOWTEMP will ellicit a remark instead about a straw hat. Much more complex actions could be defined for execution between the IF and ELSE as well as the ELSE and THEN . These ." messages are used only for simplicity. Although the IF was said to always be used with the the THEN earlier, there is ac- tually another word that can be used with the IF instead. The word END and can replace the word THEN . There is no dif- ference between the action of the words, however. The other spellings are provided in the language only to make certain struc- tures more readable. Which one to use is left to the discretion of the programmer. It would be ridiculous of course, if you had to hand feed every truth value to the computer as was the case above before it could make a decision. For this reason, the language FORTH has a num- ber of relational operators. Such words allow testing of numbers on the stack and determination of their status in comparison with others. The relationship of less than, greater than, equal to and a special less than that disregards the positive/negative sign of the numbers can be derived from comparison of two stack numbers. A single stack entry can be checked for less than zero or equal to zero. Finally, a Boolean takes two numbers from the stack and leaves a single remaining truth value in their place. The truth value will be a "1" if the deeper value on the stack is less than the later entered number. That is to say, that the truth value will indicate true if the lower value is less than the value on the Top of Stack. If this is not the case, i.e., 37 they are equal or the Top of Stack is the lesser of the two, the < word will leave a false value of "0" on the stack in their place. It would probably be useful to review a moment the way the - word was detailed to work in FORTH as compared to algebraic nota- tion. The second value down on the stack was the object of the subtraction, the Top of Stack value was subtracted from it. You were told to visualize the two numbers in the order they were en- tered on the stack and then imagining the operator between them to reconstruct the algebraic syntax. This method of visualiza- tion will be quite useful when working with these relative value operators. Before experimenting with < operator, enter the following: : T-OR-F IF ." TRUE" ELSE ." FALSE" THEN ; ret This word will allow you to see the resultant truth value left on the stack by a relational operator. Hopefully, the words "TRUE" and "FALSE" will have more graphic significance than would 1's and 0's printed. Now try entering : 6 9 < .S T-OR-F ret The result should be a 1 printed by the .S and the word "TRUE" following it. Other cases can be explored with entries of 9 6 < T-OR-F and 6 6 < T-OR-F which are both false. The greater than relation is tested by the word > . Again if you should ever have trouble remembering the order in which the operands are taken in respect to the operator, try the algebraic translation method of visualization. After some practice, the order of these operations will become second nature to you. Try all three of the above examples with the 6 and 9 entries to be- come familiar with the > word. To determine if two values on the stack are identical, the word = may be used. Try the above examples replacing the < with = instead. Remember that these operators always take two numbers off the stack and leave a truth value in their place. If the original values are to be preserved for use in a later routine, it will be necessary to make copies of them with DUP , etc. for the operator to work within their place. The unsigned unrelational operator mentioned earlier is the word U< . To experiment with this word do the above examples replac- ing the < with U< . The results will be the same as before 38 for the 6 and 9 entries. Repeat both sets of examples with -6 and -9 instead and the difference between the two less than's should be apparent. Often it is desirable to test a pair of numbers for the opposite direction from that of the provided operators. The NOT word is provided to invert truth values for such occassions. Try to find if two numbers are not equal with this entry: 6 9 = NOT T-OR-F ret The NOT word actually has the same effect as the single number operator 0= . Try the example substituting 0= in the place of NOT and see the results are identical. The last remaining relational operator to be mentioned is 0< . This structure will run faster on most FORTH implementations than using a separate 0 and < entry sequence, but has virtually the same effect. Relational operators are usually used in consonance with IF's in programming. An example follows: : SIZE> DUP 10 > IF ." TOO LARGE" THEN . ; ret This word, SIZE> , checks the number passed to it to make sure it is not greater than 10. If it is, a warning message is printed first. A very common structure used in programming is the loop. Concep- tually, a loop is a string of instruction that are repeated in order for a given number of times. This eliminates the need to write the same instructions over and over again in sequence when writing the program. Say for example you wanted to write a program that listed all the numbers from 0 to but not including 10, with their squared value beside them. If you were to write all the individual instructions to make this table, it would look like this: : SQ-TBL 1 1 1 . * . CR 2 2 2 . * . CR 3 3 3 . * . CR 4 4 4 . * . CR 5 5 5 . * . CR 6 6 6 . * . CR 7 7 7 . * . CR 8 8 8 . * . CR 9 9 9 . * . CR ; ret As you can see the program is long and tedious because of the con- stant repetition. There is another disadvantage as well, in that, changing the program to make the same table up to 19 is twice as much work. The work already done is of little more use than as a pattern to the programming for the extended numbers above 9. By using a looping structure, it is possible to save a good deal of effort in writing programs of this type and write a much more useful program as well. Writing a loop structure with only the relational operators and the condition IF ELSE THEN words is very difficult. This is because FORTH's very nature en- courages structured programming. One of the main requirements of structured programming is that no "GO TO" like commands be used when programming. There are no "GO TO" words in FORTH. Although it is possible to create them, it is not necessary as you will see shortly. The only way to write a loop with IF ELSE THEN's 39 without "GO TO" commands is by using a method called "reentrant code" where one of the routines called in a words definitions is itself. That is, the word being defined will be set up to call itself when it runs. It will continue to recall itself as many times as necessary to do the looping desired. There are two powerful reasons why this is not a useful solution at this point. First, to actually make a definition available to be called before it even finishes, takes some sophisticated manipulation on the FORTH compilation process, which is beyond the understanding of most moderately competent FORTH users. Secondly, most FORTH systems limit the number of times words can call other words. This is usually below a hundred. Many applications where loops are used can exceed several thousand iteration of the loop, precluding the use of reentrant coding structures for solution. If you are discouraged by the number of methods that are not ef- fective in creating loops, take heart, FORTH offers quite a large number of versatile structures that will just fit the bill. The first to be presented works wonderfully for reworking the last example. The structure is made up of the two words DO and LOOP . When a loop is desired two numbers are passed to the DO word. They are the upper limit of the loop and the number to start the looping with. The count of the loop will start at the top value on the stack and continue until the top limit is met. Any words between the DO and the LOOP will be executed as many times as it takes to meet the upper limit. It is the run- time part of the word LOOP that actually does the counting. Each time LOOP is encountered in the execution, the count has one added to it. It is then tested to see if it is equal to or greater than the upper limit. If it is, the loop is terminated. If not, it branches back to the word immediately following the DO . The looping continues until the final condition is met before execution continues with the rest of words following the LOOP . The squaring table example follows: : SQ-TBL 10 1 DO I I I . * . CR LOOP ; ret 40 41 A P P E N D I C E S 42 WORDS LIST FOR Max-FORTH V1.0 6/86 The following words list was captured from a Max-FORTH V1.0 sys- tem. To conserve ROM space, only the character count and the non-underlined characters actually exist in the internal ROM, i.e., SPACES and SPACEZ are not differentiated. Unless you set WIDTH to three (number of characters --- maximum is 31) the names you enter will be normal length. 43 F893 TASK EBE0 ( FE26 @ FE00 C@ FDF3 ! FDE6 C! FA0E 2@ F9F8 2! E7C4 : E7DA ; FDCF + FDC4 - FA9F 1-! FA90 1+! FA81 +! F88B * F881 / FD47 >< FD52 SWAP F9E0 2OVER F9EC 2SWAP FD8F DUP F9D8 2DUP FD3F OVER FD2B ROT F9CA 2ROT FA73 PICK FA2D ROLL FA4D -ROLL FD83 DROP F9C8 2DROP FD7A >R FD73 R> FC09 = FC3A NOT FC28 0= F96A D0= FC1F 0> FC16 0< FBFD U< FBE8 < F97A DU< F972 D< F962 D= FBE0 > FDB3 AND FDA5 OR FD97 XOR EF4E IF EF42 THEN EF2C ELSE EF22 BEGIN EF14 UNTIL EF02 REPEAT EEFA WHILE EEEC AGAIN EF14 END EE54 DO EE81 LOOP EE60 +LOOP FAE6 K FADE J FAD6 I FAD6 R@ EEA2 LEAVE FEBB EXIT F8FC KEY F8F4 EMIT F8EC ?TERMINAL FBD8 S->D FBC9 ABS F942 DABS FBAD MIN F92E DMIN FB9D MAX F91C DMAX F763 SPACES FA1D DEPTH F6DE CR F6BE TYPE F6B2 COUNT F68A -TRAILING FC80 1+ FC75 2+ FC6A 1- FC5F 2- FC50 2/ FC45 2* F9A8 D+ F982 D- F907 D2/ F83D /MOD F835 MOD F829 */MOD F81F */ FB39 UM* FB05 UM/MOD FAFA NEGATE F956 DNEGATE E802 CONSTANT E7F2 VARIABLE E810 2CONSTANT E7E8 2VARIABLE FAEE EXECUTE FD6A SP@ F7B9 CMOVE> F7E3 CMOVE FEBB ;S E846 CODE-SUB E83A CODE E82A END-CODE E81C USER F597 . F5A9 .R F5B5 D. F58F U. F59F U.R F5BF D.R F616 #S F624 # F605 SIGN F5F5 #> F5EB <# F587 ? F6EC EXPECT E70E QUERY F647 BL F555 STATE F552 CURRENT F54F CONTEXT F54C SCR F549 BLK F507 DP F52B OFFSET F540 FLD F53D DPL F534 >IN F4FB BASE F4E6 S0 F4EF TIB F53A #TIB F537 SPAN F56C C/L F1C9 FIRST F1C1 LIMIT F564 PAD EF82 HERE EF7A ALLOT EF6E , EF62 C, F77B SPACE FD85 ?DUP EDF4 TRANSVERSE EF5A LATEST EC64 COMPILE EC5C [ EC51 ] F4CC HEX F4C3 DECIMAL EC39 ;CODE EC31 EBED ." EC12 .( F793 FILL F78B ERASE F783 BLANK F5DD HOLD F225 WORD F45C CONVERT F406 NUMBER EBBE FIND EADE ID. E896 CREATE EACE [COMPILE] EAAA LITERAL E75E INTERPRET E9FE IMMEDIATE E864 VOCABULARY E9F4 FORTH E9EC EDITOR E9E4 ASSEMBLER E9DA DEFINITIONS E9D2 RECURSE EE3E >MARK EF82 RESOLVE EE26 BODY EE1E CFA EE0F NFA EDE7 PFAPTR E738 LOAD E728 THRU EFB6 --> F18UATE 44 F16D EMPTY-BUFFERS F0B3 SAVE-BUFFERS F0B3 FLUSH F09B (LINE) F091 .LINE F06C >L F123 BUFFER F0D3 BLOCK F393 B/BUF EDB1 H/C ECFF HWORD ECE9 AUTOSTART E934 UNDO E941 FORGET F1ED DUMP F352 .S ECB1 WORDS EFFC TRIAD EFCD INDEX F02A LIST E6EF QUIT EBF9 ABORT" E6E5 ABORT FEC1 COLD FD1B BRANCH FD09 ?BRANCH FAAB ATO4 ED43 EEWORD F397 EEMOVE F3BF EEC! F893 FORTH-83 OK 45 GUIDES IN USING APPENDICES C and D Max-FORTH words in Appendix C are sorted in ascending ASCII order, whereas, Appendix D is sorted alphabeti- cally by GROUP under which each Max-FORTH word is clas- sified. For Appendix C, the explanations of each entry and the meaning of abbreviations and symbols are presented below. For Appendix D, the explanations under STACK NOTATION and GROUP apply. NAME : The name of FORTH words are boldfaced. PRONUNCIATION : The english language pronunciation of each words is enclosed in double quotes ("). VERSION : Each words may be any of the following versions or combinations: NMI New Micros Inc. NMIDR New Micros Inc. Development ROM F83 Forth-83 Standard RSC Rockwell Semiconductor STACK NOTATION : The stack parameters input to and output from a definition are described using the notation: ( before --- after ) where, before = stack parameters before execution after = stack parameter after execution The parameters are arranged such that the top of the stack is to the right. Words may also be shown in context where appropriate. Unless otherwise noted, all stack notation describes execution time. If it applies at compile time, the line is followed by: (compiling) . --- FORTH word's execution point Literal text. The actual word's name. b bit (0 or 1) char character (numeral range: 0 to 127) +d, +d1 positive double number +n positive number 0 the number zero 8b, 8b1 8-bit number 16b, 16b1 16-bit number 32b, 32b1 32-bit number 46 addr, addr1 address count number of items or characters or loop repetitions d, d1 32-bit signed number f flag (0=false, 1=true) false boolean ( 0 ) flag boolean flag (0=false, non- zero=true) n, n1 16-bit signed number sys, sys1 0, 1 or more system-dependent stack entries true boolean ( -1) u, u1 16-bit unsigned number ud, ud1 32-bit unsigned number w, w1 unspecified weighted number ( n or u) wd unspecified weighted double number (d or ud) # ARGUMENTS IN : The number of input parameters as shown in the STACK NOTATION. The number may also be fol- lowed by a note to clarify how many bit wide it is, like 1 word (16-bit), 2 words, etc. # ARGUMENTS OUT : The number of output parameters as shown in the STACK NOTATION. The number may also be fol- lowed by a note to clarify how many bit wide it is, like 1 word (16-bit), 2 words, etc. RETURN STACK : States the effect/s of the word to the return stack, if applicable. DICTIONARY : States the effect/s of the word to the diction- ary, if applicable. PAD : States the effect/s of the word to the PAD and/or the area below PAD used for output for- mating, if applicable. INPUT : States input effect/s of the word, if ap- plicable. OUTPUT : States the output effect/s of the word, if ap- plicable. GROUP : Words are grouped according to their primary functions. A word is classified under one of the following groups: Arithmetic Words that perform the fundamental operations of arithmetic, e.g., binary operations of addition, sub- traction, multiplication, divi- sion, negation and absolute value. Comparison Words that compare values for rela- tive magnitude or relative signs, leaving a flag. 47 Compiler Words that are used for compiling dictionary entries. Control Words that determine the execution and interpretation sequence of a program. Definition Words used to define or create new words. Dictionary Words that are used to operate on the FORTH's dictionary. Format Words that define the presentation or conversion of numbers and character strings. I/O Words that direct all the input/output operation. Interpreter Words that decode and immediately execute instructions written as pseudocodes. Logic Words that execute an operation that is defined in symbolic logic, such as AND, OR, NOT. Mass Words used for efficient utiliza- tion of mass storage devices or output devices. Memory Words that operate on specified memory addresses. Numeric Words for representing numbers into a specific number base, or converting strings into number. Operating Words that perform system System procedures. Primitive Words which are originally defined in machine code and are used to define other words. Security Words that inform users of errors or provide preventive measures against unwanted actions on an operation. Stack Words to manipulate the stack. Vocabulary Words operating on the FORTH vocabulary. ATTRIBUTE : Capitalized symbols indicate attributes of the defined words: C May only be used during compilation of a colon definition. E Intended for execution only. I Indicates that the word is IMMEDIATE and will execute during compilation, unless special action is taken. M Has a potential multiprogramming impact. P Has precedence bit and will execute even when compiling. U A user variable. 79 Forth-79. 83 Forth-83 48 STANDARD : All words that are found in the Forth-83 Stan- dards, if applicable, are identified as follows: Forth-83 Word Set Classification Layer----- Forth-83 Word Set Classification------- | Forth-83 -------------------------- | | | | | F83-XXXX-XL Word Set Classifications: RWS Required Word Set DNEWS Double Number Extension Word Set AEWS Assembler Extension Word Set SEWS System Extension Word Set CRW Controlled Reference Word URW Uncontrolled Reference Word Word Set Classification Layers: NL Nucleus Layer DL Device Layer IL Interpreter Layer CL Compiler Layer SHORT DEFINITION: Brief description of the word. Most symbols used may be found in the stack notation. Refer back to stack notation symbol key for their meaning. LONG DEFINITION : Detailed description of the word. Most symbols used may be found in the stack notation. Refer back to stack notation symbol key for their meanings. 49 Max-FORTH WORDS DEFINITION NAME : ! PRONUNCIATION : "store" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b addr --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Stores 16 at addr. LONG DEFINITION : 16b is stored at addr. 50 NAME : # PRONUNCIATION : "sharp" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( +d1 --- +d2 ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : Bytes below PAD modified as temporary area where +d1 is converted to string. INPUT : OUTPUT : GROUP : Format ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: +d1 is divided by BASE and the quotient is placed onto the stack. The remainder is con- verted to an ASCII character and appended to the output string toward lower memory ad- dresses. LONG DEFINITION : The remainder of +d1 divided by the value of BASE is converted to an ASCII character and ap- pended to the output string toward lower memory addresses. +d2 is the quotient and is main- tained for further processing. Typically used between <# and #> . 51 NAME : #> PRONUNCIATION : "sharp-greater" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 32b --- addr +n ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 2 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Format ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Terminates formatted (or pictured) output string (ready for TYPE ). LONG DEFINITION : Pictured numeric output conversion is ended dropping 32b. addr is the address of the resulting output string starting +n characters below pad. +n is the number of characters in the output string. addr and +n together are suitable for TYPE . 52 NAME : #S PRONUNCIATION : "sharp-s" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( +d --- 0 0 ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 2 RETURN STACK : DICTIONARY : PAD : Bytes below PAD modified as temporary area where +n is converted to string. INPUT : OUTPUT : GROUP : Format ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Converts all digits of an entire number into string. LONG DEFINITION : +d is converted apppending each resultant into the pictured numeric output string until the quotient (see: # ) is zero. A single zero is added to the output string if the number was initially zero. Typically used between <# and #> . 53 NAME : #TIB PRONUNCIATION : "number-t-i-b" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Returns the address of the user variable that holds the number of characters input. LONG DEFINITION : The address of a user variable containing the number of bytes in the text input buffer. #TIB is accessed by WORD when BLK is zero. 54 NAME : ' PRONUNCIATION : "tick" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : is removed from input stream. OUTPUT : GROUP : Dictionary ATTRIBUTE : M 83 STANDARD : F83-RWS-IL SHORT DEFINITION: Returns 's compilation address, addr. LONG DEFINITION : Used in the form: ' . addr is the com- pilation address of . An error condition exists if is not found in the currently active search order. 55 NAME : ( PRONUNCIATION : "paren" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : Characters up to ) are removed from input stream. OUTPUT : GROUP : Compiler ATTRIBUTE : I STANDARD : F83-RWS-IL SHORT DEFINITION: Starts a comment input. Comment is ended by a ) . LONG DEFINITION : Used in the form: ( ccc) . The characters ccc, delimited by ) (close parenthesis), are considered comments. Comments are otherwise not processed. The blank following ( is not part of ccc. ( may be freely used while inter- preting or compiling. The number of characters in ccc may be from zero to the number of charac- ters remaining in the input stream up to the closing parenthesis. 56 NAME : (LINE) PRONUNCIATION : "paren-line" VERSION : RSC NMIDR STACK NOTATION : ( n1 n2 --- addr count ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 2 RETURN STACK : DICTIONARY : PAD : INPUT : May cause block read if not RAM resident. OUTPUT : May cause block write to facilitate block read GROUP : Mass ATTRIBUTE : STANDARD : SHORT DEFINITION: Virtual storage line primitive. LONG DEFINITION : Converts the line number n1 and the screen num- ber n2 to the disk buffer address containing the data. A count of 64 indicates a full line length. 57 NAME : * PRONUNCIATION : "times" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( w1 w2 --- w3 ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Multiplies w2 by w1 and leaves the product w3 onto the stack. LONG DEFINITION : w3 is the least significant 16 bits of the arithmetic product of w1 times w2. 58 NAME : */ PRONUNCIATION : "times-divide" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n1 n2 n3 --- n4 ) # ARGUMENTS IN : 3 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Multiplies n2 by n1 and divides the product by n3. The quotient, n4 is placed on the stack. LONG DEFINITION : n1 is first multiplied by n2 producing an inter- mediate 32-bit result. n4 is the floor of the quotient of the intermediate 32-bit result divided by the divisor n3. The product of n1 times n2 is maintained as an intermediate 32- bit result for greater precision than the other- wise equivalent sequence: n1 n2 * n3 / . An error condition results if the divisor is zero or if the quotient falls outside the range {-32,768...32,767}. 59 NAME : */MOD PRONUNCIATION : "times-divide-mod" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n1 n2 n3 --- n4 n5 ) # ARGUMENTS IN : 3 # ARGUMENTS OUT : 2 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: n1 is multiplied by n2 producing a product which is divided by n3. The remainder, n4 and the quotient, n5 are then placed on the stack. LONG DEFINITION : n1 is first multiplied by n2 producing an inter- mediate 32 bit result. n4 is the remainder and n5 is the floor of the quotient of the inter- mediate 32-bit result divided by the divisor n3. A 32-bit intermediate product is used for */ . n4 has the same sign as n3 or is zero. An error condition results if the divisor is zero or if the quotient falls outside of the range {-32,768...32,767}. 60 NAME : + PRONUNCIATION : "plus" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : (w1 w2 --- w3 ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Adds w2 and w1 then leaves the sum, w3 on the stack. LONG DEFINITION : w3 is the arithmetic sum of w1 plus w2. 61 NAME : +! PRONUNCIATION : "plus-store" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( w1 addr --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Adds w1 to the value at addr then stores the sum at addr replacing its previous value. LONG DEFINITION : w1 is added to the w value at addr using the convention for + . This sum replaces the original value at addr. 62 NAME : +LOOP PRONUNCIATION : "plus-loop" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n --- ), ( sys --- ) (compiling) # ARGUMENTS IN : 1 , 1 # ARGUMENTS OUT : 0 , 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : I C STANDARD : F83-RWS-CL SHORT DEFINITION: Increments the DO LOOP index by n. LONG DEFINITION : n is added to the loop index. If the new index was incremented across the boundary between limit-1 and limit then the loop is terminated and loop control parameters are discarded. When the loop is not terminated, execution con- tinues to just after the corresponding DO . sys is balanced with its corresponding DO . See: DO 63 NAME : , PRONUNCIATION : "comma" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : Word pointed to by DP prior to execution is modified. PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : F83-RWS-CL SHORT DEFINITION: Reserves 16b of space in the dictionary. LONG DEFINITION : ALLOT space for 16b then store 16b at HERE 2- . 64 NAME : - PRONUNCIATION : "minus" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( w1 w2 --- w3 ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Subtracts w2 from w1 and leaves the result, w3 on the stack. LONG DEFINITION : w3 is the result of subtracting w2 from w1. 65 NAME : --> PRONUNCIATION : "next block" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : Causes read of next block if not RAM resident. OUTPUT : May cause write of updated screen to make buffer space. GROUP : Mass ATTRIBUTE : I STANDARD : F83-CRW SHORT DEFINITION: Immediately transfers interpretation to the start of the next sequential block. LONG DEFINITION : Continue interpretation on the next sequential block. May be used within a colon definition that crosses a block boundary. 66 NAME : -ROLL PRONUNCIATION : "dash-roll" VERSION : NMI NMIDR STACK NOTATION : ( n --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : SHORT DEFINITION: Removes the value on the top of stack and in- serts it to the nth place from the top of stack. LONG DEFINITION : The item on the top of the data stack is removed and inserted down to the nth location from (but not including) the top of the stack. The rest of the contents of the stack is shifted up to make room to insert the item. 1 -ROLL is equivalent to SWAP . 67 NAME : -TRAILING PRONUNCIATION : "dash-trailing" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr +n1 --- addr +n2 ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 2 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Format ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Counts +n1 characters starting at addr and sub- tracts 1 from the count when a blank is encoun- tered. Leaves on the stack the final string count, n2 and addr. LONG DEFINITION : The character count +n1 of a text string begin- ning at addr is adjusted to exclude trailing spaces. If +n1 is zero, then +n2 is also zero. If the entire string consists of spaces, then +n2 is zero. 68 NAME : . PRONUNCIATION : "dot" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Removes n from the top of stack and displays it. LONG DEFINITION : The value of n is displayed in a free field for- mat with a leading minus sign if n is negative. 69 NAME : ." PRONUNCIATION : "dot-quote" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : I M STANDARD : F83-RWS-CL SHORT DEFINITION: Displays the characters following it up to the delimiter " . LONG DEFINITION : Used in the form: ." ccc" . Later execution will display the characters ccc up to but not including the delimiting " (close-quote). The blank following ." is not part of ccc. Used inside a colon definition only. 70 NAME : .( PRONUNCIATION : "dot-paren" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : Displays character string GROUP : I/O ATTRIBUTE : I M 83 STANDARD : F83-RWS-IL SHORT DEFINITION: Displays string following .( delimited by ) . LONG DEFINITION : Used in the form: .( ccc) . The characters ccc up to but not including the delimiting ) (close parenthesis) are displayed. The blank following .( is not part of ccc. Used out- side of a colon definition only. 71 NAME : .LINE PRONUNCIATION : "dot-line" VERSION : RSC NMI NMIDR STACK NOTATION : ( n1 n2 --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : May cause block read if not RAM resident. OUTPUT : Lists line to terminal. GROUP : Mass ATTRIBUTE : STANDARD : SHORT DEFINITION: Display line of text from mass storage. LONG DEFINITION : Displays a line of text from mass storage by its line number n2. Trailing blanks are sup- pressed. 72 NAME : .R PRONUNCIATION : "dot-r" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n +n --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : Bytes below PAD modified as temporary area where +n is converted to string. INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: Displays the value n right justified in a field +n characters wide according to the value of BASE. LONG DEFINITION : n is converted using BASE and then displayed right alligned in a field +n characters wide. A leading minus sign is displayed if n is nega- tive. If the number of characters required to display n is greater than +n, an error condi- tion exists. 73 NAME : .S PRONUNCIATION : "dot-s" VERSION : RSC NMI NMIDR STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : SHORT DEFINITION: Display stack contents without modifying the stack. LONG DEFINITION : Displays the contents of the stack without al- tering the stack. This word is very useful in determining the stack contents during debugging programs and learning FORTH. 74 NAME : / PRONUNCIATION : "divide" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n1 n2 --- n3 ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Divides n1 by n2 and leaves the quotient n3 on the stack. LONG DEFINITION : n3 is the floor of the quotient of n1 divided by the divisor n2. An error condition results if the divisor is zero or if the quotient falls outside the range {-32,768 ... 32,767}. 75 NAME : /MOD PRONUNCIATION : "divide-mod" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n1 n2 --- n3 n4 ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 2 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Divides n1 by n2 then leaves on the stack the remainder n3 and the quotient n4. LONG DEFINITION : n3 is the remainder and n4 the floor of the quotient of n1 divided by the divisor n2. n3 has the same sign as n2 or is zero. An error condition results if the divisor is zero or if the quotient falls outside the range {-32,768 ... 32,676}. 76 NAME : 0< PRONUNCIATION : "zero-less" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n --- flag ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Comparison ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Leaves a true flag if n is less than zero. LONG DEFINITION : Flag is true if n is less than zero (negative). 77 NAME : 0= PRONUNCIATION : "zero-equals" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( w --- flag ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Comparison ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Leaves a true flag if w is equal to zero. LONG DEFINITION : flag is true if w is zero. 78 NAME : 0> PRONUNCIATION : "zero-greater" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n --- flag ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Comparison ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Leaves a true flag if n is greater than zero. LONG DEFINITION : flag is true if n is greater than zero. 79 NAME : 1+ PRONUNCIATION : "one-plus" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( w1 --- w2 ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Adds 1 to w1 then leaves the sum, w2 on the stack. LONG DEFINITION : w2 is the result of adding 1 to w1 according to the operation of + . 80 NAME : 1+! PRONUNCIATION : "one-plus-store" VERSION : NMI NMIDR STACK NOTATION : ( addr --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : F83-URW SHORT DEFINITION: Adds one to the value at addr and stores the result at addr. LONG DEFINITION : Adds one to the value at addr and stores the result at addr. 81 NAME : 1- PRONUNCIATION : "one-minus" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( w1 --- w2 ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Subtract 1 from w1 then leaves the difference, w2 on the stack. LONG DEFINITION : w2 is the result of subtracting one from w1 ac- cording to the operation of - . 82 NAME : 1-! PRONUNCIATION : "one-minus-store" VERSION : NMI NMIDR STACK NOTATION : ( addr --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : F83-URW SHORT DEFINITION: Subtracts one from the value at addr and stores the result at addr. LONG DEFINITION : Subtracts one from the value at addr and stores the result at addr. 83 NAME : 2! PRONUNCIATION : "two-store" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 32b addr --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: Stores 32b at addr. LONG DEFINITION : 32b is stored at addr. 84 NAME : 2* PRONUNCIATION : "two-times" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( w1 --- w2 ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: Multiplies w1 by 2 to give w2. LONG DEFINITION : w2 is the result of shifting w1 left one bit. A zero is shifted into vacated bit position. 85 NAME : 2+ PRONUNCIATION : "two-plus" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( w1 --- w2 ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Adds two to w1 and leaves the sum, w2 on the stack. LONG DEFINITION : w2 is the result of adding two to w1 according to the operation of + . 86 NAME : 2- PRONUNCIATION : "two-minus" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( w1 --- w2 ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Subtracts two from w1 and leaves the result, w2 on the stack. LONG DEFINITION : w2 is the result of subtracting two from w1 ac- cording to the operation of - . 87 NAME : 2/ PRONUNCIATION : "two-divide" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n1 --- n2 ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : 83 STANDARD : F83-RWS-NL SHORT DEFINITION: divides n1 by 2, giving n2 as the result. LONG DEFINITION : n2 is the result of the arithmetically shifting n1 right one bit. The sign is included in the shift and remains unchanged. 88 NAME : 2@ PRONUNCIATION : "two-fetch" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr --- 32b ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: Returns 32b from addr. LONG DEFINITION : 32b is the value at addr. 89 NAME : 2CONSTANT PRONUNCIATION : "two-constant" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 32b --- ) # ARGUMENTS IN : 1 (2 words) # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : is removed from input stream. OUTPUT : GROUP : Definition ATTRIBUTE : STANDARD : F83-DNEWS-CL SHORT DEFINITION: Creates a double length constant for a . When is executed, 32b is left on the stack. LONG DEFINITION : A defining word executed in the form: 32b 2CONSTANT . Creates a dictionary entry for so that when is later executed, 32b will be left on the stack. 90 NAME : 2DROP PRONUNCIATION : "two-drop" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 32b --- ) # ARGUMENTS IN : 1 (2 words) # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: Removes 32b from the stack. LONG DEFINITION : 32b is removed from the data stack. 91 NAME : 2DUP PRONUNCIATION : "two-dup" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 32b --- 32b 32b ) # ARGUMENTS IN : 1 (2 words) # ARGUMENTS OUT : 2 (4 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: Duplicates 32b. LONG DEFINITION : Duplicates 32b onto the top of the data stack. 92 NAME : 2OVER PRONUNCIATION : "two-over" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 32b1 32b2 --- 32b1 32b2 32b3 ) # ARGUMENTS IN : 2 (4 words) # ARGUMENTS OUT : 3 (6 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: 32b3 is a copy of 32b1 LONG DEFINITION : Duplicates the 2nd item 32b1 of the stack onto the top of the data stack, leaving 32b. 93 NAME : 2ROT PRONUNCIATION : "two-rote" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 32b1 32b2 32b3 --- 32b2 32b3 32b1 ) # ARGUMENTS IN : 3 (6 words) # ARGUMENTS OUT : 3 (6 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: Rotates 32b1 to the top of the stack. LONG DEFINITION : The top three double numbers on the data stack are rotated, bringing the third double number to the top of the stack. 94 NAME : 2SWAP PRONUNCIATION : "two-swap" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 32b1 32b2 --- 32b2 32b1 ) # ARGUMENTS IN : 2 (4 words) # ARGUMENTS OUT : 2 (4 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: Swaps 32b1 and 32b2 on the stack. LONG DEFINITION : The top two double numbers are exchanged in position on the data stack. 95 NAME : 2VARIABLE PRONUNCIATION : "two-variable" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : is removed from input stream. OUTPUT : GROUP : Definition ATTRIBUTE : STANDARD : F83-DNEWS-CL SHORT DEFINITION: Creates double-length variable for . when is executed, its parameter field address is placed on the stack. LONG DEFINITION : A defining word executed in the form: 2VARIABLE . A dictionary entry for is created and four bytes are ALLOTed in its parameter field. This parameter field is to be used for contents of the variable. The application is responsible for initializing the contents of the variable which it creates. When is later executed, the address of its parameter field is placed on the stack. 96 NAME : : PRONUNCIATION : "colon" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- sys ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : is removed from input stream. OUTPUT : GROUP : Definition ATTRIBUTE : E (I) STANDARD : F83-RWS-CL SHORT DEFINITION: Starts the definition of a word. Definition is terminated by a ; . LONG DEFINITION : A defining word executed in the form: : ... ; Create a definition for in the compilation vocabulary and set compila- tion state. The search order is changed so that the first vocabulary in the search order is replaced by the compilation vocabulary. The compilation vocabulary is unchanged. The text from the input stream is subsequently compiled. is called a "colon definition". The newly created word definition for cannot be found in the dictionary until the correspond- ing ; or ;CODE is successfully processed. An error condition exists if a word is not found and cannot be converted to a number or if, during compilation from mass storage, the input stream is exhausted before encountering ; or ;CODE . sys is balanced with its cor- responding ; . 97 NAME : :CASE PRONUNCIATION : "colon-case" VERSION : NMI NMIDR STACK NOTATION : ( n --- ), ( --- sys ) (compiling) # ARGUMENTS IN : 1 , 0 # ARGUMENTS OUT : 0 , 1 RETURN STACK : DICTIONARY : PAD : INPUT : is removed from input stream. OUTPUT : GROUP : Definition ATTRIBUTE : (I) STANDARD : SHORT DEFINITION: Creates a dictionary entry for in cur- rent and sets the compile mode. LONG DEFINITION : A defining word used in the form: :CASE ... ; . Creates a dictionary entry for in CURRENT , and sets the compile mode. Words thus defined are called "case statements". The compilation addresses of sub- sequent words from the input stream are stored into the dictionary. At runtime a word defined by :CASE will execute only the nth definition compiled into the definition. sys is balanced with its corresponding ; . 98 NAME : ; PRONUNCIATION : "semi-colon" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( sys --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Definition ATTRIBUTE : C I 79 STANDARD : F83-RWS-CL SHORT DEFINITION: Terminates a colon-definiton. LONG DEFINITION : Stops compilation of a colon definition, allows the of this colon definition to be found in the dictionary, sets interpret state and compiles ;S . sys is balanced with cor- responding : . 99 NAME : ;CODE PRONUNCIATION : "semi-colon-code" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ), ( sys1 --- sys2 ) (compiling) # ARGUMENTS IN : 0 , 1 # ARGUMENTS OUT : 0 , 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Definition ATTRIBUTE : (I) STANDARD : F83-AEWS-CL SHORT DEFINITION: Terminates a defining-word. May only be used in compilation mode. LONG DEFINITION : Used in the form: : ... ... ;CODE ...END-CODE Stops compilation, terminates the defining word and executes ASSEMBLER . When is executed in the form: to define the new , the execution ad- dress of will contain the address of the code sequence following the ;CODE in . Execution of any will cause this machine code sequence to be executed. sys1 is balanced with its corresponding : . sys2 is balanced with its corresponding END- CODE . See: CODE DOES> 100 NAME : ;S PRONUNCIATION : "semi-colon-s" VERSION : RSC NMI NMIDR STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Interpreter ATTRIBUTE : STANDARD : F83-URW SHORT DEFINITION: Stop interpretation. LONG DEFINITION : Stops interpretation of a screen. ;S is also the run-time word compiled at the end of a colon-definition which returns execution to the calling procedure. 101 NAME : < PRONUNCIATION : "less-than" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n1 n2 --- flag ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Comparison ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Leaves a true flag on stack if n1 is less than n2. LONG DEFINITION : flag is true if n1 is less than n2. -32768 32767 < must return true. -32768 0 < must return true. 102 NAME : <# PRONUNCIATION : "less-sharp" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Format ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Starts a formatted (pictured) numeric output. Terminated by #> . LONG DEFINITION : Initialize pictured numeric ouput conversion. The words: # #> #S <# HOLD SIGN can be used to specify the conversion of a double num- ber into an ASCII text string stored in right- to-left order. 103 NAME : LONG DEFINITION : Used in conjunction with DOES> in defining words, in the form: : ... ... ; and then . When ex- ecutes, . The sequence of words between established a parameter field for . When is later executed, the sequence of words following DOES> will be executed, with the parameter field address of on the data stack. 104 NAME : PRONUNCIATION : "greater-than" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n1 n2 --- flag ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Comparison ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Returns a true flag if n1 is greater than n2. LONG DEFINITION : flag is true if n1 is greater than n2. -32768 32767 > must return false. -32768 0 > must return false. 108 NAME : >< PRONUNCIATION : "byte-swap" VERSION : NMI NMIDR STACK NOTATION : ( 8b1/8b2 --- 8b2/8b1 ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-URW SHORT DEFINITION: Swaps the upper and lower bytes of the value on the stack. LONG DEFINITION : Swaps the upper and lower bytes of the value on the top of the data stack. 109 NAME : >BODY PRONUNCIATION : "to-body" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr1 --- addr2 ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Compiler ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Leaves on the stack the parameter field ad- dress, addr2 of a given field address, addr1. LONG DEFINITION : addr2 is the parameter field address correspond- ing to the compilation address addr1. 110 NAME : >IN PRONUNCIATION : "to-in" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Interpreter ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Leaves the address of the user variable >IN which contains the number of bytes from the beginning of the input stream at any particular moment during interpretation. LONG DEFINITION : The address of a user variable which contains the present character offset within the input stream. See: WORD 111 NAME : >L PRONUNCIATION : "to-line" VERSION : NMI NMIDR STACK NOTATION : ( n --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : following >L is removed from input stream. OUTPUT : GROUP : MASS ATTRIBUTE : STANDARD : SHORT DEFINITION: Place the on line n of the current screen as designated by SCR. LONG DEFINITION : Place the following text on line n of the cur- rent screen as designated by SCR . 112 NAME : >MARK PRONUNCIATION : "forward-mark" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : (I) STANDARD : F83-SEWS-CL SHORT DEFINITION: Compiles zero in place of forward branch offset and marks it for future resolve. LONG DEFINITION : Used at the source of a forward branch. Typi- cally used after either BRANCH or ?BRANCH . Compiles space in the dictionary for a branch address which will later be resolved by >RESOLVE . 113 NAME : >R PRONUNCIATION : "to-r" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : Takes 16b from stack DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Removes 16b from user stack and place it onto return stack. LONG DEFINITION : Transfers 16b from the top of the data stack to the top of the return stack. 114 NAME : >RESOLVE PRONUNCIATION : "forward-resolve" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : (I) STANDARD : F83-SEWS-CL SHORT DEFINITION: Corrects branch offset previously compiled by >mark to current dictionary location. LONG DEFINITION : Used at the destination of a forward branch. Calculates the branch address (to the current location in the dictionary) using addr and places this branch address into the space left by >MARK . 115 NAME : ? PRONUNCIATION : "question-mark" VERSION : RSC NMI NMIDR STACK NOTATION : ( addr --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : SHORT DEFINITION: Displays the contents of addr. LONG DEFINITION : Displays the value contained at the address on the top of the stack in free format according to the current BASE . Uses the format of . . 116 NAME : ?BRANCH PRONUNCIATION : "question-branch" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( flag --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Primitive ATTRIBUTE : C STANDARD : F83-SEWS-NL SHORT DEFINITION: Compiles a conditional branch operation. LONG DEFINITION : When used in the form: COMPILE ?BRANCH a conditional branch operation is compiled. See BRANCH for further details. When executed, if flag is false the branch is performed as with BRANCH . When flag is true execution con- tinues at the compilation address immediately following the branch address. 117 NAME : ?DUP PRONUNCIATION : "question-dup" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b --- 16b 16b ), ( 0 --- 0 ) # ARGUMENTS IN : 1 , 1 # ARGUMENTS OUT : 2 , 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Duplicates 16b if it is a non-zero. LONG DEFINITION : Duplicate 16b if it is non-zero value, If it is zero, 16b is not duplicated. 118 NAME : ?TERMINAL PRONUNCIATION : "question-terminal" VERSION : RSC NMI NMIDR STACK NOTATION : ( --- flag ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : SHORT DEFINITION: True if any key is depressed. LONG DEFINITION : Tests the terminal input for actuation of any key. Generates a Boolean value. A true flag indicates actuation, whereas a false flag indi- cates non-actuation. 119 NAME : @ PRONUNCIATION : "fetch" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr --- 16b ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Replaces addr with its 16b contents on top of the stack. LONG DEFINITION : 16b is the value at addr. 120 NAME : ABORT" PRONUNCIATION : "abort-quote" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( flag --- ), ( --- ) (compiling) # ARGUMENTS IN : 1 , 0 # ARGUMENTS OUT : 0 , 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-RWS-CL SHORT DEFINITION: If flag is true, message that follows " is dis- played and the ABORT function is performed. If flag is false, the flag is dropped and execu- tion continues. LONG DEFINITION : Used in the form: flag ABORT" ccc" . When later executed, if flag is true the characters ccc, delimited by " (close quote), are dis- played and then a system dependent error abort sequence, including the function of ABORT , is performed. If flag is false, the flag is dropped and execution continues. The blank following ABORT" is not part of ccc. 121 NAME : ABORT PRONUNCIATION : "abort" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : Cleared RETURN STACK : Cleared DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Operating System ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Clears the data stack and performs the function of QUIT . LONG DEFINITION : Clears the data stack and performs the function of QUIT . No message is displayed. 122 NAME : ABS PRONUNCIATION : "absolute" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n --- u ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Leaves on the stack the absolute value, u of n. LONG DEFINITION : u is the absolute value of n. If n is -32,768 then u is the same value. 123 NAME : AGAIN PRONUNCIATION : "again" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ), ( sys --- ) (compiling) # ARGUMENTS IN : 0 , 1 # ARGUMENTS OUT : 0 , 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : (I) STANDARD : F83-URW SHORT DEFINITION: Affect an unconditional jump back to the start of a BEGIN-AGAIN loop. LONG DEFINITION : Affect an unconditional jump back to the start of a BEGIN-AGAIN loop. sys is balanced with its corresponding BEGIN . See: BEGIN 124 NAME : ALLOT PRONUNCIATION : "allot" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( w --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : No alteration, however, DP is changed. PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : F83-RWS-CL SHORT DEFINITION: Reserves w bytes of dictionary space. LONG DEFINITION : Allocates w bytes in the dictionary. The ad- dress of the next available dictionary location is updated accordingly. 125 NAME : AND PRONUNCIATION : "and" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b1 16b2 --- 16b3 ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Logic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Leaves the bitwise logical AND of 16b1 and 16b2 as 16b3. LONG DEFINITION : 16b3 is the bit-by-bit logical 'and' of 16b1 with 16b2. 126 NAME : ASSEMBLER PRONUNCIATION : "assembler" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Vocabulary ATTRIBUTE : (I) STANDARD : F83-AEWS-IL SHORT DEFINITION: Replaces the first vocabulary in the search or- der with the assembler vocabulary. LONG DEFINITION : Execution replaces the first vocabulary in the search order with the ASSEMBLY vocabulary. See: VOCABULARY 127 NAME : ATO4 PRONUNCIATION : "assembly-to-fourth" VERSION : NMI NMIDR STACK NOTATION : ( --- n ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Operating System ATTRIBUTE : STANDARD : SHORT DEFINITION: Returns address of subroutine call to high level word as indicated in D register. LONG DEFINITION : Execution returns the address of a machine code subroutine which can be used as the object of a JSR instruction to call a high level word from an assembly language routine, such as an inter- rupt process. The processor D register must contain the address of the CFA of the word to be executed. The processor Y register must point to free RAM since the high level word will use it as the Data Stack pointer. Program control will be returned to the instruction fol- lowing the JSR after completion of the specified high level word. 128 NAME : AUTOSTART PRONUNCIATION : "autostart" VERSION : RSC NMI NMIDR STACK NOTATION : ( addr --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : removed from input stream. OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : SHORT DEFINITION: Prepare autostart vector at addr which will cause to be executed upon reset. Note: addr must be on a 1K byte boundary. LONG DEFINITION : Establishes autostart pattern of memory loca- tion addr. Parameter Fieled Address (CFA+2) is placed at addr+2. 129 NAME : B/BUF PRONUNCIATION : "bytes-per-buffer" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- 1024 ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Mass ATTRIBUTE : STANDARD : F83-URW SHORT DEFINITION: Returns a constant 1024 which is the number of bytes per block buffer. LONG DEFINITION : A constant leaving 1024, the number of bytes per block buffer. 130 NAME : BASE PRONUNCIATION : "base" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Numeric ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Leaves the address of the user variable contain- ing the numeric numeric conversion radix. LONG DEFINITION: The address of a user variable containing the current numeric conversion radix. 131 NAME : BEGIN PRONUNCIATION : "begin" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ), ( --- sys ) (compiling) # ARGUMENTS IN : 0 , 0 # ARGUMENTS OUT : 0 , 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : C (I) STANDARD : F83-RWS-CL SHORT DEFINITION: Marks the start of a loop. LONG DEFINITION : Used in the form: BEGIN ... AGAIN or BEGIN ... flag UNTIL or BEGIN ... flag WHILE ... REPEAT BEGIN marks the start of a word sequence for repetitive execution. A BEGIN-UNTIL loop will be repeated until flag is true. A BEGIN-WHILE- REPEAT loop will be repeated until flag is false. The words after UNTIL or REPEAT will be executed when either loop is finished. sys is balanced with its corresponding AGAIN UNTIL or WHILE . 132 NAME : BL PRONUNCIATION : "b-l" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- 32 ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: Puts the ASCII code for a space (decimal 32) on the stack. LONG DEFINITION : Leave the ASCII character value for space (decimal 32). 133 NAME : BLANKS PRONUNCIATION : "blank" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr u --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: Sets u bytes of memory beginning at addr to the ASCII code for space (decimal 32). LONG DEFINITION : u bytes of memory beginning at addr are set to the ASCII character value for space. No action is taken if u is zero. 134 NAME : BLK PRONUNCIATION : "b-l-k" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Mass ATTRIBUTE : U STANDARD : F83-RWS-IL SHORT DEFINITION: Leaves the address of the user variable contain- ing the the number of block that is currently being interpreted. LONG DEFINITION : The address of a variable containing the number of the mass storage block being interpreted as the input stream. If the value of BLK is zero the input stream is taken from the text input buffer. 135 NAME : BLOCK PRONUNCIATION : "block" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( u --- addr ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : Reads blocks. OUTPUT : May cause write of updated screen to make buffer space. GROUP : Mass ATTRIBUTE : STANDARD : F83-RWS-DL SHORT DEFINITION: Leaves the address of the block buffer contain- ing block u. LONG DEFINITION : addr is the address of the assigned buffer of the first byte of block u. If the block occupy- ing that buffer is block u and has been UPDATEd it is transfered to mass storage before assign- ing the buffer. If block u is not already in memory, it is transferred from mass storage into an assigned block buffer. A block may not be assigned to more than one buffer. If u is not an available block, an error condition exists. Only data within the last buffer referenced by BLOCK or BUFFER is valid. The contents of a block buffer must not be changed unless the change may be transfered to mass storage. 136 NAME : BRANCH PRONUNCIATION : "branch" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Primitive ATTRIBUTE : C STANDARD : F83-SEWS-NL SHORT DEFINITION: Compiles an unconditional branch operation. LONG DEFINITION :When used in the form: COMPILE BRANCH an unconditional branch operation is compiled. A branch address must be compiled immediately following this compilation address. The branch address is typically generated by following BRANCH with MARK . 137 NAME : BUFFER PRONUNCIATION : "buffer" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( u --- addr ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : May cause write of updated screen to make buffer space. GROUP : Mass ATTRIBUTE : STANDARD : F83-RWS-DL SHORT DEFINITION: Assigns the block buffer and its address to block u. Leaves the address of the block buffer on the stack. LONG DEFINITION : Assigns a block buffer to block u. addr is the address of the first byte of the block within its buffer. This function is fully specified by the definition for BLOCK except that if the block is not already in memory it might not be transfered from mass storage. The contents of the block buffer assigned to block u by BUFFER are unspecified. 138 NAME : C! PRONUNCIATION : "c-store" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b addr --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Stores the least significant byte of 16b into addr. LONG DEFINITION :The least significant 8 bits of 16b are stored into the byte at addr. 139 NAME : C, PRONUNCIATION : "c-comma" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : Compiles 8 bits of 16b. PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: Stores the least significant byte of 16b into a byte at the next available dictionary location. LONG DEFINITION :ALLOT one byte then store the least-significant 8 bits of 16b at HERE 1- . 140 NAME : C/L PRONUNCIATION : "characters-per-line" VERSION : RSC NMI NMIDR STACK NOTATION : ( --- n ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : SHORT DEFINITION: Maximum number of characters per line. LONG DEFINITION : Leaves the number of characters (default value = 80) per input line. 141 NAME : C@ PRONUNCIATION : "c-fetch" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr --- 8b ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Fetches the 8b contents from addr. LONG DEFINITION : 8b is the contents of the byte at addr. 142 NAME : CFA PRONUNCIATION : "c-f-a" VERSION : RSC NMI NMIDR STACK NOTATION : ( pfa --- cfa ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : SHORT DEFINITION: Alter parameter field pointer address to code field address. LONG DEFINITION : Converts the parameter field address pointer (pfa ptr) of a definition to its code field ad- dress (cfa). 143 NAME : CMOVE> PRONUNCIATION : "c-move-up" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr1 addr2 u --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Moves u bytes beginning at addr1 to addr2. LONG DEFINITION : Move the u bytes beginning at address addr1 to addr2. The move begins by moving the byte at (addr1 plus u minus 1) to (addr2 plus u minus 1) and proceeds to successively lower addresses for u bytes. If u is zero nothing is moved. (Useful for sliding a string towards higher ad- dresses. 144 NAME : CMOVE PRONUNCIATION : "c-move" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr1 addr2 u --- ) # ARGUMENTS IN : 3 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Moves towards high memory the u bytes at ad- dresses addr1 and addr2. LONG DEFINITION : Move the u bytes at addresses addr1 to addr2. The byte at addr1 is moved first, proceeding toward high memory. If u is zero nothing is moved. 145 NAME : CODE PRONUNCIATION : "code" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- sys ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : is removed from input stream. OUTPUT : GROUP : Definition ATTRIBUTE : (I) STANDARD : F83-AEWS-CL SHORT DEFINITION: Creates an assembler definition. LONG DEFINITION :A defining word executed in the form: CODE ... END-CODE . Creates a dictionary entry for to be defined by a following sequence of assembly language words. Words thus defined are called code definitions. This newly created word definition for cannot be found in the dictionary until the correspond- ing END-CODE is successfully processed. Ex- ecutes ASSEMBLER . sys is balanced with its corresponding END-CODE . 146 NAME : CODE-SUB PRONUNCIATION : "code-sub" VERSION : NMI NMIDR STACK NOTATION : ( --- sys ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : is removed from input stream. OUTPUT : GROUP : Definition ATTRIBUTE : (I) STANDARD : SHORT DEFINITION: Creates an assembler definition subroutine. LONG DEFINITION : A defining word executed in the form: CODE-SUB ... END-CODE Creates a dictionary entry for to be defined by a following sequence of assembly lan- guage words. Words thus defined are called code definition subroutines. This newly created word definition for cannot be found in the dictionary until the corresponding END-CODE is successfully processed. Executes ASSEMBLER . sys is balanced with its cor- responding END-CODE . can be executed directly by naming it in input stream or can be called by a machine code definition. 147 NAME : COLD PRONUNCIATION : "cold" VERSION : RSC NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : Cleared RETURN STACK : Cleared DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Operating System ATTRIBUTE : STANDARD : SHORT DEFINITION: Cold starts FORTH. LONG DEFINITION : Max-FORTH cold start. 148 NAME : COMPILE PRONUNCIATION : "compile" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : is removed from the input stream. OUTPUT : GROUP : Compiler ATTRIBUTE : STANDARD : F83-RWS-CL SHORT DEFINITION: Copies the compilation address of the next non- immediate word following COMPILE. LONG DEFINITION : Typically used in the form: : ... COMPILE ... ; When is executed, the compilation ad- dress compiled for is compiled and not executed. is typically immediate and is typically not immediate. 149 NAME : CONSTANT PRONUNCIATION : "constant" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : is removed from input stream. OUTPUT : GROUP : Definiton ATTRIBUTE : STANDARD : F83-RWS-CL SHORT DEFINITION: Creates a dictionary entry for . LONG DEFINITION : A defining word executed in the form: 16b CONSTANT . Creates a dictionary entry for so that when is later executed, 16b will be left on the stack. 150 NAME : CONTEXT PRONUNCIATION : "context" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Vocabulary ATTRIBUTE : STANDARD : F83-SEWS-IL SHORT DEFINITION: Returns the address of a user variable that determines the vocabulary to be searched first in the dictionary. LONG DEFINITION : The address of a user variable which determines the dictionary search order. 151 NAME : CONVERT PRONUNCIATION : "convert" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( +d1 addr1 --- +d2 addr2 ) # ARGUMENTS IN : 2 (3 words) # ARGUMENTS OUT : 2 (3 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Numeric ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Converts an input string into a number. LONG DEFINITION : +d2 is the result of converting the characters within the text beginning at addr1+1 into digits, using the value of BASE , and accumulat- ing each into +d1 after multiplying +d1 by the value of BASE . Conversion continues until an unconvertible character is encountered. addr2 is the location of the first unconvertible character. 152 NAME : COUNT PRONUNCIATION : "count" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr1 --- addr2 +n ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 2 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Format ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Leaves the address, addr2 and the character count +n of text beginning at addr1. LONG DEFINITION : addr2 is addr1+1 and n1 is the length of the counted string at addr1. The byte at addr1 con- tains the byte count +n. Range of +n is {0...255}. 153 NAME : CR PRONUNCIATION : "c-r" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-RWS-DL SHORT DEFINITION: Generates a carriage return and line feed. LONG DEFINITION : Displays a carriage return and line-feed or equivalent operation. 154 NAME : CREATE PRONUNCIATION : "create" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : is removed from input stream. OUTPUT : GROUP : Definition ATTRIBUTE : STANDARD : F83-RWS-CL SHORT DEFINITION: Creates a dictionary entry for . LONG DEFINITION : A defining word executed in the form: CREATE . Creates a dictionary entry for name . After is created, the next available dictionary location is the first byte of 's parameter field. When is subsequently executed, the address of the first byte of 's parameter field is left on the stack. CREATE does not allocate space in 's parameter field. 155 NAME : CURRENT PRONUNCIATION : "current" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Vocabulary ATTRIBUTE : STANDARD : F83-SEWS-IL SHORT DEFINITION: Returns the address of the user variable specifying the vocabulary into which new word definitions will be entered. LONG DEFINITION : The address of a user variable specifying the vocabulary in which new word definitions are appended. 156 NAME : D+ PRONUNCIATION : "d-plus" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( wd1 wd2 --- wd3 ) # ARGUMENTS IN : 2 (4 words) # ARGUMENTS OUT : 1 (2 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL F83-DNEWS-NL SHORT DEFINITION: Adds wd1 and wd2 and leaves the result, wd3 on stack. LONG DEFINITION : wd3 is the arithmetic sum of wd1 plus wd2. 157 NAME : D- PRONUNCIATION : "d-minus" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( wd1 wd2 --- wd3 ) # ARGUMENTS IN : 2 (4 words) # ARGUMENTS OUT : 1 (2 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: Subtracts wd2 from wd1 and returns the dif- ference wd3. LONG DEFINITION :wd3 is the result of subtracting wd2 from wd1. 158 NAME : D. PRONUNCIATION : "d-dot" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( d --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : Bytes below PAD modified as temporary area where +n is converted to string. INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-DNEWS-IL SHORT DEFINITION: Displays the value of d. LONG DEFINITION : The value of d is displayed in a free field for- mat. A leading negative sign is displayed if d is negative. 159 NAME : D.R PRONUNCIATION : "d-dot-r" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( d +n --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : Bytes below PAD modified as temporary area where +n is converted to string. INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-DNEWS-IL SHORT DEFINITION: Displays the value of d right justified in a field +n characters wide. LONG DEFINITION : d is converted using the value of BASE and then displayed right aligned in a field n characters wide. A leading minus sign is displayed if d is negative. If the number of characters re- quired to display d is greater than +n, an er- ror condition exists. 160 NAME : D0= PRONUNCIATION : "d-zero-equals" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( wd --- flag ) # ARGUMENTS IN : 1 (2 words) # ARGUMENTS OUT : 1 (1 word) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Comparison ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: Returns a true flag if wd is equal to zero. LONG DEFINITION : flag is true if wd is zero. 161 NAME : D2/ PRONUNCIATION : "d-two-divide" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( d1 --- d2 ) # ARGUMENTS IN : 1 (2 words) # ARGUMENTS OUT : 1 (2 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: Divides d1 by 2 and gives quotient d2. LONG DEFINITION : d2 is the result of d1 arithmetically shifted right one bit. The sign is included in the shift and remains unchanged. 162 NAME : D< PRONUNCIATION : "d-less-than" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( d1 d2 --- flag ) # ARGUMENTS IN : 2 (4 words) # ARGUMENTS OUT : 1 (1 word) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Comparison ATTRIBUTE : STANDARD : F83-RWS-NL F83-DNEWS-NL SHORT DEFINITION: Leaves a true flag if d1 is less than d2; other- wise leaves a false flag. LONG DEFINITION : Flag is true if d1 is less than d2 according to the operation of < except extended to 32 bits. 163 NAME : D= PRONUNCIATION : "d-equals" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( wd1 wd2 --- flag ) # ARGUMENTS IN : 2 (4 words) # ARGUMENTS OUT : 1 (1 word) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Comparison ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: Returns a true flag if wd1 is equal to wd2. LONG DEFINITION : flag is true if wd1 equals wd2. 164 NAME : DABS PRONUNCIATION : "d-absolute" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( d --- ud ) # ARGUMENTS IN : 1 (2 words) # ARGUMENTS OUT : 1 (2 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: Returns the absolute value of d as ud. LONG DEFINITION : ud is the absolute value of d. If d is -2,147,483,648 then ud is the same value. 165 NAME : DECIMAL PRONUNCIATION : "decimal" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Numeric ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Sets the input-output numeric conversion base to ten. LONG DEFINITION : Set the input-output numeric conversion base to ten. 166 NAME : DEFINITIONS PRONUNCIATION : "definitions" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Vocabulary ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Specify the vocabulary into which new defini- tions are to be added. LONG DEFINITION : The compilation vocabulary is changed to be the same as the first vocabulary in the search or- der. 167 NAME : DEPTH PRONUNCIATION : "depth" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- +n ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Returns count +n of numbers on the data stack. LONG DEFINITION : +n is the number of 16-bit values contained in the data stack before +n was placed on the stack. 168 NAME : DMAX PRONUNCIATION : "d-max" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( d1 d2 --- d3 ) # ARGUMENTS IN : 2 (4 words) # ARGUMENTS OUT : 1 (2 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: Returns d3 as the greater of d1 or d2. LONG DEFINITION : d3 is the greater of d1 and d2. 169 NAME : DMIN PRONUNCIATION : "d-min" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( d1 d2 --- d3 ) # ARGUMENTS IN : 2 (4 words) # ARGUMENTS OUT : 1 (2 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: Returns d3 as the lesser of d1 or d2. LONG DEFINITION : d3 is the lesser of d1 and d2. 170 NAME : DNEGATE PRONUNCIATION : "d-negate" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( d1 --- d2 ) # ARGUMENTS IN : 1 (2 words) # ARGUMENTS OUT : 1 (2 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL F83-DNEWS-NL SHORT DEFINITION: Leaves the two's complement d2 of d1. LONG DEFINITION : d2 is the two's complement of d1. 171 NAME : DO PRONUNCIATION : "do" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( w1 w2 --- ), ( --- sys ) (compiling) # ARGUMENTS IN : 2 , 0 # ARGUMENTS OUT : 0 , 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : C (I) STANDARD : F83-RWS-CL SHORT DEFINITION: Repeats execution of words between DO LOOPs and DO +LOOPs, the number of times is specified by the limit from w2 to w1. LONG DEFINITION : Used in the form: DO ... LOOP or DO ... +LOOP Begins a loop which terminates based on control parameters. The loop index begins at w2, and terminates based on the limit w1. See LOOP and +LOOP for details on how the loop is ter- minated. The loop is always executed at least once. For example: w DUP DO ... LOOP ex- ecutes 65,536 times. sys is balanced with its corresponding LOOP or +LOOP . An error con- dition exists if insufficient space is avail- able for at least three nesting levels. 172 NAME : DOES> PRONUNCIATION : "does" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ), ( --- ) (compiling) # ARGUMENTS IN : 0 , 0 # ARGUMENTS OUT : 1 , 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Definition ATTRIBUTE : STANDARD : F83-RWS-CL SHORT DEFINITION: Marks the termination of the defining part of the defining word and begins the defini- tion of the run-time action for words that will later be defined by . LONG DEFINITION : Defines the execution time action of a word created by a high level defining word. Used in the form: : ... ... DOES> ... ; and then where is CREATE or any user defined word which ex- ecutes CREATE . Marks the termination of the defining part of the defining word and then begins the definition of the execution- time is later executed, the address of 's parameter field is placed on the stack and then the sequence of words between DOES> and ; are executed. 173 NAME : DP PRONUNCIATION : "d-p" VERSION : RSC NMI NMIDR STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : U STANDARD : SHORT DEFINITION: Put Dictionary Pointer address on stack. LONG DEFINITION : Leaves the address of user variable, the dic- tionary pointer, which points to address the next free memory address above the dictionary. The value may be read by HERE and altered by ALLOT . 174 NAME : DPL PRONUNCIATION : "d-p-l" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Format ATTRIBUTE : U STANDARD : F83-URW SHORT DEFINITION: Returns the address of the user variable con- taining the number of places after the frac- tional point for input conversion. LONG DEFINITION : Returns the address of the user variable con- taining the number of places after the frac- tional point for input conversion. 175 NAME : DROP PRONUNCIATION : "drop" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Removes 16b from the data stack. LONG DEFINITION : 16b is removed from the data stack. 176 NAME : DU< PRONUNCIATION : "d-u-less" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( ud1 ud2 --- flag ) # ARGUMENTS IN : 2 (4 words) # ARGUMENTS OUT : 1 (1 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Comparison ATTRIBUTE : STANDARD : F83-DNEWS-NL SHORT DEFINITION: Returns a true flag if ud1 is less than ud2. LONG DEFINITION :flag is true if ud1 is less than ud2. Both num- bers are unsigned. 177 NAME : DUMP PRONUNCIATION : "dump" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr u --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: Displays u bytes of memory starting at addr. LONG DEFINITION : List the contents of u addresses starting at addr. Each line of values may be preceded by the address of the first value, with a 16 memory location displayed per line. 178 NAME : DUP PRONUNCIATION : "dup" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b --- 16b 16b ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 2 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Duplicates 16b. LONG DEFINITION :Duplicates the 16b on top of the data stack to the top of the data stack. 179 NAME : EDITOR PRONUNCIATION : "editor" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Vocabulary ATTRIBUTE : (I) STANDARD : F83-CRW SHORT DEFINITION: Makes the editor vocabulary the first to be searched. LONG DEFINITION : Execution replaces the first vocabulary in the search order with EDITOR vocabulary. See: VOCABULARY 180 NAME : EEC! PRONUNCIATION : "e-e-c-store" VERSION : NMI NMIDR STACK NOTATION : ( 16b addr --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : SHORT DEFINITION:Stores the least significant byte of 16b into addr in EEPROM. LONG DEFINITION :The addr in EEPROM is erased, then least sig- nificant 8 bits of 16b are programmed into the byte at addr. The time period of the program- ming is set by C/10MS and Timer Output Capture for both the erasure and programming cycles. 181 NAME : EEMOVE PRONUNCIATION : "e-e-move" VERSION : NMI NMIDR STACK NOTATION : ( addr1 addr2 u --- ) # ARGUMENTS IN : 3 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : SHORT DEFINITION: Moves towards high memory the u bytes at ad- dresses addr1 and addr2. addr2 should be in EEPROM. LONG DEFINITION : Move the u bytes at addresses addr1 to addr2. The byte at addr1 is moved first, proceeding toward high memory. If u is zero, nothing is moved. addr2 should be in EEPROM. EEC! is used to accomplish this function. See EEC! 182 NAME : EEWORD PRONUNCIATION : "e-e-word" VERSION : NMI NMIDR STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY :If not headerless, the complete definition or if headerless, the code field and parameter field, of latest definition move from code to EEPROM dictionary. PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : SHORT DEFINITION: Moves code of last defined word from the codes memory to the EEPROM memory. LONG DEFINITION : Latest defined word's complete definition if not headerless, or the code section if header- less is lifted from codes dictionary, relinked and placed in the EEPROM dictionary. Diction- ary pointers are re-adjusted accordingly. 183 NAME : ELSE PRONUNCIATION : "else" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ), ( sys1 --- sys2 ) (compiling) # ARGUMENTS IN : 0 , 1 # ARGUMENTS OUT : 0 , 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : I C STANDARD : F83-RWS-CL SHORT DEFINITION: Allows execution of words between IF and ELSE if the flag is true, otherwise, it forces execu- tion of words after ELSE. LONG DEFINITION : Used in the form: flag IF ... ELSE ... THEN ELSE executes after the true part following IF . ELSE forces execution to continue at just after THEN . sys1 is balanced with its cor- responding IF . sys2 is balanced with its corresponding THEN . See: IF THEN . 184 NAME : EMIT PRONUNCIATION : "emit" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-RWS-DL SHORT DEFINITION: Displays the ASCII equivalent of 16b onto the screen. LONG DEFINITION : The least significant 7-bit ASCII character is displayed. 185 NAME : EMPTY-BUFFERS PRONUNCIATION : "empty-buffers" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Mass ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: Removes the update status and removes assign- ments of all blocks to buffers. LONG DEFINITION : Unassign all block buffers. UPDATEd blocks are not written to mass storage. See: BLOCK . 186 NAME : END-CODE PRONUNCIATION : "end-code" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( sys --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Definition ATTRIBUTE : (I) STANDARD : F83-AEWS-CL SHORT DEFINITION: Terminates an assembler definition. LONG DEFINITION : Terminates a code definition and allows the of the corresponding code definition to be found in the dictionary. sys is balanced with its corresponding CODE or ;CODE . 187 NAME : END PRONUNCIATION : "end" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( flag --- ), ( sys --- ) (compiling) # ARGUMENTS IN : 1 , 1 # ARGUMENTS OUT : 0 , 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : I C STANDARD : F83-CRW SHORT DEFINITION: Performs the same function as UNTIL . See UNTIL . LONG DEFINITION : A synonym for UNTIL . 188 NAME : ERASE PRONUNCIATION : "erase" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr u --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: Sets u bytes of memory to zero, beginning at addr. LONG DEFINITION : u bytes of memory beginning at addr are set to zero. No actionis taken if u is zero. 189 NAME : EXECUTE PRONUNCIATION : "execute" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Compiler ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Executes the definition found at addr. LONG DEFINITION : The word definition indicated by addr is ex- ecuted. An error condition exists if addr is not a compilation address. 190 NAME : EXIT PRONUNCIATION : "exit" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Interpreter ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Causes execution to leave the current word and go back to where the word was called from. LONG DEFINITION : Compiled within a colon definition such that when executed, that colon definition returns control to the definition that passed control to it by returning control to the return point on the top of the return stack. An error condi- tion exists if the top of the return stack does not contain a valid return point. May not be used within a do-loop. 191 NAME : EXPECT PRONUNCIATION : "expect" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr +n --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-RWS-DL SHORT DEFINITION: Stores up to +n characters into memory begin- ning at addr. LONG DEFINITION : Receive characters and store each into memory. The transfer begins at addr proceeding towards higher addresses one byte per character until either "return" is received or until +n charac- ters have been transfered. No more than +n characters will be stored. The "return" is not stored into memory. No characters are received or transfered if +n is zero. All characters actually received and stored into memory will be displayed, with the "return" displaying as a space. 192 NAME : FILL PRONUNCIATION : "fill" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr u 8b --- ) # ARGUMENTS IN : 3 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Memory ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Fills u bytes, beginning at addr, with byte pat- tern 8b. LONG DEFINITION : u bytes of memory beginning at addr are set to 8b. No action is taken if u is zero. 193 NAME : FIND PRONUNCIATION : "find" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr1 --- addr2 n ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 2 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Interpreter ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Obtains an address of counted strings, addr1 from the stack. Searches the dictionary for the string. LONG DEFINITION : addr1 is the address of the counted string. The string contains a word name to be located in the currently active search order. If the word is not found, addr2 is the string address (addr1) and n is zero. If the word is found, addr2 is the compilation address and n is set to one of two non-zero values. If the word found has the immediate attribute, n is set to one. If the word is non-immediate, n is set to minus 1 (true). 194 NAME : FIRST PRONUNCIATION : "first" VERSION : RSC NMI NMIDR STACK NOTATION : ( --- n ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Mass ATTRIBUTE : STANDARD : SHORT DEFINITION: Leaves address of first block buffer. LONG DEFINITION : Leaves the first (lowest) address of the data (or mass storage buffer). 195 NAME : FLD PRONUNCIATION : "f-l-d" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Format ATTRIBUTE : STANDARD : F83-URW SHORT DEFINITION: Returns the address of the user variable which contains the value of the field length reserved for a number during output conversion. LONG DEFINITION : A user variable pointing to the field length reserved for a number during output conversion. 196 NAME : FLUSH PRONUNCIATION : "flush" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : Writes updated blocks. GROUP : Mass ATTRIBUTE : STANDARD : F83-RWS-DL SHORT DEFINITION: Performs the functions of the SAVE-BUFFERS then unassign all block buffers. LONG DEFINITION : Performs the function of SAVE-BUFFERS then unas- signs all block buffers. (This may be useful for mounting or changing mass storage media) 197 NAME : FORGET PRONUNCIATION : "forget" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : Removes multiple definitions, DP is "backed up". PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Deletes from the dictionary. LONG DEFINITION : Used in the form: FORGET . If is found in the compilation vocabulary, delete from the dictionary and all words added to the dictioanry after regardless of their vocabulary. Failure to find is an error condition. An error condition also exists if the compilation vocabulary is deleted. 198 NAME : FORTH-83 PRONUNCIATION : "forth-eighty-three" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Vocabulary ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Initializes FORTH-83 into the system. LONG DEFINITION : Assures that a FORTH-83 Standard System is available, otherwise an error condition exists. Execution has no action other than an immediate return to calling routine. 199 NAME : FORTH PRONUNCIATION : "forth" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Vocabulary ATTRIBUTE : (I) STANDARD : F83-RWS-IL SHORT DEFINITION: Replaces the first vocabulary in the search or- der with FORTH. LONG DEFINITION : The name of the primary vocabulary. Execution replaces the first vocabulary in the search or- der with FORTH . FORTH is initially the com- pilation vocabulary and the first vocabulary in the search oder. New definitions become part of FORTH vocabulary until adifferent compila- tion vocabulary is established. See: "VOCABULARY" 200 NAME : H/C PRONUNCIATION : "h-slash-c" VERSION : RSC NMI NMIDR STACK NOTATION : ( addr --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY :Separates heads and codes dictionaries for all successive definitions. PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : SHORT DEFINITION: Separate heads and codes portions of definition to different place in memory. LONG DEFINITION : Separates heads and codes dictionary. Heads are set to generate at addr. DP/ is assigned this addr. Codes are set to generate at value of DP prior to execution. HEADERLESS is set to true. Results are displayed for verification. 201 NAME : HERE PRONUNCIATION : "here" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Leaves the address of the next available dic- tionary location. LONG DEFINITION : The address of the next available dictionary location is left on the stack. 202 NAME : HEX PRONUNCIATION : "hex" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Numeric ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: Sets the numeric input-output conversion base to sixteen. LONG DEFINITION : Set the numeric input-output conversion base to sixteen. 203 NAME : HOLD PRONUNCIATION : "hold" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( char --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : Modification of string below PAD . INPUT : OUTPUT : GROUP : Format ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Inserts character into a pictured numeric out- put string. LONG DEFINITION : char is inserted into a pictured numeric output string. Typically used between <# and #> . 204 NAME : HWORD PRONUNCIATION : "h-word" VERSION : RSC NMI NMIDR STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : The code field and parameter field of latest definition move from code to heads diction- ary. PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : SHORT DEFINITION: Moves codes portion of last defined word from the codes memory to the heads memory. LONG DEFINITION : Latest defined word's code section is lifted from codes dictionary, relinked and placed in the heads dictionary. Dictionary pointers are re-adjusted accordingly. 205 NAME : I PRONUNCIATION : "i" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- w ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Places the loop index onto the stack. LONG DEFINITION : w is the copy of the loop index. May only be used in the form: DO ... I ... LOOP or DO ... I ... +LOOP . 206 NAME : ID. PRONUNCIATION : "i-d-dot" VERSION : RSC NMI NMIDR STACK NOTATION : ( nfa --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : SHORT DEFINITION: Print given name field address (NFA). LONG DEFINITION : Prints a definition's name from it's name field address. 207 NAME : IF PRONUNCIATION : "if" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( flag --- ), ( --- sys ) (compiling) # ARGUMENTS IN : 1 , 0 # ARGUMENTS OUT : 0 , 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : (I) STANDARD : F83-RWS-CL SHORT DEFINITION: Allows a program to branch on condition. LONG DEFINITION : Used in the form: flag IF ... ELSE ... THEN or flag IF ... THEN If flag is true, the words following IF are executed and the words following ELSE un- til just after THEN are skipped. The ELSE part is optional. If flag is false, words from IF through ELSE , or from IF through THEN (when no ELSE is used) are skipped. sys is balanced with its corresponding ELSE or THEN . 208 NAME : IMMEDIATE PRONUNCIATION : "immediate" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Compiler ATTRIBUTE : STANDARD : F83-RWS-CL SHORT DEFINITION: Marks the most recently created dictionary entry as a word that will be executed im- mediately even if FORTH is in compile mode. LONG DEFINITION : Marks the most recently created dictionary entry as a word which will be executed when en- countered during compilation rather than com- piled. 209 NAME : INDEX PRONUNCIATION : "index" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( u1 u2 --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : Reads blocks. OUTPUT : Lists lines to terminal, may cause write of up- dated screen to make buffer space. GROUP : Mass ATTRIBUTE : STANDARD : F83-URW SHORT DEFINITION: Displays the top line from each block in a range of blocks starting at block u1 to u2. LONG DEFINITION : Print the first line of each screen over the range {u1...u2}. This displays the first line of each screen of source text, which convention- ally contains a title. 210 NAME : INTERPRET PRONUNCIATION : "interpret" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Interpreter ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: Begins text interpretation at the character in- dexed by the contents of >IN relative to the block number contained in BLK, continuing until the input stream is exhausted. LONG DEFINITION : Begin text interpretation at the character in- dexed by the contents of >IN relative to the block number contained in BLK , continuing un- til the input stream is exhausted. If BLK con- tains zero, interpret characters from the text input buffer. 211 NAME : J PRONUNCIATION : "j" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- w ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Returns the index of the next outer loop. LONG DEFINITION : w is a copy of the index of the next outer loop. May only be used within a nested DO- LOOP or DO-+LOOP in the form, for example: DO ... DO ... J ... LOOP ... +LOOP 212 NAME : K PRONUNCIATION : "k" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- w ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: Returns the index of the second outer loop in nested do loops. LONG DEFINITION : w is the copy of the index of the second outer loop. May only be used within a nested DO-LOOP or DO-+LOOP in the form for example: DO ... DO ... DO ... K ... LOOP ... +LOOP ... LOOP 213 NAME : KEY PRONUNCIATION : "key" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- 16b) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-RWS-DL SHORT DEFINITION: Pauses to wait for a key to be pressed and then places the ASCII value of the key (n) on the stack. LONG DEFINITION : The least-significant 7 bits of 16b is the next ASCII character received. All valid ASCII characters can be received. Control characters are not processed by the system for any edit- ing purpose. Characters received by KEY will not be displayed. 214 NAME : LATEST PRONUNCIATION : "latest" VERSION : RSC NMI NMIDR STACK NOTATION : ( --- nfa ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : SHORT DEFINITION: Leaves name field address (nfa) of top word in CURRENT. LONG DEFINITION : Leaves the name field address of the top-most word in the CURRENT vocabulary. 215 NAME : LEAVE PRONUNCIATION : "leave" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : Removal of loop control parameters (2 words) DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : (I) STANDARD : F83-RWS-CL SHORT DEFINITION: Forces termination of a DO LOOP. LONG DEFINITION : Transfers execution to just beyond the next LOOP or +LOOP . The loop is terminated and loop control parameters are discarded. May only be used in the form: DO ... LEAVE ... LOOP or DO ... LEAVE ... +LOOP LEAVE may appear within other control struc- tures which are nested within the do-loop structure. More than one LEAVE may appear within a do-loop. 216 NAME : LFA PRONUNCIATION : "l-f-a" VERSION : RSC NMI NMIDR STACK NOTATION : ( pfaptr --- lfa ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : SHORT DEFINITION: Alter parameter field pointer address to link field address. LONG DEFINITION : Converts the parameter field address pointer pfaptr of a dictionary definition to its link field address (lfa). 217 NAME : LIMIT PRONUNCIATION : "limit" VERSION : RSC NMI NMIDR STACK NOTATION : ( --- n ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Mass ATTRIBUTE : STANDARD : SHORT DEFINITION: Top of memory LONG DEFINITION : Leaves the highest address plus one available in the data (or mass storage) buffer. Usually this is the highest system memory. 218 NAME : LIST PRONUNCIATION : "list" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( u --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : Reads block if not RAM resident. OUTPUT : Lists screen, may cause write of updated screen to make buffer space. GROUP : Mass ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: Lists the block whose number is u. SCR is set to u. LONG DEFINITION : The contents of screen u are displayed. SCR is set to u. See: BLOCK 219 NAME : LITERAL PRONUNCIATION : "literal" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Compiler ATTRIBUTE : I C STANDARD : F83-RWS-CL SHORT DEFINITION: Compile a system dependent operation so that when later executed, 16b will be left on the stack. LONG DEFINITION : Typically used in the form: [ 16b] LITERAL Com- piles a system dependent operation so that when later executed, 16b will be left on the stack. 220 NAME : LOAD PRONUNCIATION : "load" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( u --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : Reads blocks. OUTPUT : May cause write of updated screen to make buffer space. GROUP : Mass ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Begins interpretation of block u. LONG DEFINITION : The contents of IN to zero and BLK to u. The screen is then interpreted. If interpreta- tion from screen u is not terminated explicitly it will be terminated when the input stream is exhausted and then the contents of >IN and BLK will be restored. An error condition exists if u is zero. See: >IN BLK BLOCK . 221 NAME : LOOP PRONUNCIATION : "loop" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( ---- ), ( sys --- ) (compiling) # ARGUMENTS IN : 0 , 1 # ARGUMENTS OUT : 0 , 0 RETURN STACK :Conditional removal of loop control parameters (2 words). DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : I C STANDARD : F83-RWS-CL SHORT DEFINITION: Defines the end point of a do-loop. LONG DEFINITION : Increments the DO-LOOP by one. If the new in- dex was incremented across the boundary between limit-1 and limit the loop is terminated and loop control parameters are discarded. When the loop is not terminated, execution continues to just after the corresponding DO. sys is balanced with its corresponding DO . See DO . 222 NAME : MAX PRONUNCIATION : "max" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n1 n2 --- n3 ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Leaves the greater of n1 and n2 as n3. LONG DEFINITION : n3 is the greater of n1 and n2 according to the operation of > 223 NAME : MIN PRONUNCIATION : "min" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n1 n2 --- n3 ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Leaves the lessr of n1 and n2 as n3. LONG DEFINITION : n3 is the lesser of n1 and n2 according to the operation of < . 224 NAME : MOD PRONUNCIATION : "mod" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n1 n2 --- n3 ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Divides n1 by n2 and leaves the remainder n3. LONG DEFINITION : n3 is the remainder after dividing n1 by the divisor n2. n3 has the same sign as n2 or is zero. An error condition results if the divisor is zero or if the quotient falls out- side the range {32,768...32,768}. 225 NAME : NEGATE PRONUNCIATION : "negate" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n1 --- n2 ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Leaves the two's complement n2 of n1. LONG DEFINITION : n2 is the two's complement of n1, i.e., the dif- ference of zero less n1. 226 NAME : NFA PRONUNCIATION : "n-f-a" VERSION : RSC NMI NMIDR STACK NOTATION : ( pfaptr - nfa ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : SHORT DEFINITION: Alter parameter field pointer address to name field address. LONG DEFINITION : Converts the parameter field address pointer pfaptr of a definition to its name field ad- dress (nfa). 227 NAME : NOT PRONUNCIATION : "not" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b1 --- 16b2 ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Logic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Leaves the one's complement 16b2 of 16b1. LONG DEFINITION : 16b2 is the one's complement of 16b1. 228 NAME : NUMBER PRONUNCIATION : "number" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr --- d ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Format ATTRIBUTE : STANDARD : F83-URW SHORT DEFINITION: Converts the counted string at addr to d accord- ing to the value of BASE . LONG DEFINITION : Convert the count and character string at addr, to a signed 32-bit integer, using the value of BASE . If numeric conversion is not possible, an error condition exists. The string may con- tain a preceding minus sign. 229 NAME : OFFSET PRONUNCIATION : "offset" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Mass ATTRIBUTE : U STANDARD : F83-CRW SHORT DEFINITION: Returns the address of the user variable that contains a block offset to mass storage. LONG DEFINITION : The address of the user variable that contains the offset added to the block number on the stack by BLOCK or BUFFER to determine the ac- tual physical block number. 230 NAME : OR PRONUNCIATION : "or" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b1 16b2 --- 16b3 ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Logic ATTRIBUTE : STANDARD : SHORT DEFINITION: Leaves the inclusive-or 16b3 of 16b1 an 16b2. LONG DEFINITION : 16b3 is the bit-by-bit inclusive-or of 16b1 with 16b2. 231 NAME : OVER PRONUNCIATION : "over" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b1 16b2 --- 16b1 16b2 16b3 ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 3 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: 16b3 is a copy of 16b1. LONG DEFINITION : Duplicates the second item from the top of the data stack onto the data stack. 232 NAME : PAD PRONUNCIATION : "pad" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Puts onto stack the starting address in memory of scratchpad. LONG DEFINITION : The lower address of a scratch area used to hold data for intermediate processing. The ad- dress or contents of PAD may change and the data lost if the address of the next available dictionary location is changed. 233 NAME : PFAPTR PRONUNCIATION : "p-f-a-pointer" VERSION : RSC NMI NMIDR STACK NOTATION : ( nfa --- pfaptr ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : SHORT DEFINITION: Alter name field address to parameter field pointer address. LONG DEFINITION : Converts the name field address (nfa) of a pointer dictionary definition to its parameter field address (pfaptr). 234 NAME : PICK PRONUNCIATION : "pick" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( +n --- 16b ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Copies the data stack's +nth item onto the top. LONG DEFINITION : 16b is a copy of the +nth data stack value, not counting +n itself. 0 PICK is equivalent to DUP . 1 PICK is equivalent to OVER . 235 NAME : QUERY PRONUNCIATION : "query" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: Stores input characters into text input buffer. LONG DEFINITION : Characters are received and transfered into the memory area addressed by TIB . The transfer terminates when either a "return" is received or the number of characters transferred reaches the value of characters per line, C/L . The values of >IN and BLK are set to zero and the value of #TIB is set to the value of SPAN . WORD may be used to accept text from this buf- fer. 236 NAME : QUIT PRONUNCIATION : "quit" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : Cleared. DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Interpreter ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Clears the return stack, stops compilation and returns control to current input device. LONG DEFINITION : Clears the return stack, sets interpret state, accepts new input from the current input device and begins text interpretation. No message is displayed. 237 NAME : R> PRONUNCIATION : "r-from" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- 16b ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : 16b removed DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: 16b is removed from the return stack and placed onto the data stack. LONG DEFINITION : 16b is removed from the return stack and trans- ferred to the data stack. 238 NAME : R@ PRONUNCIATION : "r-fetch" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- 16b ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : Copies 16b onto the data stack DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: 16b is a copy of the top of the return stack. LONG DEFINITION : Copies 16b from the top of the return stack onto the data/parameter stack. 239 NAME : RECURSE PRONUNCIATION : "recurse" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : Compiles address PAD : INPUT : OUTPUT : GROUP : Compiler ATTRIBUTE : C I 83 STANDARD : F83-CRW SHORT DEFINITION: Compile the compilation address of definition currently being defined. LONG DEFINITION: Compile the compilation address of the defini- tion currently being compiled to cause the definition to later be executed recursively. 240 NAME : REPEAT PRONUNCIATION : "repeat" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ), ( sys --- ) (compiling) # ARGUMENTS IN : 0 , 1 # ARGUMENTS OUT : 0 , 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : I C STANDARD : F83-RWS-CL SHORT DEFINITION: Terminates a BEGIN...WHILE...REPEAT loop. LONG DEFINITION : Used in the form: BEGIN ... flag WHILE ...REPEAT At execution time, REPEAT continues execution to just after the corresponding BEGIN . sys is balanced with corresponding WHILE . See BEGIN . 241 NAME : ROLL PRONUNCIATION : "roll" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( +n --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Removes the stack's nth item and places it onto the top of stack. LONG DEFINITION : The nth stack value, not counting +n itself is first removed and then transfered to the top of the stack, moving the remaining values into the vacated position. 2 ROLL is equivalent to ROT . 0 ROLL is a null operation. 242 NAME : ROT PRONUNCIATION : "rot" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b1 16b2 16b3 --- 16b2 16b3 16b1 ) # ARGUMENTS IN : 3 # ARGUMENTS OUT : 3 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Rotates 16b1 to the top of the stack. LONG DEFINITION : The top three stack entries are rotated, bring- ing the deepest to the top. 243 NAME : S->D PRONUNCIATION : "s-to-d" VERSION : RSC NMI NMIDR STACK NOTATION : ( n --- d ) # ARGUMENTS IN : 1 (1 word) # ARGUMENTS OUT : 1 (2 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : SHORT DEFINITION: Sign extend single number to double number. LONG DEFINITION : Extends the sign of single number n to form double number d. 244 NAME : S0 PRONUNCIATION : "s-zero" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : U STANDARD : F83-URW SHORT DEFINITION: Returns the address of the variable containing the initial value of the bottom of the stack. LONG DEFINITION : A user variable containing the address of the bottom of the stack. 245 NAME : SAVE-BUFFERS PRONUNCIATION : "save-buffers" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : Writes updated blocks. GROUP : Mass ATTRIBUTE : STANDARD : F83-RWS-DL SHORT DEFINITION: Copies the contents of all block buffers marked as UPDATEd to their corresponding mass-storage blocks. LONG DEFINITION : The contents of all block buffers marked as UP- DATEd are written to their corresponding mass storage blocks. All buffers are marked as no longer being modified, but may remain assigned. 246 NAME : SCR PRONUNCIATION : "s-c-r" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Mass ATTRIBUTE : U STANDARD : F83-CRW SHORT DEFINITION: Returns the address of the user variable con- taining the number of block most recently listed. LONG DEFINITION : The address of a user variable containing the number of the screen most recently LISTed. 247 NAME : SIGN PRONUNCIATION : "sign" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( n --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : Conditional modification of string below PAD . INPUT : OUTPUT : GROUP : Format ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Appends an ASCII " - " (minus sign) to the start of a pictured numeric output string if n is negative. LONG DEFINITION : If n is negative, as ASCII "-" (minus sign) is appended to the pictured numeric out- put string. Typically used between <# and #> . 248 NAME : SP@ PRONUNCIATION : "s-p-fetch" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: addr is the address of the top of the parameter stack just before SP@ was executed. LONG DEFINITION : Returns the address of the top of the parameter stack before SP@ is executed. 249 NAME : SPACE PRONUNCIATION : "space" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-RWS-DL SHORT DEFINITION: Sends a space (blank) to the current output device. LONG DEFINITION : Displays an ASCII space. 250 NAME : SPACES PRONUNCIATION : "spaces" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( +n --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-RWS-DL SHORT DEFINITION: Sends +n spaces (blanks) to the current output device. LONG DEFINITION : Displays +n ASCII spaces. Nothing is displayed if +n is zero. 251 NAME : SPAN PRONUNCIATION : "span" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : U STANDARD : F83-RWS-IL SHORT DEFINITION: Returns the address of the user variable that contains the count of characters received and stored by the most recent execution of EXPECT . LONG DEFINITION : The address of the user variable containing the count of characters actually received and stored by the last execution of EXPECT . 252 NAME : STATE PRONUNCIATION : "state" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Compiler ATTRIBUTE : U STANDARD : F83-RWS-CL SHORT DEFINITION: Returns the address of the user variable that contains a value defining the compilation state. LONG DEFINITION : The address of the user variable containing the compilation state. A non-zero content indi- cates compilation is occuring, but the value itself is system dependent. A Standard Program may not modify this variable. 253 NAME : SWAP PRONUNCIATION : "swap" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b1 16b2 --- 16b2 16b1 ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 2 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Stack ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Exchanges positions of the top two items of the stack. LONG DEFINITION : The top two data stack entries are exchanged in position on the stack. 254 NAME : TASK PRONUNCIATION : "task" VERSION : RSC NMI NMIDR STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : SHORT DEFINITION: A dictionary marker null word. LONG DEFINITION : A no-operation word which can mark the boundary between applications. By forgetting TASK and recompiling, an application can be discarded in its entirety. Its definition is : TASK ; . 255 NAME : THEN PRONUNCIATION : "then" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ), ( sys --- ) (compiling) # ARGUMENTS IN : 0 , 1 # ARGUMENTS OUT : 0 , 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : I C STANDARD : F83-RWS-CL SHORT DEFINITION: Marks the end of a conditional branch or marks where execution will continue relative to a cor- responding IF or ELSE . LONG DEFINITION : Used in the form: flag IF ... ELSE ... THEN or flag IF ... THEN THEN is the point where execution continues after ELSE , or IF when no ELSE is present. sys is balanced with its corresponding IF or ELSE . See: IF ELSE 256 NAME : THRU PRONUNCIATION : "thru" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( u1 u2 --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : Modified according to screens loaded PAD : INPUT : Reads screens OUTPUT : GROUP : Mass Storage ATTRIBUTE : M,83 STANDARD : F83-CRW SHORT DEFINITION: Load blocks from u1 through u2. LONG DEFINITION : Load consecutively the blocks from u1 through u2. 257 NAME : TIB PRONUNCIATION : "t-i-b" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : U STANDARD : F83-RWS-IL SHORT DEFINITION: Returns the address of the start of the text- input buffer. LONG DEFINITION : The address of the text input buffer. This buffer is used to hold characters when the in- put stream is coming from the current input device. 258 NAME : TRAVERSE PRONUNCIATION : "traverse" VERSION : RSC NMI NMIDR STACK NOTATION : ( addr n --- addr ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : STANDARD : SHORT DEFINITION: Adjust addr positively or negatively until con- tents of addr is greater then $7F. LONG DEFINITION : Adjusts the addr in a negative or positive direction, depending on the sign of n, until the contents of addr is greater than $7F. n must be either 1 or -1 . 259 NAME : TRIAD PRONUNCIATION : "triad" VERSION : NMI NMIDR STACK NOTATION : ( u16 --- ) # ARGUMENTS IN : 1# ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : Reads blocks OUTPUT : List screens, may cause write of updated screen to make buffer space. GROUP : Mass ATTRIBUTE : STANDARD : SHORT DEFINITION: Lists three screens to the output device. One of the screens listed is specified by the user. LONG DEFINITION : Outputs three screens, i.e., one page, to the output device. The page begins with screen which number is divisible by three. One of the screens on the page will be the screen specified. 260 NAME : TYPE PRONUNCIATION : "type"" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( addr +n --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-RWS-DL SHORT DEFINITION: Displays a string of +n characters starting with the character at addr. LONG DEFINITION : +n characters are displayed from memory begin- ning with character at addr and continuing through consecutive addresses. Nothing is dis- played if +n is zero. 261 NAME : U. PRONUNCIATION : "u-dot" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( u --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : Bytes below PAD modified as temporary area where +n is converted to string. INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Displays the unsigned value of u followed by a space. LONG DEFINITION : u is displayed as an unsigned number in a free- field format. 262 NAME : U.R PRONUNCIATION : "u-dot-r" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( u +n --- ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : Bytes below PAD modified as temporary area where +n is converted to string. INPUT : OUTPUT : GROUP : I/O ATTRIBUTE : STANDARD : F83-CRW SHORT DEFINITION: Displays the value of u right justified in a field +n characters wide according to the value of BASE. LONG DEFINITION : u is converted using the value of BASE and then displayed as an unsigned number right aligned in a field +n characters wide. If the number of characters required to display u is greater than +n, an error condition exists. 263 NAME : U< PRONUNCIATION : "u-less-than" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( u1 u2 --- flag ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Comparison ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Returns a true flag if u1 is less then u2. LONG DEFINITION : flag is true if u1 is less than u2. 264 NAME : UM* PRONUNCIATION : "u-m-times" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( u1 u2 --- ud ) # ARGUMENTS IN : 2 (2 words) # ARGUMENTS OUT : 1 (2 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Multiplies u1 and u2 returning the double length product ud. LONG DEFINITION : ud is the unsigned product of u1 times u2. All values and arithmetic are unsigned. 265 NAME : UM/MOD PRONUNCIATION : "u-m-divide-mod" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( ud u1 --- u2 u3 ) # ARGUMENTS IN : 2 (3 words) # ARGUMENTS OUT : 2 (2 words) RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Arithmetic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Divides the double length unsigned number ud by u1 and returns the single length remainder u2 and the single length quotient u3. LONG DEFINITION : u2 is the remainder and u3 is the floor of the quotient after dividing ud by the divisor u1. All values and arithmetic are unsigned. An er- ror condition results if the divisor is zero or if the quotient lies outside the range {0...65,535}. 266 NAME : UNDO PRONUNCIATION : "undo" VERSION : NMI NMIDR STACK NOTATION : ( --- ) # ARGUMENTS IN : # ARGUMENTS OUT : RETURN STACK : DICTIONARY : Removes latest definition, DP is "backed up". PAD : INPUT : OUTPUT : GROUP : Dictionary ATTRIBUTE : I STANDARD : SHORT DEFINITION: Forget the latest definition regardless of smudge condition. LONG DEFINITION : Forget the latest definition regardless of smudge condition. 267 NAME : UNTIL PRONUNCIATION : "until" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( flag --- ), ( sys --- ) (compiling) # ARGUMENTS IN : 1 , 1 # ARGUMENTS OUT : 0 , 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : I C STANDARD : F83-RWS-CL SHORT DEFINITION: Marks the end of an indefinite loop. LONG DEFINITION : Used in the form: BEGIN ... flag UNTIL Marks the end of a BEGIN-UNTIL loop which will ter- minate based on flag. If flag is true, the loop is terminated. If flag is false, execu- tion continues to just after the corresponding BEGIN . sys is balanced with its corresponding BEGIN . See: BEGIN 268 NAME : UPDATE PRONUNCIATION : "update" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Mass ATTRIBUTE : STANDARD : F83-RWS-DL SHORT DEFINITION: Marks the block buffer as having been modified and as ready to be saved to mass storage. LONG DEFINITION : The currently blocked buffer is marked as modified. Blocks marked as modified will subse- quently be automatically transfered to mass storage should its memory buffer be needed for storage of a different block or upon execution of FLUSH or SAVE-BUFFERS . 269 NAME : USER PRONUNCIATION : "user" VERSION : RSC NMI NMIDR STACK NOTATION : ( n --- ) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : is removed from input stream. OUTPUT : GROUP : Definition ATTRIBUTE : STANDARD : F83-URW SHORT DEFINITION: Create a user variable. LONG DEFINITION : A defining word used in the form: n USER which creates a user variable . The parameter field of contains n as a fixed offset relative to the user pointer register UP for this user variable. When is later executed, it places the sum of its offset and the user area base ad- dress on the stack as the storage address of that particular variable. 270 NAME : VARIABLE PRONUNCIATION : "variable" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : is removed from input stream. OUTPUT : GROUP : Definition ATTRIBUTE : STANDARD : F83-RWS-CL SHORT DEFINITION: Creates a single length variable. LONG DEFINITION : A defining word executed in the form: VARIABLE . A dictionary entry for is created and two bytes are ALLOTed in its parameter field. This parameter field is to be used for contents of the variable. The applica- tion is responsible for initializing the con- tents of the variable which it creates. When is later executed, the address of its parameter field is placed on the stack. 271 NAME : VOCABULARY PRONUNCIATION : "vocabulary" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Vocabulary ATTRIBUTE : STANDARD : F83-RWS-CL SHORT DEFINITION: Creates a vocabulary word. LONG DEFINITION : A defining word executed in the form: VOCABULARY . A dictionary entry for is created which specifies a new ordered list of definitions. Subsequent execution of replaces the first vocabulary in the search order with . When becomes the compilation vocabulary new definitons will be appended to 's list. 272 NAME : WHILE PRONUNCIATION : "while" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( flag --- ) ( sys1 --- sys2 ) (compiling) # ARGUMENTS IN : 1 , 1 # ARGUMENTS OUT : 0 , 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Control ATTRIBUTE : I C STANDARD : F83-RWS-CL SHORT DEFINITION: Decides the continuation or termination of a BEGIN...WHILE...REPEAT loop. LONG DEFINITION : Used in the form: BEGIN ... flag WHILE ... REPEAT Selects conditional execution based on flag. When flag is true, execution continues to just after the WHILE through to the REPEAT which then continues execution back to just after the BEGIN . When flag is false, execution con- tinues to just after the REPEAT , exiting the control structure. sys1 is balanced with its corresponding BEGIN . sys2 is balanced with its corresponding REPEAT . See: BEGIN 273 NAME : WORD PRONUNCIATION : "word" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( char --- addr) # ARGUMENTS IN : 1 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Interpreter ATTRIBUTE : STANDARD : F83-RWS-IL SHORT DEFINITION: Generates a counted string until an ASCII code, char is encountered or the input stream is ex- hausted. Returns addr which is the beginning address of where the counted string are stored. LONG DEFINITION : Generates a counted string at HERE by non- destructively accepting characters from the in- put stream until the delimiting character, char, is encountered or the input stream is ex- hausted. Leading delimiters are ignored. The entire character string is stored in memory beginning at addr as a sequence of bytes. The string is followed by a blank which is not included in the count. The first byte in the string is the number of characters {0...255}. If the string is longer than 255 characters, the count is unspecified. If the input stream is already exhausted as WORD called, then a zero length character string will result. The counted string returned by WORD may reside in the "free" dictionary are at HERE or above. Note that the text inter- preter may also use this area. 274 NAME : WORDS PRONUNCIATION : "words" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : Optional termination with any character input. OUTPUT : List of words. GROUP : Vocabulary ATTRIBUTE : STANDARD : F83-URW SHORT DEFINITION: Lists all the words in the CURRENT vocabulary. LONG DEFINITION : List the word names in the first vocabulary of the currently active search order. 275 NAME : XOR PRONUNCIATION : "exclusive-or" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( 16b1 16b2 --- 16b3 ) # ARGUMENTS IN : 2 # ARGUMENTS OUT : 1 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Logic ATTRIBUTE : STANDARD : F83-RWS-NL SHORT DEFINITION: Performs a bit-by-bit exclusive or of 16b1 with 16b2 to give 16b3. LONG DEFINITION : 16b3 is the bit-by-bit exclusive-or of 16b1 with 16b2. 276 NAME : [ PRONUNCIATION : "left-bracket" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : Compiler ATTRIBUTE : I STANDARD : F83-RWS-CL SHORT DEFINITION: Places the system into interpret state to ex- ecute non-immediate word/s during compilation. LONG DEFINITION : Sets interpret state. The text from the input stream is subsequently interpreted. For typi- cal usage see LITERAL . See ) ] 277 NAME : ['] PRONUNCIATION : "bracket-tick" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- addr ), ( --- ) # ARGUMENTS IN : 0 , 0 # ARGUMENTS OUT : 1 , 0 RETURN STACK : DICTIONARY : PAD : INPUT : is removed from input stream. OUTPUT : GROUP : Compiler ATTRIBUTE : I C STANDARD : F83-RWS-CL SHORT DEFINITION: Returns and compiles the code field address of a word in a colon-definition. LONG DEFINITION : Used in the form: ['] . Compiles the compilation address addr of as a literal. When the colon definition is later executed, addr is left on the stack. An error condition exists if is not found in the currently active search order. See: LITERAL 278 NAME : [COMPILE] PRONUNCIATION : "bracket-compile" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : is removed from input stream OUTPUT : GROUP : Compiler ATTRIBUTE : I STANDARD : F83-RWS-CL SHORT DEFINITION: Causes an immediate word to be compiled. LONG DEFINITION : Used in the form: [COMPILE] Forces compilation of the following word . This allows compilation of an immediate word when it would otherwise have been executed. 279 NAME : ] PRONUNCIATION : "right-bracket" VERSION : NMI NMIDR FORTH-83 STACK NOTATION : ( --- ) # ARGUMENTS IN : 0 # ARGUMENTS OUT : 0 RETURN STACK : DICTIONARY : PAD : INPUT : OUTPUT : GROUP : COMPILER ATTRIBUTE : I STANDARD : F83-RWS-CL SHORT DEFINITION: Places the system into compilation state. ] places a non-zero value into the user variable STATE. LONG DEFINITION : Sets compilation state. The text from the in- put stream is subsequently compiled. For typi- cal usage see LITERAL . See: [ 280 DEFINITIONS BY GROUP Please read APPENDIX B for the meaning of abbreviations and sym- bols used herein. Arithmetic * ( w1 w2 --- w3 ) Multiplies w2 by w1 and leaves the product w3 onto the stack. */ ( n1 n2 n3 --- n4 ) Multiplies n1 by n2 and divides the product by n3. The quotient, n4 is placed on the stack. */MOD ( n1 n2 n3 --- n4 n5 ) n1 is multiplied by n2 producing a product which is divided by n3. The remainder, n4, and the quotient, n5, are then placed on the stack. + (w1 w2 --- w3 ) Adds w2 and w1 then leaves the sum, w3 on the stack. - ( w1 w2 --- w3 ) Subtracts w2 from w1 and leaves the result, w3 on the stack. / ( n1 n2 --- n3 ) Divides n1 by n2 and leaves the quotient n3 on the stack. /MOD ( n1 n2 --- n3 n4 ) Divides n1 by n2 then leaves on the stack the remainder n3 and the quotient n4. 1+ ( w1 --- w2 ) Adds 1 to w1 then leaves the sum, w2 on the stack. 1- ( w1 --- w2 ) Subtract 1 from w1 then leaves the difference, w2 on the stack. 2* ( w1 --- w2 ) Multiplies w1 by 2 to give w2. 2+ ( w1 --- w2 ) Adds two to w1 and leaves the sum, w2 on the stack. 2- ( w1 --- w2 ) Subtracts two from w1 and leaves the result, w2 on the stack. 2/ ( n1 --- n2 ) Divides n1 by 2, giving n2 as the result. 281 ABS ( n --- u ) Leaves on the stack the absolute value, u of n. D+ ( wd1 wd2 --- wd3 ) Adds wd1 and wd2 and leaves the result, wd3 on stack. D- ( wd1 wd2 --- wd3 ) Subtracts wd2 from wd1 and returns the difference wd3. D2/ ( d1 --- d2 ) Divides d1 by 2 and gives quotient d2. DABS ( d --- ud ) Returns the absolute value of d as ud. DMAX ( d1 d2 --- d3 ) Returns d3 as the greater of d1 or d2. DMIN ( d1 d2 --- d3 ) Returns d3 as the lesser of d1 or d2. DNEGATE ( d1 --- d2 ) Leaves the two's complement d2 of d1. MAX ( n1 n2 --- n3 ) Leaves the greater of n1 and n2 as n3. MIN ( n1 n2 --- n3 ) Leaves the lessr of n1 and n2 as n3. MOD ( n1 n2 --- n3 ) Divides n1 by n2 and leaves the remainder n3. NEGATE ( n1 --- n2 ) Leaves the two's complement n2 of n1. S->D ( n --- d ) Sign extend single number to double number. UM* ( u1 u2 --- ud ) Multiplies u1 and u2 returning the double length product ud. UM/MOD ( ud u1 --- u2 u3 ) Divides the double length unsigned number ud by u1 and returns the single length remainder u2 and the single length quotient u3. Comparison 0< ( n --- flag ) Leaves a true flag if n is less than zero. 0= ( w --- flag ) Leaves a true flag if w is equal to zero. 282 0> ( n --- flag ) Leaves a true flag if n is greater than zero. < ( n1 n2 --- flag ) Leaves a true flag on stack if n1 is less than n2. = ( w1 w2 --- flag ) Returns a true flag if w1 is equal to w2. > ( n1 n2 --- flag ) Returns a true flag if n1 is greater than n2. D0= ( wd --- flag ) Returns a true flag if wd is equal to zero. D< ( d1 d2 --- flag ) Leaves a true flag if d1 is less than d2; other- wise leaves a false flag. D= ( wd1 wd2 --- flag ) Returns a true flag if wd1 is equal to wd2. DU< ( ud1 ud2 --- flag ) Returns a true flag if ud1 is less than ud2. U< ( u1 u2 --- flag ) Returns a true flag if u1 is less then u2. Compiler ( ( --- ) Starts a comment input. Comment is ended by a ) . >BODY ( addr1 --- addr2 ) Leaves on the stack the parameter field address, addr2 of a given field address, addr1. COMPILE ( --- ) Copies the compilation address of the next non- immediate word following COMPILE. EXECUTE ( addr --- ) Executes the definition found at addr. IMMEDIATE ( --- ) Marks the most recently created dictionary entry as a word that will be executed immediately even if FORTH is in compile mode. LITERAL ( 16b --- ) Compile a system dependent operation so that when later executed, 16b will be left on the stack. RECURSE ( --- ) Compile the compilation address of definition cur- rently being defined. 283 STATE ( --- addr ) Returns the address of the user variable that con- tains a value defining the compilation state. [ ( --- ) Places the system into interpret state to execute non-immediate word/s during compilation. ['] ( --- addr ), ( --- ) Returns and compiles the code field address of a word in a colon-definition. [COMPILE] ( --- ) Causes an immediate word to be compiled. ] ( --- ) Places the system into compilation state. ] places a non-zero value into the user variable STATE. Control +LOOP ( n --- ), ( sys --- ) (compiling) Increments the DO LOOP index by n. MARK ( --- addr ) Compiles zero in place of forward branch offset and marks it for future resolve. >RESOLVE ( addr --- ) Corrects branch offset previously compiled by >mark to current dictionary location. AGAIN ( --- ), ( sys --- ) (compiling) Ends BEGIN loop. BEGIN ( --- ), ( --- sys ) (compiling) Marks the start of a loop. DO ( w1 w2 --- ), ( --- sys ) (compiling) Repeats execution of words between DO LOOPs and DO +LOOPs, the number of times is specified by the limit from w2 to w1. ELSE ( --- ), ( sys1 --- sys2 ) (compiling) Allows execution of words between IF and ELSE if the flag is true, otherwise, it forces execution of words after ELSE. 284 END ( sys --- ) Performs the same function as UNTIL. See UNTIL . I ( --- w ) Places the loop index onto the stack. IF ( flag --- ), ( --- sys ) (compiling) Allows a program to branch on condition. J ( --- w ) Returns the index of the next outer loop. K ( --- w ) Returns the index of the second outer loop in nested do loops. LEAVE ( --- ) Forces termination of a DO LOOP. LOOP ( ---- ), ( sys --- ) (compiling) Defines the end point of a do-loop. REPEAT ( --- ), ( sys --- ) (compiling) Terminates a BEGIN...WHILE...REPEAT loop. THEN ( --- ), ( sys --- ) (compiling) Marks the end of a conditional branch or marks where execution will continue relative to a cor- responding IF or ELSE . UNTIL ( flag --- ), ( sys --- ) (compiling) Marks the end of an indefinite loop. WHILE ( flag --- ), ( sys1 --- sys2 ) (compiling) Decides the continuation or termination of a BEGIN...WHILE...REPEAT loop. Definition 2CONSTANT ( 32b --- ) Creates a double length constant for a . When is executed, 32b is left on the stack. 2VARIABLE ( --- ) Creates double-length variable for . when is executed, its parameter field address is placed on the stack. : ( --- sys ) Starts the definition of a word. Definition is terminated by a ; . :CASE ( n --- ), ( --- sys ) (compiling) Creates a dictionary entry for in current and sets the compile mode. ; ( sys --- ) Terminates a colon-definiton. 285 ;CODE ( --- ), ( sys1 --- sys2 ) (compiling) Terminates a defining-word. May only be used in compilation mode. CODE ( --- sys ) Creates an assembler definition. CODE-SUB ( --- sys ) Creates an assembler definition subroutine. CONSTANT ( 16b --- ) Creates a dictionary entry for . CREATE ( --- ) Creates a dictionary entry for . DOES> ( --- addr ), ( --- ) (compiling) Marks the termination of the defining part of the defining word and begins the definition of the run-time action for words that will later be defined by . END-CODE ( sys --- ) Terminates an assembler definition. USER ( n --- ) Create a user variable. VARIABLE ( --- ) Creates a single length variable. Dictionary ' ( --- addr ) Returns 's compilation address, addr , ( 16b --- ) Reserves 16b of space in the dictionary. ALLOT ( w --- ) Reserves w bytes of dictionary space. AUTOSTART ( addr --- ) Prepare autostart vector at addr which will cause to be executed upon reset. Note: addr must be on a 1K byte boundary. C, ( 16b --- ) Stores the least significant byte of 16b into a byte at the next available dictionary location. CFA ( pfa --- cfa ) Alter parameter field pointer address to code field address. 286 DP ( --- addr ) Put Dictionary Pointer address on stack. FORGET ( --- ) Deletes from the dictionary. H/C ( addr --- ) Separate heads and codes portions of definition to different place in memory. HERE ( --- addr ) Leaves the address of the next variable dictionary location HWORD ( --- ) Moves codes portion of last defined word from the codes memory to the heads memory. LATEST ( --- nfa ) Leaves name field address (nfa) of top word in CUR- RENT. LFA ( pfaptr --- lfa ) Alter parameter field pointer address to link field address. NFA ( pfaptr - nfa ) Alter parameter field pointer address to name field address. PAD ( --- addr ) Puts onto stack the starting address in memory of scratchpad. PFAPTR ( nfa --- pfaptr ) Alter name field address to parameter field pointer address. TASK ( --- ) A dictionary marker null word. TRAVERSE ( addr n --- addr ) Adjust addr positively or negatively until con- tents of addr is greater then $7F. UNDO ( --- ) Forget the latest definition regardless of smudge condition. Format # ( +d1 --- +d2 ) +d1 is divided by BASE and the quotient +d2 is placed onto the stack. The remainder is converted to an ASCII character and appended to the output string toward lower memory addresses. 287 #> ( 32b --- addr +n ) Terminates formatted (or pictured) output string (ready for TYPE ). #S ( +d --- 0 0 ) Converts all digits of an entire number into string. -TRAILING ( addr +n1 --- addr +n2 ) Counts +n1 characters starting at addr and sub- tracts 1 from the count when a blank is encoun- tered. Leaves on the stack the final string count, n2 and addr. <# ( --- ) Starts a formatted (pictured) numeric output. Ter- minated by #> . COUNT ( addr1 --- addr2 +n ) Leaves the address, addr2 and the character count +n of text beginning at addr1. DPL ( --- addr ) Returns the address of the user variable contain- ing the number of places after the fractional point for input conversion. FLD ( --- addr ) Returns the address of the user variable which con- tains the value of the field length reserved for a number during output conversion. HOLD ( char --- ) Inserts character into a pictured numeric output string. NUMBER ( addr --- d ) Converts the counted string at addr to d according to the value of BASE . SIGN ( n --- ) Appends an ASCII " - " (minus sign) to the start of a pictured numeric output string if n is nega- tive. I/O #TIB ( --- addr ) Returns the address of the user variable that holds the number of characters input. ." ( --- ) Displays the characters following it up to the delimiter " . .( ( --- ) 288 Displays string following .( delimited by ) . .R ( n +n --- ) Displays the value n right justified in a field +n characters wide according to the value of BASE. .S ( --- ) Display stack contents without modifying the stack. . ( n --- ) Removes n from the top of stack and displays it. ? ( addr --- ) Displays the contents of addr. ?TERMINAL ( --- flag ) True if any key is depressed. ABORT" ( ---- ) If flag is true, message that follows " is dis- played and the ABORT function is performed. If flag is false, the flag is dropped and execution continues. BL ( --- n ) Puts the ASCII code for a space (decimal 32) on the stack. C/L ( --- n ) Maximum number of characters per line CR ( --- ) Generates a carriage return and line feed. D. ( d --- ) Displays the value of d. D.R ( d +n --- ) Displays the value of d right justified in a field +n characters wide. DUMP ( addr u --- ) Displays u bytes of memory starting at addr. EMIT ( 16b --- ) Displays the ASCII equivalent of 16b onto the screen. EXPECT ( addr +n --- ) Stores up to +n characters into memory beginning at addr. ID. ( nfa --- ) Print given name field address (NFA). KEY ( --- 16b ) 289 Pauses to wait for a key to be pressed and then places the ASCII value of the key (n) on the stack. QUERY ( --- ) Stores input characters into text input buffer. SPACE ( --- ) Sends a space (blank) to the current output device. SPACES ( +n --- ) Sends +n spaces (blanks) to the current output device. SPAN ( --- addr ) Returns the address of the user variable that con- tains the count of characters received and stored by the most recent execution of EXPECT . TIB ( --- addr ) Returns the address of the start of the text-input buffer. TYPE ( addr +n --- ) Displays a string of +n characters starting with the character at addr. U. ( u --- ) Displays the unsigned value of u followed by a space. U.R ( u +n --- ) Displays the value of u right justified in a field +n characters wide according to the value of BASE. Interpreter ;S ( --- ) Stop interpretation. >IN ( --- addr ) Leaves the address of the user variable >IN which contains the number of bytes from the beginning of the input stream at any particular moment during interpretation. EXIT ( --- ) Causes execution to leave the current word and go back to where the word was called from. FIND ( addr1 --- addr2 n ) Obtains an address of counted strings, addr1 from the stack. Searches the dictionary for the string. INTERPRET ( --- ) 290 Begins text interpretation at the character in- dexed by the contents of >IN relative to the block number contained in BLK, continuing until the in- put stream is exhausted. QUIT ( --- ) Clears the return stack, stops compilation and returns control to current input device. WORD ( char --- addr) Generates a counted string until an ASCII code, char is encountered or the input stream is ex- hausted. Returns addr which is the beginning ad- dress of where the counted string are stored. Logic AND ( 16b1 16b2 --- 16b3 ) Leaves the bitwise logical AND of 16b1 and 16b2 as 16b3. NOT ( 16b1 --- 16b2 ) Leaves the one's complement 16b2 of 16b1. OR ( 16b1 16b2 --- 16b3 ) Leaves the exclusive-or 16b3 of 16b1 an 16b2. XOR ( 16b1 16b2 --- 16b3 ) Performs a bit-by-bit exclusive or of 16b1 with 16b2 to give 16b3. Mass (LINE) ( n1 n2 --- addr count ) Virtual storage line primitive. --> ( --- ) Immediately transfers interpretation to the start of the next sequential block. .LINE ( n1 n2 --- ) Display line of text from mass storage. >L ( n --- ) Place the on line n of the current screen as designated by SCR. B/BUF ( --- 1024 ) Returns a constant 1024 which is the number of bytes per block buffer. BLK ( --- addr ) Leaves the address of the user variable containing the the number of the block that is currently being interpreted. BLOCK ( u --- addr ) 291 Leaves the address of the block buffer containing block u. BUFFER ( u --- addr ) Assigns the block buffer and its address to block u. Leaves the address of the block buffer on the stack. EMPTY-BUFFERS ( --- ) Removes the update status and removes assignments of all blocks to buffers. FIRST ( --- n ) Leaves address of first block buffer. FLUSH ( --- ) Performs the functions of the SAVE-BUFFERS then unassign all block buffers. INDEX ( u1 u2 --- ) Displays the top line from each block in a range of blocks starting at block u1 to u2. LIMIT ( --- n ) Top of memory LIST ( u --- ) Lists the block whose number is u. SCR is set to u. LOAD ( u --- ) Begins interpretation of block u. OFFSET ( --- addr ) Returns the address of the user variable that con- tains a block block offset to mass storage. SAVE-BUFFERS ( --- ) Copies the contents of all block buffers marked as UPDATEd to their corresponding mass-storage blocks. SCR ( --- addr ) Returns the address of the user variable contain- ing the number of block most recently listed. THRU ( u1 u2 --- ) Load blocks from u1 through u2. TRIAD ( u16 --- ) Lists three screens to the output device. One of the screens listed is specified by the user. UPDATE ( --- ) Marks the block buffer as having been modified and as ready to be saved to mass storage. 292 Memory ! ( 16b addr --- ) Stores 16 at addr. +! ( w1 addr --- ) Adds w1 to the value at addr then stores the sum at addr replacing its previous value. 1+! ( addr --- ) Adds one to the value at addr and stores the result at addr. 1-! ( addr --- ) Subtracts one from the value at addr and stores the result at addr. 2! ( 32b addr --- ) Stores 32b at addr. 2@ ( addr --- 32b ) Returns 32b from addr. @ ( addr --- 16b ) Replaces addr with its 16b contents on top of the stack. BLANKS ( addr u --- ) Sets u bytes of memory beginning at addr to the ASCII code for space (decimal 32). C! ( 16b addr --- ) Stores the least significant byte of 16b into addr. C@ ( addr --- 8b ) Fetches the 8b contents from addr. CMOVE ( addr1 addr2 u --- ) Moves towards high memory the u bytes at addresses addr1 and addr2. CMOVE> ( addr1 addr2 u --- ) Moves u bytes beginning at addr1 to addr2. EEC! ( 16b addr --- ) Stores the least significant byte of 16b into addr in EEPROM. EEMOVE ( addr1 addr2 u --- ) Moves the u bytes at addresses addr1 and addr2. EEWORD ( --- ) Moves code of last defined word from the codes memory of the EEPROM memory. ERASE ( addr u --- ) Sets u bytes of memory to zero, beginning at addr. 293 FILL ( addr u 8b --- ) Fills u bytes, beginning at addr, with byte pat- tern 8b. Numeric BASE ( --- addr ) Leaves the address of the user variable containing the numeric numeric conversion radix. CONVERT ( +d1 addr1 --- +d2 addr2 ) Converts an input string into a number. DECIMAL ( --- ) Sets the input-output numeric conversion base to ten. HEX ( --- ) Sets the numeric input-output conversion to base sixteen. Operating System ABORT ( flag --- ) Clears the data stack and performs the function of QUIT . COLD ( --- ) Cold starts FORTH. ATO4 ( --- N ) Returns address of subroutine call to high level word as indicated in D register. Primitive ?BRANCH ( flag --- ) Compiles a conditional branch operation. BRANCH ( --- ) Compiles an unconditional branch operation. Stack -ROLL ( n --- ) Removes the value on the top of stack and inserts it to the nth place from the top of stack. 2DROP ( 32b --- ) Removes 32b from the stack. 2DUP ( 32b --- 32b 32b ) Duplicates 32b. 2OVER ( 32b1 32b2 --- 32b1 32b2 32b3 ) 294 32b3 is a copy of 32b1 2ROT ( 32b1 32b2 32b3 --- 32b2 32b3 32b1 ) Rotates 32b1 to the top of the stack. 2SWAP ( 32b1 32b2 --- 32b2 32b1 ) Swaps 32b1 and 32b2 on the stack. >< ( 8b1/8b2 --- 8b2/8b1 ) Swaps the upper and lower bytes of the value on the stack. >R ( 16b --- ) Removes 16b from user stack and place it onto return stack. ?DUP ( 16b --- 16b 16b ), ( 0 --- 0 ) Duplicates 16b if it is a non-zero. DEPTH ( --- +n ) Returns count +n of numbers on the data stack. DROP ( 16b --- ) Removes 16b from the data stack. DUP ( 16b --- 16b 16b ) Duplicates 16b. OVER ( 16b1 16b2 --- 16b1 16b2 16b3 ) 16b3 is a copy of 16b1. PICK ( +n --- 16b ) Copies the data stack's +nth item onto the top. R> ( --- 16b ) 16b is removed from the return stack and placed onto the data stack. R@ ( --- 16b ) 16b is a copy of the top of the return stack. ROLL ( +n --- ) Removes the stack's nth item and places it onto the top of stack. ROT ( 16b1 16b2 16b3 --- 16b2 16b3 16b1 ) Rotates 16b1 to the top of the stack. S0 ( --- addr ) Returns the address of the variable containing the initial value of the bottom of the stack. SP@ ( --- addr ) addr is the address of the top of the parameter stack just before SP@ was executed. SWAP ( 16b1 16b2 --- 16b2 16b1 ) 295 Exchanges positions of the top two items of the stack. Vocabulary ASSEMBLER ( --- ) Replaces the first vocabulary in the search order with the assembler vocabulary. CONTEXT ( --- addr ) Returns the address of a user variable that deter- mines the vocabulary to be searched first in the dictionary. CURRENT ( --- addr ) Returns the address of the user variable specify- ing the vocabulary into which new word definitions will be entered. DEFINITIONS ( --- ) Specify the vocabulary into which new definitions are to be added. FORTH ( --- ) Replaces the first vocabulary in the search order with FORTH. FORTH-83 ( --- ) Initializes FORTH-83 into the system. VOCABULARY ( --- ) Creates a vocabulary word. WORDS ( --- ) Lists all the words in the CURRENT vocabulary. 296 Max-FORTH 68HC11 MEMORY MAP +--+-----+-------------+----------------------------------------+ DEC HEX NAME VALUE +--+-----+-------------+----------------------------------------+ 0 $0000 W 0 1 $0001 " 2 $0002 IP 0 WORD PTR AFTER BOOT PAT. 3 $0003 " 4 $0004 UP $0006 UAREA 5 $0005 " 6 $0006 DNLINK 0 7 $0007 " 8 $0008 UPLINK 0 9 $0009 " 10 $000A PRIORITY 0 11 $000B " 12 $000C RPSAVE 0 13 $000D " 14 $000E R0 STACKINIT 15 $000F " 16 $0010 S0 BOS 17 $0011 " 18 $0012 KEY-BC-PTR DEFKEY 19 $0013 " 20 $0014 EMIT-BC-PTR DEFOUT 21 $0015 " 22 $0016 UKEY KEYSUB+2 23 $0017 " 24 $0018 UEMIT EMITSUB+2 25 $0019 " 26 $001A U?TERMINAL QTSUB+2 27 $001B " 28 $001C TIB TIBX 29 $001D " 30 $001E UC/L 16 31 $001F " 32 $0020 CLD/WRM $A55A 33 $0021 " 34 $0022 UPAD UPADINIT 35 $0023 " 36 $0024 BASE 10 37 $0025 " 38 $0026 C/10MS 20000 39 $0027 " 40 $0028 CR CHARACTER $0D 41 $0029 " 42 $002A BS CHARACTER $08 43 $002B " 44 $002C DP TOP 45 $002D " 46 $002E DP\ 0 47 $002F " 48 $0030 EDP $B604 49 $0031 " 50 $0032 HEADERLESS 0 51 $0033 " 52 $0034 VOC-LINK UAREA+UASMOF+2 297 53 $0035 " 54 $0036 $81 $81,$A0 55 $0037 $A0 56 $0038 UFORTH NTOP 57 $0039 " 58 $003A 00 0000 59 $003B 00 60 $003C $81 $81,$A0 61 $003D $A0 62 $003E UEDITOR EDTOP 63 $003F " 64 $0040 " UAREA+U4TH+2 65 $0041 " 66 $0042 $81 $81,$A0 67 $0043 $A0 68 $0044 UASSEMBLER ASMTOP 69 $0045 " 70 $0046 " UAREA+UEDITOR+2 71 $0047 " 72 $0048 WIDTH 31 73 $0049 " 74 $004A FENCE NTOP 75 $004B " 76 $004C UABORT ABORT 77 $004D " 78 $004E UFIRST $D7FC 79 $004F " 80 $0050 ULIMIT $E000 81 $0051 " 82 $0052 OFFSET 0 83 $0053 " 84 $0054 WARNING 0 85 $0055 " 86 $0056 UR/W RAM DISK 87 $0057 " 88 $0058 >IN 89 $0059 " 90 $005A SPAN 91 $005B " 92 $005C #TIB 93 $005D " 94 $005E DPL 95 $005F " 96 $0060 FLD 97 $0061 " 98 $0062 USE 99 $0063 " 100 $0064 PREV 101 $0065 " 102 $0066 BLK 103 $0067 " 104 $0068 SCR 105 $0069 " 106 $006A CONTEXT 107 $006B " 108 $006C CURRENT 109 $006D " 110 $006E STATE 298 111 $006F " 112 $0070 CSP 113 $0071 " 114 $0072 CYLINDER 115 $0073 " 116 $0074 " 117 $0075 " 118 $0076 DISKNO 119 $0077 " 120 $0078 B/SIDE 121 $0079 " TOS END USER VARIABLES 122 $007A NTOP $84 123 $007B 'T' 124 $007C 'A' 125 $007D 'S' 126 $007E 'K' 127 $007F LINK 128 $0080 " 129 $0081 PFAPTR 130 $0082 " 131 $0083 (dictionary) TOP 132 $0084 " 133 $0085 " 134 $0086 " 135 $0087 " 136 $0088 " 137 $0089 " 138 $008A 139 $008B 140 $008C 141 $008D 142 $008E 143 $008F 144 $0090 145 $0091 146 $0092 147 $0093 148 $0094 149 $0095 150 $0096 151 $0097 152 $0098 153 $0099 154 $009A 155 $009B 156 $009C 157 $009D 158 $009E 159 $009F 160 $00A0 161 $00A1 162 $00A2 163 $00A3 164 $00A4 165 $00A5 166 $00A6 167 $00A7 168 $00A8 DATA STACK 16 299 169 $00A9 " 170 $00AA DATA STACK 15 171 $00AB " 172 $00AC DATA STACK 14 173 $00AD " 174 $00AE DATA STACK 13 175 $00AF " 176 $00B0 DATA STACK 12 177 $00B1 " 178 $00B2 DATA STACK 11 179 $00B3 " 180 $00B4 DATA STACK 10 181 $00B5 " 182 $00B6 DATA STACK 9 183 $00B7 " 184 $00B8 DATA STACK 8 185 $00B9 " 186 $00BA DATA STACK 7 187 $00BB " 188 $00BC DATA STACK 6 189 $00BD " 190 $00BE DATA STACK 5 191 $00BF " 192 $00C0 DATA STACK 4 193 $00C1 " 194 $00C2 DATA STACK 3 195 $00C3 " 196 $00C4 DATA STACK 2 197 $00C5 " 198 $00C6 DATA STACK 1 199 $00C7 " 200 $00C8 (digits) (BLK) BOS S0 IN Y 201 $00C9 (digits) " 202 $00CA (digits) (IN) 203 $00CB (digits) " 204 $00CC (digits) 205 $00CD (digits) 206 $00CE (digits) 207 $00CF (digits) 208 $00D0 TIBX UPADINIT 209 $00D1 " 211 $00D3 " 212 $00D4 " 213 $00D5 " 214 $00D6 " 215 $00D7 " 216 $00D8 " 217 $00D9 " 218 $00DA " 219 $00DB " 220 $00DC " 221 $00DD " 222 $00DE " 223 $00DF " 224 $00E0 RETURN STACK 16 225 $00E1 " 226 $00E2 RETURN STACK 15 227 $00E3 " 300 228 $00E4 RETURN STACK 14 229 $00E5 " 230 $00E6 RETURN STACK 13 231 $00E7 " 232 $00E8 RETURN STACK 12 233 $00E9 " 234 $00EA RETURN STACK 11 235 $00EB " 236 $00EC RETURN STACK 10 237 $00ED " 238 $00EE RETURN STACK 9 239 $00EF " 240 $00F0 RETURN STACK 8 241 $00F1 " 242 $00F2 RETURN STACK 7 243 $00F3 " 244 $00F4 RETURN STACK 6 245 $00F5 " 246 $00F6 RETURN STACK 5 247 $00F7 " 248 $00F8 RETURN STACK 4 249 $00F9 " 250 $00FA RETURN STACK 3 251 $00FB " 252 $00FC RETURN STACK 2 253 $00FD " 254 $00FE RETURN STACK 1 255 $00FF " STACKINIT RESET PUT INTO S $103D INIT REG $0B REV 2 ($09 REV 0-1) BY RESET $B000 PORTA ($9000 REV 0-1) $B001 Reserved etc. $B002 PIOC $B003 PORTC $B004 PORTB $B005 PORTCL $B006 Reserved $B007 DDRC $B008 PORTD $B009 DDRD $B00A PORTE $B00B CFORC $B00C OC1M $B00D OC1D $B00E TCNT $B00F " $B010 TIC1 $B011 " $B012 TIC2 $B013 " $B014 TIC3 $B015 " $B016 TOC1 $B017 " $B018 TOC2 $B019 " $B01A TOC3 301 $B01B " $B01C TOC4 $B01D " $B01E TOC5 $B01F " $B020 TCTL1 $B021 TCTL2 $B022 TMSK1 $B023 TFLG1 $B024 TMSK2 $B025 TFLG2 $B026 PACTL $B027 PACNT $B028 SPCR $B029 SPSR $B02A SPDR $B02B BAUD $30 BY RESET $B02C SCCR1 $00 BY RESET $B02D SCCR2 $0C BY RESET $B02E SCSR $B02F SCDR $B030 ADCTL $B031 ADR1 $B032 ADR2 $B033 ADR3 $B034 ADR4 $B035 Reserved $B036 Reserved $B037 Reserved $B038 Reserved $B039 OPTION $B03A COPRST $B03B PPROG $B03C HPRIO $B03D INIT $0B BY RESET $B03E TEST1 $B03F CONFIG $B600 EEPROM AUTOSTART LOC HI-LEVEL IN EEPROM $B601 " " $B602 " CFA OF WORD FOR HI-LEVEL AUTOSTART $B603 " " " " " UNASSIGNED " " $B7BF " SCI SER SYS INT VEC AT $FFD6 POINTS HERE " " $B7C2 " SPI SERIAL $FFD8 " " $B7C5 " PLS ACC OVRFL $FFDA " " $B7C8 " PLS ACC EDGE $FFDC " 302 " $B7CB " TMR OVERFLOW $FFDE " " $B7CE " TMR OUT CAP 5 $FFE0 " " $B7D1 " TMR OUT CAP 4 $FFE2 " " $B7D4 " TMR OUT CAP 3 $FFE4 " " $B7D7 " TMR OUT CAP 2 $FFE6 " " $B7DA " TMR OUT CAP 1 $FFE8 " " $B7DD " TMR IN CAP 3 $FFEA " " $B7E0 " TMR IN CAP 2 $FFEC " " $B7E3 " TMR IN CAP 1 $FFEE " " $B7E6 " REAL TIME $FFF0 " " $B7E9 " IRQ $FFF2 " " $B7EC " XIRQ $FFF4 " " $B7EF " SWI $FFF6 " " $B7F2 " OP-CODE TRAP $FFF8 " " $B7F5 " COP FAILURE $FFFA " " $B7F8 " COP Clk Mon $FFFC " " $B7FB " ENTRY POINT FOR RESET SUB $B7FC " " $B7FD " " $B7FE " AUTOSTART LOC FOR RESET SUBROUTINE BEFORE $B7FF EEPROM REG INITIALIZATION FOR 64 CLK CYC REG SET $E000 ROM AND HEADS " " 303 " " " $XXXX NON RUN TIME CODES " " " " " $XXXX RUN TIME CODES " " " " " $XXX0 DEFKEY SCSR IN ROM ADDRESS OF STATUS REG. $XXX1 $XXX2 DEFKEY+2 $20 IN ROM AND MASK $XXX3 DEFKEY+3 0 IN ROM XOR MASK $XXX4 DEFKEY+4 SCDR IN ROM ADDRESS OF INPUT REG. $XXX5 $XXX6 DEFOUT SCSR IN ROM ADDRESS OF STATUS REG $XXX7 $XXX8 DEFOUT+2 $80 IN ROM AND MASK $XXX9 DEFOUT+3 0 IN ROM XOR MASK $XXXA DEFOUT+4 SCDR IN ROM ADDRESS OF OUTPUT REGISTER $XXXB " $FFC0 RESERVED $FFC1 " $FFC2 RESERVED $FFC3 " $FFC4 RESERVED $FFC5 " $FFC6 RESERVED $FFC7 " $FFC8 RESERVED $FFC9 " $FFCA RESERVED $FFCB " $FFCC RESERVED $FFCD " $FFCE RESERVED $FFCF " $FFD0 RESERVED $FFD1 " $FFD2 RESERVED $FFD3 " $FFD4 RESERVED $FFD5 " $FFD6 SCI SER SYS $B7BF IN ROM $FFD7 " $FFD8 SPI SERIAL $B7C2 IN ROM $FFD9 " $FFDA PLS ACC EDGE $B7C5 IN ROM $FFDB " $FFDC PLS ACC OVRFL $B7C8 IN ROM $FFDD " 304 $FFDE TMR OVERFLOW $B7CB IN ROM $FFDF " $FFE0 TMR OUT CAP 5 $B7CE IN ROM $FFE1 " $FFE2 TMR OUT CAP 4 $B7D1 IN ROM $FFE3 " $FFE4 TMR OUT CAP 3 $B7D4 IN ROM $FFE5 " $FFE6 TMR OUT CAP 2 $B7D7 IN ROM $FFE7 " $FFE8 TMR OUT CAP 1 $B7DA IN ROM $FFE9 " $FFEA TMR IN CAP 3 $B7DD IN ROM $FFEB " $FFEC TMR IN CAP 2 $B7E0 IN ROM $FFED " $FFEE TMR IN CAP 1 $B7E3 IN ROM $FFEF " $FFF0 REAL TIME $B7E6 IN ROM $FFF1 " $FFF2 IRQ $B7E9 IN ROM $FFF3 " $FFF4 XIRQ $B7EC IN ROM $FFF5 " $FFF6 SWI $B7EF IN ROM $FFF7 " $FFF8 OP-CODE TRAP $B7F2 IN ROM $FFF9 " $FFFA COP FAILURE $B7F5 IN ROM $FFFB " $FFFC COP Clk Mon $B7F8 IN ROM $FFFD " $FFFE RESET COLD+2 IN ROM $FFFF " 305 Max-FORTH 68HC11 MACHINE CODE ROUTINES ;HERE IS AN EXAMPLE USE OF ATO4... ; LDD #WORDS ; JSR ATO4 ; JMP NEXT ATO4PTR: CFAFLD DOCON .WORD ATO4 ATO4: LDX IP ;SAVE INTERPRETIVE POINTER PSHX LDX W PSHX LDX #RETPNT-2 ;POINT TO RETURNING 'WORD' STX IP XGDX ;PUT NEW EXECUTION ADDRESS IN X JMP NEXT2 ;SET UP W AND EXECUTE HIGH LEVEL WORD RETPNT: .WORD ASMRET ASMRET: .WORD GORET GORET: PULX ;RESTORE W STX W PULX ;RESTORE IP STX IP RTS CHKFLG: BLT TRFLAG FLFLAG: CLRA CLRB JMP BINARY TRFLAG: LDD #$FFFF JMP BINARY SETFLG: BLO TRFLAG BRA FLFLAG SFALSE: CLRA CLRB JMP NEXTSD STRUE: LDD #$FFFF JMP NEXTSD POPTWO: INY ;THROW AWAY THE VALUES ON DATA STACK INY POP: INY INY JMP NEXT BUMP: LDX IP INX INX JMP NEXT3 ;BRANCH NOT TAKEN 306 BINARY: STD 2,Y JMP POP ;***************************************************************************** ; PUSHD, ANOTHER ENTRY TO NEXT ;***************************************************************************** PUSHD: DEY DEY NEXTSD: STD 0,Y ;STORE DOUBLE ACCUMULATOR ON STACK ;***************************************************************************** ;NEXT IS THE ADDRESS INTERPRETER THAT MOVES FROM ;MACHINE LEVEL WORD TO WORD. ;***************************************************************************** NEXT: LDX IP ;X NOW CONTAINS THE ADDRESS OF A COLON DEF ;ENTRY. X POINTS TO A POINTER TO A POINTER ;TO CODE. NEXT3: INX ;POINT TO NEXT COLON DEF ENTRY TO EXECUTE INX STX IP NEXT1: LDX 0,X ;X NOW POINTS TO CFA OF COLON DEF NEXT2: STX W ;W IS A POINTER TO A POINTER TO CODE LDX 0,X ;X IS NOW A POINTER TO CODE JMP 0,X ;JUMP TO ANOTHER INTERPRETER ;***************************************************************************** ; INNER INTERPRETERS AND SEMIS FOLLOW ;***************************************************************************** DOSUB: LDX W ;W IS POINTER TO CFA OF WORD NOW EXECUTING JSR 2,X ;EXECUTE SUBROUTINE BODY JMP NEXT CSDOE: LDD 0,Y LSLD ADDD W ADDD #2 XGDX LDD 0,X STD 0,Y JMP EXEC+2 DO2CON: LDX W ;GET CFA OF CONSTANT LDD 4,X ;GET DATA OUT OF PFA OF CONSTANT DEY DEY STD 0,Y LDD 2,X JMP PUSHD DOCON: LDX W ;GET CFA OF CONSTANT LDD 2,X ;GET DATA OUT OF PFA OF CONSTANT JMP PUSHD DOUSE: LDX W ;GET CFA OF USER VARIABLE 307 CLRA ;OFFSET IS A BYTE LDAB 2,X ;GET OFFSET OF USER VARIABLE ADDD UP JMP PUSHD DOVAR: LDD W ADDD #2 JMP PUSHD DODOE: LDX IP PSHX ;SAVE IP ON STACK LDX W ;GET POINTER TO CFA OF DOES WORD INX INX ;NOW X POINTS TO PFA OF DOES WORD PSHX ;SAVE IT FOR LATER LDX 0,X ;GET FIRST PFA ENTRY FROM DOES WORD STX IP PULX ;RECOVER CFA ADDRESS INX ;MAKE IT POINT TO PFA ADDRESS INX XGDX JMP PUSHD ;PUT PFA ADDRESS ON STACK DOCOL: LDX IP ;PUSH IP ONTO RETURN STACK PSHX LDX W STX IP JMP NEXT3 EXIT: SEMIS: CFAFLD PULX ;GET OLD IP JMP NEXT3 ;ENTER NEXT AFTER IP LOADED INTO X 308 Max-FORTH 68HC11 SELECTED OPERATING SYSTEM SEGMENTS ;***************************************************************************** ; VERSION AND REVISION LOG WITH EXPANATIONS AND CONDITIONAL ASSEMBLY LABELS ;***************************************************************************** ; VERSION 1 IS NON AUTOSTART FOR EXTERNAL EPROM (AUTOSTART FORCED TO EPROM) ; VERSION 2 IS AUTOSTART VERSION FOR EXTERNAL EPROM ; VERSION 3 IS AUTOSTART VERSION FOR INTERNAL ROM ; REVISION 0 WAS FIRST RELEASE ; REVISION 1 PUT FIXES IN UM/MOD, VOCABULARY, DODOES, ABORT", AND ?STACK ; REVISION 2 CHANGES EEC! FOR SAFTEY, MOVES INITCON TO $B000 ;***************************************************************************** ;***************************************************************************** ; OPERATING SYSTEM ;***************************************************************************** COLD: CFAFLD STX UAREA+CLDOFF ;BOMB CLDVAR FLAG, USE HARD ADDR RESET: LDS #RPINIT LDD $B7FE ;CHECK FOR IMMEDIATE AUTOSTART SUB CPD #BOOTME BNE RES1 JSR $B7FB ;LEAVE FOR QUICK START RES1: LDAA #REGCTL ;RAM AT 0, REGS AT $B000 STAA INIT+$1000 ;A/D UP WITH E CLOCK, ;IRQ LEVEL SENSITIVE, ;CLOCK MONITOR DISABLED, ;COP TIMER RATE SELECTED 1.049 SECONDS LDAA #$93 STAA OPTION+INITCON LDAA #$0C STAA SCCR2+INITCON ;SCCR2 GETS C LDAA #$30 STAA BAUD+INITCON LDAA INITCON+SCDR ;LOOK AT SER IN CMPA #$07 ;BELL CHAR BEQ ISCOLD ;DO COLD NO MATTER LDD #BOOTME ;LOOK AT CLD/WRM CPD UAREA+CLDOFF ;CMP TO BOOTME PATTERN BEQ SEARCH ;BYPASS COLD DNLOAD IF = ISCOLD: LDY #RNTOP LDX #NTOP TSKMOV: LDAB 0,Y STAB 0,X 309 INY INX CPX #NTOP+9 BLO TSKMOV LDY #CLDTOP LDX #UP+CLDSIZ CN: DEY DEX LDAB 0,Y ;GET BYTE FROM TABLE STAB 0,X ;PUT IT IN USER AREA CPX #UP ;UP ITSELF IS BOTTOM OF MOVE BNE CN SEARCH: LDY UAREA+S0OFF .IFDEF VERSION1 LDX #STRTUP STX IP EEPSRC: LDX #$E000 ;SECURITY V1.X LDD 0,X CPD #BOOTME BEQ GOSTRT .ELSE ;VERSION2 AND VERSION3 LDD #BOOT1ST BRA EEPSRC PASS2PTR: .WORD PASS2CFA PASS2CFA: .WORD PASS2PFA PASS2PFA: LDD #BOOTME EEPSRC: LDX #PASS2PTR-2 STX IP LDX #$B600 ;CHECK EEPROM FOR AUTOSTART CPD 0,X BEQ GOSTRT .ENDIF LDX #0 ;INIT POINTER FOR ROM SEARCH, V2,3 ROMSRC: XGDX ;ADD 4 TO TOP BYTE OF POINTER ADDD #$400 XGDX .IFDEF VERSION1 LDD 0,X CPD #BOOTME .ELSE ;VERSION2 AND VERSION3 BEQ PASS2PFA CPD 0,X .ENDIF BNE ROMSRC GOSTRT: LDX 2,X JMP NEXT2 310 ;***************************************************************************** ;HI-LEVEL ROUTINES, OPERATING SYSTEM ;***************************************************************************** ;STARTUP STRTUP: CFAFLD DOCOL .WORD CR ; CR .WORD PDOTQ ; (.() .BYTE 15,' Max-FORTH Vx.x' .WORD ABORT ; ABORT ABORT: CFAFLD DOCOL .WORD SPSTO ; SP! .WORD FORTH ; FORTH .WORD DEFIN ; DEFINITIONS .WORD QUIT ; QUIT QUIT: CFAFLD DOCOL .WORD BLK ; BLK .WORD CLEAR ; 0 ! .WORD LBRAC ; [ QUIT1: .WORD RPSTO ; RP! .WORD CR ; CR .WORD QUERY ; QUERY .WORD INTER ; INTERPRET .WORD QSTATE ; STATE @ .WORD NZBRAN ; 0= NOT .WORD QUIT1-$ ; IF .WORD PDOTQ ; (.() .BYTE 2,'OK' .WORD BRAN ; BRANCH .WORD QUIT1-$ ;***************************************************************************** ;BOOT UP PARAMETERS. ;***************************************************************************** CLDBOT: .WORD 6 ;UP INIT .WORD 0 ;DNLINK INIT .WORD 0 ;UPLINK INIT .WORD 0 ;PRIORITY INIT .WORD 0 ;RPSAVE INIT .WORD RPINIT ;R0 RETURN STACK INIT .WORD BOS ;S0 DATA STACK INIT .WORD DEFKEY ;DEFAULT INPUT CONTROL BLOCK .WORD DEFOUT ;DEFAULT OUTPUT CONTROL BLOCK .WORD KEYSUB+2 ;'VECTORED' INPUT ROUTINE .WORD EMITSUB+2 ;'VECTORED' OUTPUT ROUTINE .WORD QTSUB+2 ;'VECTORED' STATUS ROUTINE .WORD TIBX ;TIB INIT .WORD 16 ;UC/L INIT CHARACTERS PER LINE .WORD BOOTME ;CLD/WRM .WORD UPADINIT ;PAD INIT .WORD 10 ;BASE .WORD 20000 ;C/10MS .WORD $D ;DEFAULT TERMINATION CHARACTER 311 .WORD 8 ;DEFAULT BACKSPACE INPUT CHARACTER .WORD TOP ;INITIAL VALUE OF 'DP' .WORD 0 ;INITIAL SEPERATED HEADS DP .WORD $B604 ;INITIAL EEPROM DP .WORD 0 ;INITIAL HEADERLESS .WORD UAREA+UASMOF+2 ;INITIAL 'VOC-LINK' .BYTE $81,$A0 ;CHAIN HEAD OF FORTH .WORD NTOP ;INITIAL VOCABULARY POINTER .WORD 0000 ;VOCABULARY LINK OF 'FORTH' IS NIL .BYTE $81,$A0 ;CHAIN HEAD FOR ASSEMBLER .WORD EDTOP ;INITIAL VOCABULARY PTR FOR ASSEM .WORD UAREA+U4TH+2 ;VOCAB LINK TO 'FORTH' VOC PTR .BYTE $81,$A0 ;CHAIN HEAD FOR ASSEMBLER .WORD ASMTOP ;INITIAL VOCABULARY PTR FOR ASSEM .WORD UAREA+UEDOFF+2 ;VOCAB LINK TO 'FORTH' VOC PTR .WORD 31 ;SET 'WIDTH' OF NAMES .WORD NTOP ;INITIAL VALUE OF 'FENCE' .WORD ABORT ;INIT USER ABORT VECTOR .WORD $D7FC ;FIRST .WORD $E000 ;LIMIT .WORD 0 ;OFFSET .WORD 0 ;WARNING ASSUMES NON DISK SYS .WORD RAMDSK ;UR/W FAIL CLDTOP: .EQU $ CLDSIZ: .EQU CLDTOP-CLDBOT ;***************************************************************************** ;DEFAULT I/O CONTROL BLOCKS. ;***************************************************************************** DEFKEY: .WORD INITCON+SCSR ;ADDRESS OF INPUT STATUS REGISTER .BYTE $20 ;AND MASK .BYTE 0 ;XOR MASK .WORD INITCON+SCDR ;ADDRESS OF INPUT REGISTER DEFOUT: .WORD INITCON+SCSR ;ADDRESS OF OUTPUT STATUS REG .BYTE $80 ;AND MASK .BYTE 0 ;XOR MASK .WORD INITCON+SCDR ;ADDRESS OF OUTPUT REGISTER .BYTE 'COPYRIGHT 1986 NMI' KEND: .EQU $ ;VARIABLE LOCATIONS .ORG $FFC0 .WORD 0 ;RESERVED $FFC0 .WORD 0 ;RESERVED $FFC2 .WORD 0 ;RESERVED $FFC4 .WORD 0 ;RESERVED $FFC6 .WORD 0 ;RESERVED $FFC8 .WORD 0 ;RESERVED $FFCA .WORD 0 ;RESERVED $FFCC .WORD 0 ;RESERVED $FFCE .WORD 0 ;RESERVED $FFD0 .WORD 0 ;RESERVED $FFD2 .WORD 0 ;RESERVED $FFD4 312 .WORD $B7BF ;RESERVED $FFD6 SCI .WORD $B7C2 ;RESERVED $FFD8 SPI .WORD $B7C5 ;RESERVED $FFDA PAIE .WORD $B7C8 ;RESERVED $FFDC PAOV .WORD $B7CB ;RESERVED $FFDE TO .WORD $B7CE ;RESERVED $FFE0 TOC5 .WORD $B7D1 ;RESERVED $FFE2 TOC4 .WORD $B7D4 ;RESERVED $FFE4 TOC3 .WORD $B7D7 ;RESERVED $FFE6 TOC2 .WORD $B7DA ;RESERVED $FFE8 TOC1 .WORD $B7DD ;RESERVED $FFEA TIC3 .WORD $B7E0 ;RESERVED $FFEC TIC2 .WORD $B7E3 ;RESERVED $FFEE TIC1 .WORD $B7E6 ;RESERVED $FFF0 RTI .WORD $B7E9 ;RESERVED $FFF2 IRQ .WORD $B7EC ;RESERVED $FFF4 XIRQ .WORD $B7EF ;RESERVED $FFF6 SWI .WORD $B7F2 ;RESERVED $FFF8 ILL OPCODE .WORD $B7F5 ;RESERVED $FFFA COP FAIL .WORD $B7F8 ;RESERVED $FFFC CLK MON ; $B7FB IS BOOT00 VECTOR ; $B7FE IS BOOT00 PATTERN .WORD RESET 313 ERROR MESSAGES Standard Error Message ? (question mark) is the standard error message in Max-FORTH. An error exists when Max-FORTH responds with a ? prefixed with one of the following: - the most recently entered word which is not part of the Max-FORTH dictionary or - the most recently entered number which is not valid under the cur- rent BASE. Example: Enter WRONG . WRONG is not a part of the Max-FORTH dictionary, therefore, Max-FORTH will respond with WRONG ? . Enter HEX . Max-FORTH will respond with OK . TYPE 10H . Max-FORTH will respond with 10H ? since 10His not a valid hexadecimal number. STANDARD ERROR MESSAGE ROUTINE Max-FORTH has a standard routine for handling errors depending on the value of the user variable WARNING which is not named in the dic- tionary: WARNING value Max-FORTH action less than 0 executes the word ABORT 0 prints an error message number n greater than 0 assumes that a disk (RAMdsk) is in use ERROR MESSAGE DEFINITIONS When Max-FORTH detects an error condition, it may respond with an error message which corresponds to an error message number shown in the Table below. Max-FORTH clears the stacks and executes QUIT as its last actions when an error is processed, except for the follow- ing messages: NOT UNIQUE has no effect on stacks, Max-FORTH execution con- tinues normally. HAS INCORRECT ADDRESS MODE shows the name of the code word being defined, the name of assembler op-code word be interpreted, and the message number. 314 Max-FORTH ERROR MESSAGES 18 EXECUTION The word -------------------------------- just interpreted -------------------------------- must be -- ONLY used outside Number Message Defini- of a definition. tion -------------------------------- 19 CONDITIONALS Omitted -------------------------------- words or incorrect -- nesting NOT PAIRED of condition- 0 ? Echoed word was als the most recently interpreted. The 20 DEFINITION Defini- word is not in tion is not the dictionary or finished or is not a valid NOT FINISHED delimiter is number. missing. 1 STACK EMPTY Parameter 21 IN PROTECTED The word stack is empty. in question is below the DICTIONARY FENCE . 2 DICTIONARY Dictionary space is used up. 22 USE ONLY WHEN Incor- FULL FIRST HERE rect use of the is less than $A0 word --> . LOADING 3 HAS Address mode for that assembler 23 NO NAME Name ex- INCORRECT op-code is pected in input, incorrect. not found. ADDRESS MODE 4 NOT UNIQUE The of the word just defined already exist in the dic- tionary. 5-6 --- Not assigned 7 FULL STACK The parameter stack is full. 8-16 --- Not as- signed. 17 COMPILATION The word just inter- preted must be ONLY used inside of a definition. 315 protected word or move FENCE . -------------------------------- -------------------------------- -- Do not use --> when not loading. Recovery Action -------------------------------- -------------------------------- Use appropriate name string. -- Check the word's name for spell- ing error or define the named word. Check if the number is valid under the current BASE or change BASE . Put more numbers into the stack or quit pulling out number from the empty stack. Increase dictionary space by moving FIRST or by FORGETing dis- posable word entries. Correct the address mode. Max-FORTH uses the latest defini- tion of . Reminder: previous definition of is still in the system and is acces- sible by FORGETing the recent . DROP or output some stack item. Do not use the word for inter- preting. Do not use the word in defining. Correct or add the conditional pair. Finish the definiton or add delimiter. Quit trying to FORGET a 316 A PRIMER FOR BEGINNERS WHAT IS A COMPUTER LANGUAGE ? What a Computer Does Few people would argue that the powers and uses of the computer are anything less than amazing. Computers, both great and small effect our lives every day. Most of our bills are prepared by large automated systems, as are paychecks, tax forms and mail- ings. Small computers perform every function from controlling traffic lights to timing how long our dinner cooks in the microwave oven. Everywhere we see computers being used, some taking over tasks from less efficient methods and others tackling new tasks never before possible. Why are computers being used so commonly? The answer is very simple, actually. It is because of what they do as compared to what they cost. But what do they do? Few people actually under- stand what computers really do. They see the end result of the computers' work but have no concept of how it is accomplished. The job of a programmer is not only to know what the computer does but also how to make the computer do all it can. Although the results look very complicated, a computer only does one small thing at a time. Each task or instruction it does is relatively simple. The power of a computer comes from the speed at which it can complete these small tasks. Just imagine how ef- fective you would be if you could accomplish around a million things a second. This, then, is the key. A computer ac- complishes great tasks by doing very small and simple tasks very quickly. By combining a list of these simple tasks together, a programmer defines what he wants the computer to do. This list is called a program. When correctly prepared and entered into the computer, the program will be executed one instruction at a time. Never is there any more than one machine code instruction being executed at one time. A computer has fixed number of instructions that it understands. This group of instruction is called the "instruction set". Programs written using the instruction set directly are called machine code programs. Each instruction in the instruction set performs one carefully defined task. Generally, it takes hundreds of these instructions to be arranged in a program to do a function most people would consider useful. Even simple cal- culators which are made from programmed microcomputers need thousands of instructions in their programs to read the keyboard, perform calculations and display or print the results. When we use a calculator we can see the end result but cannot see that the computer inside is actually doing only one small thing at a time. For instance, the program probably spends most of its time waiting for a key to be pressed and keeping the right number dis- played. The routines that do these tasks use many more instruc- tions than you might expect. Each key for example must be looked 317 at individually to see if it is pressed or not. Ten or twenty machine code instructions may have to be executed to read just one key. Most calculators have 14 or more keys that several hundred instructions must be done to look at the key pad once, yet the computer does it so quickly that you may think that it is reading all the keys at once at all times. Besides checking up on the key pad, microcomputers in calculators are also turning on the digits of the display one at a time. The scanning is so fast that you are not able to tell. It looks like all the digits are on all the time, but in most LED calculators only one digit is active at a time. Still the computer is doing one instruction at a time and it may take up to a hundred of these instructions just to show one digit, then a hundred more to show the next. Computers truly are amazing, but not for the reason most people think. It is not that the computer can do complex things but rather that the computer can do so many simple things so quickly. Beyond that it is up to the programmer to arrange instructions in sequences which do the job that others think complex. Zeros and Ones Inside the computer, the program is stored in binary format. Be- cause of the nature of the components computers are built with, only on and off state can be stored. Each binary digit (shortened and called "bit") can either be in an 'on' or an 'off' state. It can only be in one state at any given instant of time. Because it is easier to think of those little bits of data as num- bers instead of on's and off's, we generally speak of them as being in a " 0 " or " 1 " for off and on state, respectively. Computer memory generally does not uniquely keep track of every single bit of information, it has but instead groups of bits together. The bits are organized into fixed groups by size. These group of bits are called "memory locations". They are also sometimes called "memory cells" and even "words of memory". By grouping bits together, larger numbers than just 0's and 1's can be stored at a memory location. The more bits gathered per cell, the greater the range of number the computer can store in that location. Each computer will have its own "word" size but some of the more popular sizes are 4, 8, 16 and 32 bits per loca- tion. In the memory of the computer all the information the computer works with is stored. Both the numbers or data the computer worked on and the program that tells the computer what to do are stored there. There are usually thousands of locations in memory. Often the program is stored in one area of memory and the data that the program works on in another. To the untrained eye the patterns of zeros and ones that make up a computer program seem random - having no meaning. But to the computer each group of bits represents one unique instruction to be ac- complished in a sequence. The following list of zeros and ones 318 is a program that was written for the 68HC11 microprocessor. This program adds two numbers together and stores the result in a third area. 1111110000010010001101001111001100010010001101101111110100010010- 00111000 Even trained programmers have trouble recognizing programs when they are written like that. It is difficult to distinguish where one group of bits ends and another starts. Since the size of memory locations used by the 68HC11 processor are 8 bits wide, we can arrange the format in which our program is written, dividing the zeros and ones into 8-bit groups, one per line. 11111100 00010010 00110100 11110011 00010010 00110110 11111101 00010010 00111000 This still does not give much of a clue to what the computer sees in this pattern. For us, even when the pattern repeats, it is difficult to recognize because of the sheer numbers of zeros and ones shown. If these numbers are considered to be one 8-bit bi- nary number, we can translate them into another number base more easily handled by humans. Base 16, called hexadecimal is very popular for representing binary numbers in a more readable for- mat. This is because all the information contained in eight bi- nary digit can be completely and exactly expressed with only two hexadecimal digits. FC 12 34 F3 12 36 FD 12 38 In our rewritten our addition program using hexadecimal numbers (called hex, for short) instead of binary, the format is easily more recognizable. Still the numbers do not make any obvious sense. Since more than one location is sometimes used to make up one machine code instruction, we could group the locations that represent a single instruction together on one line and again look at the program. FC 12 34 F3 12 36 FD 12 38 319 Not until each line is explained by function can any sense be made from this program. When computers were first made there were no tools to help programmers write programs. Everything en- tered into the computer had to be in this type of format of zeros and ones. Programming in this fashion was very difficult and it was very easy to make errors. For these reasons programming languages were invented. Assembly Language From the experience of programming with machine code, it was ob- vious that better tool is needed for programming. The first programming tools were "hex loaders" that allowed the machine programmers to enter programs by typing in hexadecimal digits rather than setting individual switches for every bit. While this was an improvement, it was far from an end-all solution. The step that followed lead to the creation of programming lan- guages. A complete programming language translates program in- structions written according to certain rules, called syntax, into machine code instructions. The first programming languages made were called assemblers. The code written for assemblers is called assembly language. Assembly language allows a programmer to write machine coded instruction as group of letters rather than numbers. Each machine code instruction is assigned a spe- cial name called a mnemonic. These names are chosen carefully to have a close connection to the function performed by the instruc- tion. They are much easier to remember than the zeros and ones they represent. Look at the same program written before in machine code and compare it to the listing below written in as- sembly language. The structure of the program is much more ob- vious now. Even without being able to write an assembly language program you can understand the purpose of some of the instruc- tions now. LDD $1234 ADD $1236 STD $1238 Assembler were a great help to the programmers. Letting the as- sembler translate the program from mnemonics to machine code greatly reduced of the commonly made programmer errors. It was quicker to write an assembly language program and run the as- sembler to translate it to machine code, than it was to write in machine code directly. The assembler can also do certain mathe- matical operations for the programmer. Many assemblers have provisions to allow numbers to be entered in different number bases. The programmer is not limited to only hexadecimal. If a programmer wanted to add two decimal number, rather than figuring what the binary or hex numbers are, the programmer simply uses a sign to specify the base. The assembler does the conversion. Further, assemblers allow a written name to stand in the place of an actual number. The numbers can be assigned to names once in the beginning of a program, and there after be refered to by name 320 in much the same way the mnemonics are used to stand in for the actual machine opcodes. Look again at the addition program again with symbolic names used in the instructions. LDD COUNT1 ADD COUNT2 STD TOTALS Programmers often find that many of the programs they write have similar needs. For instance, nearly every program may need to display a cue or message to the operator. Rather than recreate that code everytime programmers began to catalogue small portions of code. These are generally referred to as "routines". Some- times the routines were grouped together in libraries where they could be called out when needed. It was very convenient to think of a function as routine rather than so many distinct lines of code. Although assembly language was a great improvement over machine coding procedures, few people were adept at using it. The problem is two fold. First, machine coded instructions are directly re- placed by assembly language instruction one for one. In order to understand how to write a program in assembly language the programmer must know all the details of the machine, how many registers it has, what each instruction is and does, and how it will affect the status of the machine for future instructions. This not only requires the programmer to think of many things when programming but in particular to think of the programming in terms of the machine, not the programming problem. The common use of libraries demonstrate that people tend to think of problems in a larger realm than individual instructions allow. Even when breaking a problem into its smallest conceivable parts, the parts do not resemble machine code instructions. Taking the individual parts all the way to their assembly language equiv- alents produces a program that bears no obvious relationship to the original problem. In brief, assembly language use requires a train of thought quite removed from that used in ordinary problem solving. The second reason assembly language did not see more common use is a lack of commonality. Every manufacturer has its own line of machines and therefore a unique instruction set. Even within a manufacturer's line there was no guarantee of consistency from model to model as new designs were added. Since each machine code instruction has one corresponding mnemonic, every time the machine changed so did the assembly language. Knowing how to program on one type of computer was no guarantee of being able to on another. This is a double edge problem. It meant that not only were programmers "locked" into the machines that they know assembly language for, but that their programs were also. If two computer owners wanted to share the work done for their systems, the computers themselves had to be identical (in instruc- tion set) if the programming is to be done in assembly language. This problem is called one of "tranportability". Higher Level Languages 321 Soon after the concept of writing programs in representative sym- bols was proven, work on high level languages began. For the largest part the name "high level" came from these new languages machine independence. This means a high level language program written for one computer could theoretically run just as well on another equipped with the language. A programmers efforts, there- fore, were not restricted to one machine. The origin of the name also has some basis in the level of thought required to solve a programming problem. Most high level languages try to have some orientation that allows a problem to be solved in a method consistent with the natuer of the problem. The object is to free the programmer from thinking in terms of the machine. High level language became very popular quickly. They greatly improved productivity. A programmer could use a language he was already familiar with even if the program was to be used on several different machines and he could think of the problem in a "high level". Less time was needed to write programs in high level languages as opposed to assembly language. The usefulness of a high level language depended on many things. Largely it can be summarized in the number of applicable routines or functions built into the language. Any time a translation is involved there will be inefficiencies. While high level language certainly let programmers write programs faster, they did not necessarily write fast programs. Actually quite the opposite. Since the routines predefined in high level languages were to be as general purpose as possible they had to accomodate many things not needed in every situation. The result was an excess of machine code generated in practically every instance that ran slower than a similar program written in assembler. When high level languages were becoming available another inter- esting phenomenon was also shaping the future of the computer in- dustry. Hardware costs were very high so "through-put" of the computer was very important. The more tasks that could be run per hour, the less each one costs. Programs that organized the computer's work load, scheduling programs to be run and keeping track of the system states were created. These programs were called "supervisors" or sometimes "operating systems". When a user's program failed, much valuable computer time could be lost trying to recover the system. Because this time was so expen- sive, there was considerable impetus to put limits on the user. High level languages were designed to limit the user from the machine. The concept was to protect many users from the careless- ness of one. Since many users felt that they were entitled to more control than the languages and Operating Systems allowed, many clever schemes were developed to beat the system. ("I'm going to make it run my program next, no matter what!"). This only escalated the problem further as more security was added in the system and the user was afforded less and less control over his programs and the environment under which it ran (a classic case of creeping socialism). 322 The situation has radically changed since the mold for most high level languages was made. Hardware costs are now so low that if a programmer wastes even hour's time on a program, he may have wasted more money than it would cost to purchase and operate the computer he is programming for a lifetime. Under such circumstances, having the operating system and lan- guage restrict the programmer from system access has to be care- fully re-thought. If the computer is to be dedicated to a real time task, it is not practical to isolate the programmer from the hardware. There are certainly no other users to protect and a system crash is usually cured by the pressing of the reset but- ton. The validity of premises that conventional languages were designed under are totally reversed. Consequently, it is resonable to assume that programming in a language which has a different base set of premises, more applicable to the situation of the present day will surely be more efficient. This is ex- actly the case with FORTH. 323 ASCII TABLE 324 SELECTED REFERENCES 325 LIMITED USE SOFTWARE LICENSE AGREEMENT 1. WHAT THIS IS. This is the New Micros Inc ("New Micros") Limited Use Software License Agreement (the "Agreement"), which will govern your use of the New Micros product contained with it. YOU AGREE TO THE TERMS OF THIS AGREEMENT BY THE ACT OF OPENING THE SEALED PACKAGE THAT CONTAINS THE MEDIA ON WHICH THE SOFTWARE IS RECORDED. DO NOT OPEN THE PACKAGE WITHOUT FIRST READING, UN- DERSTANDING AND AGREEING TO THE TERMS AND CONDITIONS OF THIS AGREEMENT. YOU MAY RETURN THE SOFTWARE FOR A FULL REFUND BEFORE OPENING THE SEALED PACKAGE. 2. GRANT OF LICENSE. New Micros hereby grants you, and you ac- cept, a limited license to use the enclosed ROM(s), Reference Manual(s), and any related materials (collectively called the "Software" in this Agreement). You may use the Software only on a single computer, on its temporary replacement, or on a subse- quent computer. If you wish to use the Software on more than one computer system, you must either license an additional copy of the Software or request for a multi-use license from New Micros. You may not transfer or sublicense, either temporarily or per- manently, your rights to use the Software under this Agreement without the prior written consent of New Micros. 3. TERM. This Agreement is effective from the day you open the sealed package containing the media on which the Software is re- corded and continues until you return the original media to New Micros. You must also certify in writing that you have destroyed any archival copies you may have recorded on any memory system or magnetic medium. 4. NEW MICROS' RIGHTS. You acknowledge that the Software is the sole and exclusive property of New Micros. By accepting this Agreement, you do not become the owner of the Software, but you do have the right to use the software in accordance with this agreement. You agree to use your best efforts and all reasonable steps to protect the software from unauthorized use, illegal reproduction, or illicit distribution. 5. YOUR ORIGINAL MEDIA/ROM PART. The ROM enclosed each contain an original New Micros label. Either the ROM or the Reference Manual can NOT be copied into any medium. In case of media failure of an original part, New Micros will replace the ROM upon receipt of failed parts. New Micros will not replace failed parts that have been used improperly or abused, such as improper handling, excessive voltage application, etc. 6. CUSTOMER REGISTRATION. New Micros may from time to time revise or update the Software. Revisions can only be provided to you if you have returned the registration form to New Micros and if your Software are the originals. New Micros customer service are available only to registered New Micros users. 326 7. LIMITED WARRANTY. New Micros warrants for a period of ninety (90) days from the effective date of this Agreement that, under normal use, the material(s) of the media is/are not defective and that the program is properly recorded into the ROM. If during the ninety-day period, a defect in the Software should appear, you may return the Software free of charge. Your sole right with respect to a defect in the Software is replacement of the Software. EXCEPT FOR THE LIMITED WARRANTY DESCRIBED IN THIS PARAGRAPH, THERE ARE NO WARRANTIES EXPRESSED OR IMPLIED, BY THIS AGREEMENT. THESE INCLUDE, BUT ARE NOT LIMITED TO, IMPLIED WARRANTIES OF MER- CHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, AND ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. 8. LIABILITY. You agree that regardless of the form of any claim you may have, New Micros' liability for any damages to you or to any other party shall not exceed the license fee paid for the Software. NEW MICROS WILL NOT BE RESPONSIBLE FOR ANY DIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, SUCH AS, BUT NOT LIMITED TO, LOSS OF PROFITS RESULTING FROM THE USE OF THE SOFTWARE OR ARISING OUT OF ANY BREACH OF THE WARRANTY, EVEN IF NEW MICROS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOME STATES DO NOT ALLOW THE LIMITATION OR EXCLUSION OF LIABILITY FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE ABOVE LIMITATION OR EXCLUSION MAY NOT APPLY TO YOU. YOU MAY ALSO HAVE OTHER RIGHTS THAT VARY FROM STATE TO STATE. 9. TERMINATION OF AGREEMENT. If any of the terms and conditions of this Agreement are broken, New Micros has the right to ter- minate the Agreeement and demand that you return the Software to New Micros. At that time, you must also certify that you have not retained any copies of the Software. 10. GOVERNING LAW. This agreement is to be governed by, and in- terpreted in accordance with, the laws of the State of Texas and the United States. Any terms or conditions of this Agreement found to be unenforceable, illegal, or contrary to public policy in any jurisdiction will be deleted, but will not affect the remaining terms and conditions of the Agreement. 11. ENTIRE AGREEMENT. This Agreement constitutes the entire agree- ment between you and New Micros. I, the undersigned have read and agree to the terms of this agree- ment. -------------------------------- -------------------- Customer's Signature Date Note: To order any Max-FORTH Version 2.0 or higher, you must return this License Agreement signed and dated to: New Micros, Inc. * 1601 Chalk Hill Rd. * Dallas, TX 75050 * 327 Tel: 214-339-2204 328 329 330