copyright 1989 Frank C. Sergeant GLOSSARY of Pygmy words the FORTH vocabulary, generally in order of appearance in the source code (see PYGMY.SCR) You can use the editor's search across screens facility to help find what you want ( F3, F9, F10 ). COMP ( a1 a2 len - -1 | 0 | +1 ) ( a1<a2=-1;a1=a2=0 a1>a2=1) 1+ ( n - n+1) 1- ( n - n-1) SP! ( -) initialize data stack RP! ( -) initialize return stack lit ( -n) runtime code for LITERAL array ( n -a) runtime code for arrays such as BUFFERS var ( - a) runtime code for VARIABLEs 0branch ( f -) runtime code for conditional branches branch ( -) runtime code for unconditional branches 0 ( - 0) often used constant 1 ( - 1) " " " -1 ( - -1) " " " 2 ( - 2) " " " docol ( -) runtime for colon definitions - nest dodoes ( -a) runtime for DOES> words CS@ ( - seg) returns segment address of this program 'VIDEO ( - addr_6845 video_buffer) used in RESET V! ( c attr addr -) store directly into video memory V@ ( addr - c attr) fetch directly from video memory MOVEL ( fr-seg fr-off to-seg to-off word-count -) long move CODE P! ( n port -) store word to I/O port CODE PC! ( c port -) store byte to I/O port CODE P@ ( port - n) fetch word from I/O port CODE PC@ ( port - c) fetch byte from I/O port for ( n -) runtime begin FOR/NEXT loop. Push index to rstk. next ( -) runtime loop back if top or rstk not zero. 2* ( -) left shift 1 bit. 2/ ( -) unsigned right shift 1 bit DROP ( n -) OR ( n n - n) XOR ( n n - n) AND ( n n - n) + ( n n - n) - ( n n - n) 0< ( n - f) zero-less-than NEGATE ( n - -n) take two's complement of n D2* ( l h - l h ) multiply double number by 2 ROT ( n1 n2 n3 - n2 n3 n1 ) SWAP ( n1 n2 - n2 n1 ) 0= ( n - f) true if n is zero NOT ( n -f) same as 0=, this is not a bit complement as in F83 OVER ( n1 n2 - n1 n2 n1) ! ( n a -) store value n into address a @ ( a - n) fetch value from address a < ( n n - f) > ( n n - f) = ( n n - f) U< ( n n - f) unsigned less than U/MOD ( u u - r q ) UM/MOD ( l h u - r q ) returns r q ( not q r) */ ( n1 n2 u3 - n) ( n1*n2 /u3) * ( n n - n) multiply / ( n n - q) (signed) divide U/ ( u u - q) (unsigned) divide M* ( n n - d) produces double number product M/ ( l h n - q ) signed division of double by single UMOD ( u u - r ) 2/MOD ( u - r q ) fast - moved out of kernel to SUPPL.SCR +! ( n a -) increment the value at address a by n (pos or neg) C! ( b a -) store byte b at address a C@ ( a - b) fetch byte from address a 2@ ( a - d) fetch 32 bits from address a, ms-word is on top 2! ( d a -) store 32 bits at a, ms-word goes in lower address CMOVE ( fr to # - ) starts the move from low end CMOVE> ( fr to # - ) starts the move from high end FILL ( addr # value -) PUSH ( n -) same as >R POP ( - n) same as R> DUP ( n - n n) ?DUP ( n - n n) duplicates n only if it is not zero 2DUP ( d - d d) 2DROP ( d -) I ( - n) index in a FOR/NEXT loop. Also used in place of R@. WITHIN ( n l h - f) ABS ( n - u) MIN ( n n - n) MAX ( n n - n) EXECUTE ( a -) EMIT ( c -) deferred - usually executes (EMIT) KEY ( - c) deferred - usually executes (KEY) KEY? ( - f) deferred - usually executes (KEY?) CR ( -) deferred - usually executes (CR) system variables PREV ( - a) last referenced buffer OLDEST ( - a) Oldest loaded buffer BUFFERS ( n - a) Block in each buffer NB ( - n) Number of buffers ( constant) TIB ( -a) holds address of Terminal Input Buffer SPAN ( -a) holds count of characters received by EXPECT >IN ( -a) holds offset into input stream from BLOCK or TIB BLK ( -a) if zero, loading from keyboard, else block number dA ( -a) address of relocation factor used when meta-comp. system variables continued SCR ( -a) screen number used when listing or editing ATTR ( -a) attribute for video display - used by (EMIT) CUR ( -a) cursor location used by (EMIT) CURSOR ( -a) base address used by editor (it is misnamed) BASE ( -a) current number base H ( -a) next free location in dictionary CONTEXT ( -a) holds 2 for FORTH or 4 for COMPILER VID ( -a) holds segment address for video ($B000 for mono) CRTC ( -a) holds addr of 6845 addr reg (03B4 mono/ 03D4 color) (EMIT) ( c-) fast direct video write (KEY) ( - c) waits for keystroke & returns it - DOS call (KEY?) ( - f) has a key been pressed? - DOS call BYE ( -) terminate program & return to DOS DOS ( DX CX BX AX - AX carry) so you can make DOS calls DOS2 ( DX CX BX AX - DX AX carry) without using assembly lang. ?SCROLL ( -) put in loops to allow any key to halt or Esc cancel(CR) ( -) EMITs carriage return & line feed codes TYPE ( a # -) this is the same as F83's TYPE TYPE$ ( a -) takes a counted string and does COUNT TYPE COUNT ( a - a+1 #) prepare for TYPE - not same as cmFORTH COUNT SPACE ( -) EMIT a space SPACES ( n) EMIT n spaces HOLD ( ..# x n - ..# x) used for numeric formatting EXIT ( -) drops return stack to pop out of this word immediatelyEXPECT ( a # -) accepts # characters from keyboard DIGIT ( n -n) converts one digit to ASCII <# ( n - ..# n) starts numeric output conversion - single! #> ( ..# n) not only completes formatting, but types number tooSIGN ( ..# n n - ..# n) plugs in leftmost minus sign for neg # ( ..# n - ..# N) converts one digit for output #S ( ..# n - ..# 0) converts remaining digits while n <> 0 (.) ( n - ..# n) prepares a signed number . ( n) outputs a signed number U.R ( u n) right align unsigned number u in field of n bytes U. ( u) print unsigned number DUMP ( a - a') show 16 bytes of memory as numbers & characters DU ( a n - a) do n+1 lines of DUMP HERE ( - a) H @ ; abort" runtime for ABORT" dot" runtime for ." ADDRESS ( n - a) return address of buffer n ABSENT ( n - n) UPDATED ( - a n) UPDATE ( -) mark most recently accessed buffer for re-writing ESTABLISH ( n a - a) IDENTIFY ( n a - a) MAX-FILES ( - n) n files may be open at once (meta TMAX-FILES) FILES ( - a) table of files #FILES ( -a) holds # of files actually in use OFFSET ( -a) set by UNIT to control relative screen numbers >FCB ( n - a) used to index into FILES table H# ( -a) holds file handle F# ( -a) holds file # #BLKS ( -a) holds size of file in blocks, not used currently HANDLE ( global-blk# - file-blk#) sets H# & F# & adjust blk# .FILE ( n -) print name of file n from file table FILES >F ( dbl-offset -) set file ptr buffer ( n - a) return a of free buffer, writing any updated BUFFER ( n - a) block ( n a - n a) retrieve from disk if no already present BLOCK ( n - a) return addr of block n FLUSH ( -) write any updated buffers back to disk EMPTY-BUFFERS ( -) throw away contents of buffers COPY ( n1 n2 -) copy one block to another PARSE ( delim. source # destin. - source' actual# ) SOURCE ( - source remaining# ) used by word WORD ( delim - a) move next word in input stream to here HASH ( n - vocab-a) holds address of most recent word's LF -FIND ( h n - h true | pfa false) the heart of dictionary srch -DIGIT ( n - n) 10*+ ( u a n - u a) multiplies number by BASE & adds digit NUMBER ( a - n) address is a counted string, count is used ( accepts $8000 $FF 'A 'z etc as numeric literals ) -' ( n - h t | a f) ' ( - a) INTERPRET ( blk# offset -) QUIT ( -) the endless main loop reset ( -) startup word executed by boot - it executes RESET BOOT ( -) DEFER'd word for customizing your applications OCTAL ( -) DECIMAL ( -) HEX ( -) LOAD ( n -) load screen n & then restore base to decimal THRU ( n1 n2 -) don't pass data between screens! LIST ( n -) list screen n CLEAR ( n -) clear screen n ALLOT ( n -) advance H by n bytes , ( n -) store 16 bits in dictionary C, ( c -) store 8 bits in dictionary ,A ( a -) store 16 bit addr in dictionary, relocating if nec. COMPILE when cur. word executes, compile following word ] compile loop PREVIOUS ( - a n) nfa & count of most recently defined header SMUDGE ( flip bit 5 of len byte) COMPILER ( -) set context to 4 ( 2 in cmFORTH) FORTH ( -) set context to 2 ( 1 in cmFORTH) does used by DOES> CREATE build a header & lay down runtime code for variable : begin defining colon definition, smudge header CONSTANT ( n -) define a constant, e.g. 3 CONSTANT THREE VARIABLE ( -) define a variable, e.g. VARIABLE #THINGS CRASH ( -) default vector for DEFER'd words DEFER ( -) define a vectored word, e.g. DEFER EMIT IS ( a-) set the vector, e.g. ' (EMIT) IS EMIT WORDS ( -) list words in current vocabulary .S shows stack empty or exact values on stack - nondestructive? ( a -) print value of a variable ON ( a -) set a variable to true ( -1) OFF ( a -) reset a variable to false ( zero) NFA ( pfa - nfa) .ID ( pfa -) type name of word given it's pfa STRING ( delim -) comma following string into dictionary FORGET ( -) eg FORGET XXX to cut dictionary back F" ( starting-blk# -) used by OPEN to put a file name in table <OPEN> ( n -) ( relative file number 0-9) used by OPEN OPEN ( starting-blk# -) e.g. 800 OPEN C:\WORK\SOURCE.SCR <CLOSE> ( -) used by CLOSE CLOSE ( n -) used by RESET-FILES CLOSE-FILES ( -) only if you are changing the default file names.FILES ( -) print file names & starting block numbers RESET-FILES ( -) OPEN-FILES ( -) UNIT ( n -) make block numbers relative to beginning of file n ( begin a comment & ignore input stream until ending paren RESET ( -) must be last word target compiled in dictionary ED ( -) returns to editor (previously entered with EDIT) EDIT ( n -) enter the editor at screen n