Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
infocom:table_of_opcodes [2024/08/18 15:03] – added EZIP/LZIP ops robertinfocom:table_of_opcodes [2024/11/14 21:34] (current) – external edit 127.0.0.1
Line 6: Line 6:
 | 002 | LESS? int1,int2 |||| PRED | Is int1 less than int2? | | 002 | LESS? int1,int2 |||| PRED | Is int1 less than int2? |
 | 003 | GRTR? int1,int2 |||| PRED | Is int1 greater than int2? | | 003 | GRTR? int1,int2 |||| PRED | Is int1 greater than int2? |
-| 004 | IGRTR? var,int |||| PRED | Increments the value of var by one and succeeds if the new value is greater than int. | +| 004 | DLESS? var,int |||| PRED | Decrements the value of var by one and succeeds if the new value is less than int. | 
-| 005 | DLESS? var,int |||| PRED | Decrements the value of var by one and succeeds if the new value is less than int. |+| 005 | IGRTR? var,int |||| PRED | Increments the value of var by one and succeeds if the new value is greater than int. |
 | 006 | IN? obj1,obj2 |||| PRED | Is obj1 contained in obj2? | | 006 | IN? obj1,obj2 |||| PRED | Is obj1 contained in obj2? |
 | 007 | BTST word1,word2 |||| PRED | Is every bit that is on in word2 also on in word1? | | 007 | BTST word1,word2 |||| PRED | Is every bit that is on in word2 also on in word1? |
Line 28: Line 28:
 | 024 | MOD int1,int2 |||| VAL | Divides int1 by int2, returning the remainder. | | 024 | MOD int1,int2 |||| VAL | Divides int1 by int2, returning the remainder. |
 | 025 | - | CALL2 fcn,any ||| VAL | Same as CALL, but a 2-op. | | 025 | - | CALL2 fcn,any ||| VAL | Same as CALL, but a 2-op. |
-| 026 | - | - | | | | +| 026 | - | - | ICALL2 routine:fcn,arg1:any || | Same as CALL2, but ICALL2 does not have a return value.
-| 027 | - | - | | | | +| 027 | - | - | COLOR fore:int,back:int || | In XZIP, if MODE bit 0 (XCOLOR) is zero, this operation is ignored. In EZIP, this operation does not exist. COLOR causes the foreground color of all subsequently displayed text to be fore, and the background color to be back. 
-| 028 | - | - | | | |+| 028 | - | - | THROW any,frame || | THROW returns any from a frame. It is as though the routine in which the CATCH was done returned any. |
 | 029 | - | - | - | - | | | | 029 | - | - | - | - | | |
 | 030 | - | - | - | - | | | | 030 | - | - | - | - | | |
Line 146: Line 146:
 | 141 | PRINT str |||| | Prints the string pointed to by str times two. The multiplication is necessary because str in this instruction is a word-pointer, guaranteed to point to a string that has been word-aligned. | | 141 | PRINT str |||| | Prints the string pointed to by str times two. The multiplication is necessary because str in this instruction is a word-pointer, guaranteed to point to a string that has been word-aligned. |
 | 142 | VALUE var |||| VAL | Returns value of var. | | 142 | VALUE var |||| VAL | Returns value of var. |
-| 143 | BCOM word |||| VAL | Bitwise logical complement. |+| 143 | BCOM word || ICALL1 routine:fcn || VAL | ZIP/EZIP: Bitwise logical complement. XZIP: ICALL1 a CALL1 without a return value. |
 | 144 | - | - | - | - | | | | 144 | - | - | - | - | | |
 | 145 | - | - | - | - | | | | 145 | - | - | - | - | | |
Line 189: Line 189:
 | 183 | RESTART |||| | Reinitializes the game and generally acts as if it had just been restarted. | | 183 | RESTART |||| | Reinitializes the game and generally acts as if it had just been restarted. |
 | 184 | RSTACK |||| | Does a "RETURN STACK," thereby returning from a CALL and taking the value from the (old) top of the stack. | | 184 | RSTACK |||| | Does a "RETURN STACK," thereby returning from a CALL and taking the value from the (old) top of the stack. |
-| 185 | FSTACK |||| | Flushes the top off the stack. |+| 185 | FSTACK || CATCH || VAL ZIP/EZIP: Flushes the top off the stack. XZIP: CATCH returns a pointer (called a frame) to the call to the current routine. Note that the opcode for CATCH recycles the former opcode for FSTACK. |
 | 186 | QUIT |||| | The game should die peacefully. | | 186 | QUIT |||| | The game should die peacefully. |
 | 187 | CRLF |||| | Prints an end-of-line sequence (carriage-return/line-feed in ASCII). | | 187 | CRLF |||| | Prints an end-of-line sequence (carriage-return/line-feed in ASCII). |
 | 188 | USL |||| | Updates the status line now instead of waiting for the next READ. | | 188 | USL |||| | Updates the status line now instead of waiting for the next READ. |
 | 189 | VERIFY |||| PRED | Verifies the correctness of the game program stored on disk by comparing the 16-bit sim of the bytes in the program, from byte 64 to byte PLENGTH*2-1, with PCHKSUM. Not that for the preloaded area, the unmodified pages on the disk should be used rather than the pages in core. | | 189 | VERIFY |||| PRED | Verifies the correctness of the game program stored on disk by comparing the 16-bit sim of the bytes in the program, from byte 64 to byte PLENGTH*2-1, with PCHKSUM. Not that for the preloaded area, the unmodified pages on the disk should be used rather than the pages in core. |
-| 190 | - | - | - | - | | |+| 190 | - | - | EXTOP opcode:int || | Tells interpreter the following opcode is an extended opcode, meaning that the next byte is an opcode from a new set of 256 instructions different from the first "normal" set. | 
 +| ::: | - | - | EXTOP:256 SAVE start:tbl,length:int,name:tbl || VAL | In XZIP, SAVE (and RESTORE) may be used as atomic i/o operations. | 
 +| ::: | - | - | EXTOP:257 RESTORE start:tbl,length:int,name:tbl || | In XZIP, SAVE (and RESTORE) may be used as atomic i/o operations. | 
 +| ::: | - | - | EXTOP:258 SHIFT int,n || VAL | SHIFT performs a 16-bit logical shift on int, shifting it left n bits if n is positive, and right the absolute value of n bits if n is negative. In a logical shift, the sign bit is not propagated on rightward shifts, but rather zeroed. | 
 +| ::: | - | - | EXTOP:259 ASHIFT int,n || VAL | ASHIFT performs a 16-bit arithmetic shift on int, shifting it left n bits if n is positive, and right the absolute value of n bits if n is negative. In an arithmetic shift, the sign bit is propagated on rightward shifts, meaning that a negative number stays negative. | 
 +| ::: | - | - | EXTOP:260 || VAL | Selects a particular font for the currently selected window, and returns the number of the previously selected font. If the new font cannot be selected for some reason, returns 0. The font should be remembered for that window until it is explicitly changed. Font 1 is the ”normal” font for the machine in question, and it is selected initially for both screen windows. The interpreter is responsible for updating the FWRD parameter word whenever the font changes. FONT prints and empties the output buffer. It should be possible to change fonts many times, even during a line or word of output. In ZIP20, in addition to the normal font (1), and the picture font (2), font 3 is the VT100 character graphics set. | 
 +| ::: | - | - | EXTOP:261 DISPLAY picture:int,x:int,y:int || | A picture is a number that indexes into the ”picture library.” DISPLAY displays a picture at the location (x,y) (specified in pixels). The location given is where the upper left corner of the picture should appear. The upper left corner of the screenis the location 1,1. If the x or y argument is not supplied or 0, then the current x or y position in the current window is used. | 
 +| ::: | - | - | EXTOP:262 PICINF picture:int,data:tbl || PRED | PICINF is used to get data about a picture. The interpreter fills in the table data with the width (word 0) and height (word 1) of the picture specified, in pixels. | 
 +| ::: | - | - | EXTOP:263 DCLEAR picture:int,x:int,y:int || | Clears the area taken up by the picture. i.e., restores the screen background color. | 
 +| ::: | - | - | EXTOP:264 MARGIN left:int,right:int || | Sets left margin and right margin in pixels. | 
 +| ::: | - | - | EXT:265 ISAVE || VAL | This instruction copies the impure area to a reserved part of RAM where it can be copied back by the IRESTORE command. | 
 +| ::: | - | - | EXT:266 IRESTORE || VAL | This instruction causes the saved copy of the impure area to be copied back to the impure area, and thus is a single level UNDO command. | 
 +| ::: | - | - | - || | | 
 +| ::: | - | - | - || | |
 | 191 | - | - | - | - | | | | 191 | - | - | - | - | | |
 ^ XOPs ^ ZIP ^ EZIP/LZIP ^ XZIP ^ YZIP ^ Returns ^ Summary ^ ^ XOPs ^ ZIP ^ EZIP/LZIP ^ XZIP ^ YZIP ^ Returns ^ Summary ^
 | 192 | - | - | - | - | | | | 192 | - | - | - | - | | |
 | 193 | EQUAL? any1,any2[,any3][,any4] |||| PRED | Is any1 equal to any2, any3, or any4? | | 193 | EQUAL? any1,any2[,any3][,any4] |||| PRED | Is any1 equal to any2, any3, or any4? |
-| 194 | | | | +| 194 | LESS? int1,int2 |||| PRED Is int1 less than int2? 
-| 195 | | | | +| 195 | GRTR? int1,int2 |||| PRED Is int1 greater than int2? 
-| 196 | | | | +| 196 | IGRTR? var,int |||| PRED Increments the value of var by one and succeeds if the new value is greater than int. 
-| 197 | | | | +| 197 | DLESS? var,int |||| PRED Decrements the value of var by one and succeeds if the new value is less than int. 
-| 198 | | | | +| 198 | IN? obj1,obj2 |||| PRED Is obj1 contained in obj2? 
-| 199 | | | | +| 199 | BTST word1,word2 |||| PRED Is every bit that is on in word2 also on in word1? 
-| 200 | | | | +| 200 | BOR word1,word2 |||| VAL Bitwise logical or. 
-| 201 | | | | +| 201 | BAND word1,word2 |||| VAL Bitwise logical and. 
-| 202 | | | | +| 202 | FSET? obj,flag |||| PRED Is this flag number set in obj? 
-| 203 | | | | +| 203 | FSET obj,flag |||| | Set flag in obj. 
-| 204 | | | | +| 204 | FCLEAR obj,flag |||| | Clear flag in obj. 
-| 205 | | | | +| 205 | SET var,any |||| | Sets the specified variable to any. 
-| 206 | | | | +| 206 | MOVE obj1,obj2 |||| | Put obj1 into obj2. 
-| 207 | | | | +| 207 | GET table,item |||| VAL Interpreting the table pointed to as a vector of words, returns the item'th element. In other words, returns the word pointed to by item times two plus table. (Tables begin with element zero.) 
-| 208 | | | | +| 208 | GETB table,item |||| VAL Similar to GET, but assumes a byte table. Returns the byte (converted to a word, of course) pointed to by item plus table. 
-| 209 | | | | +| 209 | GETP obj,prop |||| VAL Returns specified property of obj. If obj has no property prop, returns prop'th element of default property table. 
-| 210 | | | | +| 210 | GETPT obj,prop |||| VAL Gets property table prop from obj. Where GETP can only be used with single byte or single word properties, GETPT can be used with properties of any length. It returns a pointer to the property value that may then be used as a table pointer in any other table operation. 
-| 211 | | | | +| 211 | NEXTP obj,prop |||| VAL Returns the number of the property following prop in obj. Error if no property prop exists in obj. Returns zero if prop is last property. Given proper equal to zero, returns first property (i.e. is circular). 
-| 212 | | | | +| 212 | ADD int1,int2 |||| VAL Adds the integers. 
-| 213 | | | | +| 213 | SUB int1,int2 |||| VAL Subtracts int2 from int1. 
-| 214 | | | | +| 214 | MUL int1,int2 |||| VAL Multiplies the integers. 
-| 215 | | | | +| 215 | DIV int1,int2 |||| VAL Divides int1 by int2, returning the truncated quotient. 
-| 216 | | | |+| 216 | MOD int1,int2 |||| VAL Divides int1 by int2, returning the remainder. |
 | 217 | - | - | - | - | | | | 217 | - | - | - | - | | |
 | 218 | - | - | - | - | | | | 218 | - | - | - | - | | |
Line 233: Line 246:
 | 226 | PUTB table,item,any |||| | PUTB is to GETB as PUT is to GET. Uses only the lower order byte of any. Error if the high-order byte is non-zero. | | 226 | PUTB table,item,any |||| | PUTB is to GETB as PUT is to GET. Uses only the lower order byte of any. Error if the high-order byte is non-zero. |
 | 227 | PUTP obj,prop,any |||| | Changes value of obj's property prop to any. Error if obj does not have that property. | | 227 | PUTP obj,prop,any |||| | Changes value of obj's property prop to any. Error if obj does not have that property. |
-| 228 | READ table1,table2 | READ table1,table2{,int}{,fcn} ||| | Reads and parses a line of input. Rable1 is the buffer used to store the characters read. The first byte (read-only) contains the length of the rest of the buffer where the input string is stored. Table2 stores the results of the parse. The first byte (read-only) of this table specifies the maximum number of words (of text, not machine words) that may be stored here. |+| 228 | READ table1,table2 | READ table1,table2{,int}{,fcn} | READ inbuf:tbl,lexv:tbl,time:int,handler:fcn || | Reads and parses a line of input. Rable1 is the buffer used to store the characters read. The first byte (read-only) contains the length of the rest of the buffer where the input string is stored. Table2 stores the results of the parse. The first byte (read-only) of this table specifies the maximum number of words (of text, not machine words) that may be stored here. READ is significantly different between EZIP and XZIP. |
 | 229 | PRINTC int |||| | Prints the character whose ASCII value is int. | | 229 | PRINTC int |||| | Prints the character whose ASCII value is int. |
 | 230 | PRINTN int |||| | Print int as a signed number. | | 230 | PRINTN int |||| | Print int as a signed number. |
Line 245: Line 258:
 | 238 | - | ERASE int ||| | If option bit 4 in the mode byte is zero, this operation is ignored. Otherwise it erases the line on which the cursor lies, according to int. If int is 1, it erases from the curser to the end of the line. There are no other legal values for int at the present time. | | 238 | - | ERASE int ||| | If option bit 4 in the mode byte is zero, this operation is ignored. Otherwise it erases the line on which the cursor lies, according to int. If int is 1, it erases from the curser to the end of the line. There are no other legal values for int at the present time. |
 | 239 | - | CURSET int1,int2 ||| | If option bit 4 in the mode byte is zero, this operation is ignored. Otherwise, moves the cursor to line #int1, column #int2 in screen 1. This is also illegal if output is buffered (i.e. the BUFOUT instruction has not been used with a zero argument). | | 239 | - | CURSET int1,int2 ||| | If option bit 4 in the mode byte is zero, this operation is ignored. Otherwise, moves the cursor to line #int1, column #int2 in screen 1. This is also illegal if output is buffered (i.e. the BUFOUT instruction has not been used with a zero argument). |
-| 240 | - | CURGET ||| | This is not currently implemented although the operation is reserved. |+| 240 | - | CURGET | CURGET output:tbl || | In EZIP, this is not currently implementedalthough the operation is reserved. In XZIP, returns information about the current cursor position. It is passed an output table which must have the first two words free to write in. CURGET writes the y position in the word 0 of the table, and the x position in word 1 of the table. The positions are as for CURSET. |
 | 241 | - | HLIGHT int ||| | If the appropriate option bit in the mode byte is zero, this operation is ignored. Otherwise, it is interpreted as follows: 0 - no highlight, 1 - inverse video, 2 - bold, 4 - underline or italic at the interpreter's discretion. Not that codes are setup as powers-of-two. This is intentional but it is NOT required at this time that the interpreter handle combination highlights (bold + italic). | | 241 | - | HLIGHT int ||| | If the appropriate option bit in the mode byte is zero, this operation is ignored. Otherwise, it is interpreted as follows: 0 - no highlight, 1 - inverse video, 2 - bold, 4 - underline or italic at the interpreter's discretion. Not that codes are setup as powers-of-two. This is intentional but it is NOT required at this time that the interpreter handle combination highlights (bold + italic). |
 | 242 | - | BUFOUT int ||| | Determines whether or not output is line-buffered. If int is 1 (the normal case), output is buffered a line at a time so the line breaks can be planned for. If int is 0, all currently buffered output is sent to the screen, and all future output is sent to the screen as it is generated. Note: Output redirected to a TABLE (see next instruction) is not buffered. Disabling buffered output MUST be perfect prior to using the CURSET opcode. Also note: the "line position" counter should NOT be cleared when a BUFOUT of 0 is performed. In this way, when buffered output is re-enabled, line position is not lost. | | 242 | - | BUFOUT int ||| | Determines whether or not output is line-buffered. If int is 1 (the normal case), output is buffered a line at a time so the line breaks can be planned for. If int is 0, all currently buffered output is sent to the screen, and all future output is sent to the screen as it is generated. Note: Output redirected to a TABLE (see next instruction) is not buffered. Disabling buffered output MUST be perfect prior to using the CURSET opcode. Also note: the "line position" counter should NOT be cleared when a BUFOUT of 0 is performed. In this way, when buffered output is re-enabled, line position is not lost. |
 | 243 | - | DIROUT int{,any1}{,any2}{,any3} ||| | Selects or deselects virtual device according to int. 1=screen (default), 2=printer, 3=table any1, 4=commandfile | | 243 | - | DIROUT int{,any1}{,any2}{,any3} ||| | Selects or deselects virtual device according to int. 1=screen (default), 2=printer, 3=table any1, 4=commandfile |
 | 244 | - | DIRIN int{,any1}{,any2}{,any3} ||| | Redirects input according to int. 1=keyboard (default), 1=command file. No other values of int are legal. | | 244 | - | DIRIN int{,any1}{,any2}{,any3} ||| | Redirects input according to int. 1=keyboard (default), 1=command file. No other values of int are legal. |
-| 245 | - | SOUND int ||| | If the appropriate bit in the mode byte is 0, this operation is ignored. Otherwise produce the sound specified by int. 1=beep (Morse code dot) 2=boop (Morse code dash). Others may be invented as required. |+| 245 | - | SOUND int | SOUND id:int,op:int || | If the appropriate bit in the mode byte is 0, this operation is ignored. Otherwise produce the sound specified by int. 1=beep (Morse code dot) 2=boop (Morse code dash). Others may be invented as required. In XZIP, a new sound specification exists. SOUND takes the same sound-identifier argument as before, but adds a sound-operation argument as well. Currently, there are only three operations defined |
 | 246 | - | INPUT int1{,int2}{,fcn} ||| | This returns a single input from the device specified by int1. The only defined device is the keyboard (code=1) and the instruction returns the ASCII code for the next key pressed. Keys which do not have a single ASCII value are ignrored, with the following exceptions (assuming these keys exist on the target machine): Up-arrow=14, Down-arrow=13, Left-arrow=11, Right-arrow=7. More special codes may be added, but probably not. | | 246 | - | INPUT int1{,int2}{,fcn} ||| | This returns a single input from the device specified by int1. The only defined device is the keyboard (code=1) and the instruction returns the ASCII code for the next key pressed. Keys which do not have a single ASCII value are ignrored, with the following exceptions (assuming these keys exist on the target machine): Up-arrow=14, Down-arrow=13, Left-arrow=11, Right-arrow=7. More special codes may be added, but probably not. |
-| 247 | - | INTBL? any,table,int ||| VAL/PRED | Tests whether "any" is an element of the "table" which contains "int" word-oriented elements. If so, it returns a pointer to that location within "table" in which "any" first appears (i.e. a GET of INTBL?'s returned value and zero would return "any"). If not, it returns zero. NOTE: This is also a predicate instruction. | +| 247 | - | INTBL? any,table,int | INTBL? item,tbl,leng,recspec || VAL/PRED | Tests whether "any" is an element of the "table" which contains "int" word-oriented elements. If so, it returns a pointer to that location within "table" in which "any" first appears (i.e. a GET of INTBL?'s returned value and zero would return "any"). If not, it returns zero. NOTE: This is also a predicate instruction. In XZIP, INTBL? is given an optional fourth argument, the recspec, or record specification. This is a byte whose high bit determines whether INTBL? is comparing words (high bit 1) or bytes (high bit 0), and whose low seven bits are the record length in bytes. If not supplied or zero, defaults to 130. (202 octal, 82 hex) which is equivalent to the current usage of INTBL?. Len must not be less than zero. Note that the len argument is now interpreted as the number of records to search, rather than the number of words. This expansion of INTBL? makes it possible to search tables of alternating keys and values, a case which is relatively common. | 
-| 248 | - | - | | | | +| 248 | - | - | BCOM word || VAL Bitwise logical complement. Note that in XZIP COM is a different opcode. 
-| 249 | - | - | | | | +| 249 | - | - | ICALL routine:fcn,arg1:any,arg2:any,arg3:an || | In XZIP, there are versions of the CALL instructions which do not return a value. ICALL, ICALL1, ICALL2, and IXCALL are defined exactly as their counterparts CALL, etc., except that they do not return anything. 
-| 250 | - | - | | | | +| 250 | - | - | IXCALL routine:fcn,arg1,... || | In XZIP, there are versions of the CALL instructions which do not return a value. ICALL, ICALL1, ICALL2, and IXCALL are defined exactly as their counterparts CALL, etc., except that they do not return anything. 
-| 251 | - | - | | | | +| 251 | - | - | LEX inbuf:tbl,lexv:tbl,lexicon:tbl,preserve:bool || | Tokenizes and looks up an input buffer's contents. 
-| 252 | - | - | | | | +| 252 | - | - | ZWSTR inbuf:tbl,inlen:int,inbeg:int,zword:tbl || | Takes an input buffer pointer, the length of the word being converted, the character offset in the buffer of the start of the word, and a pointer to a table with at least six bytes that can be clobbered. It would also be possible to pass a RESTed inbuf and no inbeg, but this form of ZWSTR duplicates the format of a lexical buffer and is therefore preferable. ZWSTR expects the word to be terminated by one of the usual break characters, so the inlen argument is not actually needed. It is included for possible future uses. A zero byte is an acceptable break character. The ZWSTR instruction converts the ”word” contained in yhe buffer into a ZWORD and places the conversion in the first three words of the table.  
-| 253 | - | - | | | | +| 253 | - | - | COPYT source:table,dest:table,length:int || | Copies elements of source into dest until length bytes have been copied.  
-| 254 | - | - | | | | +| 254 | - | - | PRINTT bytes:tbl,width:int,height:int,skip:int || | PRINTT takes a table of bytes, a width (a number of columns) and optionally a height (a number of lines), which is assumed to be one if omitted. It also optionally takes a skip, which is how many bytes of a table to skip over at the end of each line (by default, none). It prints, in a block at the current cursor position, bytes from the table. Each group of width bytes is printed on a separate line aligned with the first, until height lines have been printed. Each time width bytes have been printed, skip bytes are skipped over. The skip parameter allows a rectangular block of text from anywhere within a rectangular table (one where the rows are stored) to be printed. PRINTT with a height greater than one may only be used in screen 1. 
-| 255 | - | - | | | |+| 255 | - | - | ASSIGNED? opt:var || PRED ASSIGNED? is true if an optional argument was supplied. ASSIGNED? must work even if there has been a call out of a function. Therefore, the number of arguments (not locals!) passed to a function must be stored as part of the frame, and restored when the called function returns to the caller. |
  
 Return to [[:Infocom:]] Return to [[:Infocom:]]
 +