Table of Opcodes

2OPs ZIP EZIP/LZIP XZIP YZIP Returns Summary
000 - - - -
001 EQUAL? any1,any2 PRED Is any1 equal to any2?
002 LESS? int1,int2 PRED Is int1 less 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.
005 DLESS? var,int PRED Decrements the value of var by one and succeeds if the new value is less than int.
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?
008 BOR word1,word2 VAL Bitwise logical or.
009 BAND word1,word2 VAL Bitwise logical and.
010 FSET? obj,flag PRED Is this flag number set in obj?
011 FSET obj,flag Set flag in obj.
012 FCLEAR obj,flag Clear flag in obj.
013 SET var,any Sets the specified variable to any.
014 MOVE obj1,obj2 Put obj1 into obj2.
015 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.)
016 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.
017 GETP obj,prop VAL Returns specified property of obj. If obj has no property prop, returns prop'th element of default property table.
018 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.
019 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).
020 ADD int1,int2 VAL Adds the integers.
021 SUB int1,int2 VAL Subtracts int2 from int1.
022 MUL int1,int2 VAL Multiplies the integers.
023 DIV int1,int2 VAL Divides int1 by int2, returning the truncated quotient.
024 MOD int1,int2 VAL Divides int1 by int2, returning the remainder.
025 - CALL2 fcn,any VAL Same as CALL, but a 2-op.
026 - - ICALL2 routine:fcn,arg1:any Same as CALL2, but ICALL2 does not have a return value.
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 - - THROW any,frame THROW returns any from a frame. It is as though the routine in which the CATCH was done returned any.
029 - - - -
030 - - - -
031 - - - -
032 - - - -
033 - - - -
034 - - - -
035 - - - -
036 - - - -
037 - - - -
038 - - - -
039 - - - -
040 - - - -
041 - - - -
042 - - - -
043 - - - -
044 - - - -
045 - - - -
046 - - - -
047 - - - -
048 - - - -
049 - - - -
050 - - - -
051 - - - -
052 - - - -
053 - - - -
054 - - - -
055 - - - -
056 - - - -
057 - - - -
058 - - - -
059 - - - -
060 - - - -
061 - - - -
062 - - - -
063 - - - -
064 - - - -
065 - - - -
066 - - - -
067 - - - -
068 - - - -
069 - - - -
070 - - - -
071 - - - -
072 - - - -
073 - - - -
074 - - - -
075 - - - -
076 - - - -
077 - - - -
078 - - - -
079 - - - -
080 - - - -
081 - - - -
082 - - - -
083 - - - -
084 - - - -
085 - - - -
086 - - - -
087 - - - -
088 - - - -
089 - - - -
090 - - - -
091 - - - -
092 - - - -
093 - - - -
094 - - - -
095 - - - -
096 - - - -
097 - - - -
098 - - - -
099 - - - -
100 - - - -
101 - - - -
102 - - - -
103 - - - -
104 - - - -
105 - - - -
106 - - - -
107 - - - -
108 - - - -
109 - - - -
110 - - - -
111 - - - -
112 - - - -
113 - - - -
114 - - - -
115 - - - -
116 - - - -
117 - - - -
118 - - - -
119 - - - -
120 - - - -
121 - - - -
122 - - - -
123 - - - -
124 - - - -
125 - - - -
126 - - - -
127 - - - -
1OPs ZIP EZIP/LZIP XZIP YZIP Returns Summary
128 ZERO? any PRED Is any equal to zero?
129 NEXT? obj VAL/PRED Returns “next” slot of obj. Fails if none (equals zero) and returns zero.
130 FIRST? obj VAL/PRED Returns “first” slot of obj. Fails if non (equals zero) and returns zero.
131 LOC obj VAL Return container of obj, zero if none.
132 PTSIZE table VAL Given a property table pointer as may be obtained from GETPT, returns the length of this “table” in bytes. Guaranteed to return a meaningless value if given any other kind of table. (Assumes that the byte preceding the table is a property identifier.)
133 INC var Increments the value of var by one.
134 DEC var Decrements the value of var by one.
135 PRINTB str Like PRINT, but str here is an ordinary byte pointer.
136 - CALL1 fcn VAL Same as CALL, but a 1-op.
137 REMOVE obj MOVEs obj to pseudo-object zero.
138 PRINTD obj Prints the short description of obj.
139 RETURN any Causes the most recently executed CALL to return any and continues execution at the next sequential instruction after that call.
140 JUMP loc An unconditional branch to the location of the next sequential instruction plus loc minus two (for compatibility with predicates). Not that unlike the predicate argument, this is a full twos-complement word.
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.
143 BCOM word ICALL1 routine:fcn VAL ZIP/EZIP: Bitwise logical complement. XZIP: ICALL1 a CALL1 without a return value.
144 - - - -
145 - - - -
146 - - - -
147 - - - -
148 - - - -
149 - - - -
150 - - - -
151 - - - -
152 - - - -
153 - - - -
154 - - - -
155 - - - -
156 - - - -
157 - - - -
158 - - - -
159 - - - -
160 - - - -
161 - - - -
162 - - - -
163 - - - -
164 - - - -
165 - - - -
166 - - - -
167 - - - -
168 - - - -
169 - - - -
170 - - - -
171 - - - -
172 - - - -
173 - - - -
174 - - - -
175 - - - -
0OPs ZIP EZIP/LZIP XZIP YZIP Returns Summary
176 RTRUE Does a “RETURN 1,” where 1 is commonly interpreted by Z programs as “true.”
177 RFALSE Does a “RETURN 0,” where 0 is commonly interpreted by Z programs as “false.”
178 PRINTI (str) Prints an immediate string. Interpreted as a 0-operation instruction but immediately followed by a standard string (as opposed to a string-pointer).
179 PRINTR (str) Like PRINTI byut executes a CRLF followed by an RTRUE after printing the string.
180 NOOP No operation, equivalent to a “JUMP 2.”
181 SAVE PRED Writes the “impure” part of the game to disk in some recoverable format. The seed for RANDOM should not be saved or restored so that multiple RESTOREs from the same SAVEd game will not necessarily lead to the same results. Other details of the user interface are left to the discretion of the implementor. Not that this instruction is a predicate.
182 RESTORE PRED Recovers a previously SAVEd game and continues execution aft erthe SAVE. If the RESTORE fails, execution should continue (if possible) after the RESTORE in the original game with the instruction failing.
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.
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.
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.
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 - - 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 - - - -
XOPs ZIP EZIP/LZIP XZIP YZIP Returns Summary
192 - - - -
193 EQUAL? any1,any2[,any3][,any4] PRED Is any1 equal to any2, any3, or any4?
194 LESS? int1,int2 PRED Is int1 less than int2?
195 GRTR? int1,int2 PRED Is int1 greater than int2?
196 IGRTR? var,int PRED Increments the value of var by one and succeeds if the new value is greater than int.
197 DLESS? var,int PRED Decrements the value of var by one and succeeds if the new value is less than int.
198 IN? obj1,obj2 PRED Is obj1 contained in obj2?
199 BTST word1,word2 PRED Is every bit that is on in word2 also on in word1?
200 BOR word1,word2 VAL Bitwise logical or.
201 BAND word1,word2 VAL Bitwise logical and.
202 FSET? obj,flag PRED Is this flag number set in obj?
203 FSET obj,flag Set flag in obj.
204 FCLEAR obj,flag Clear flag in obj.
205 SET var,any Sets the specified variable to any.
206 MOVE obj1,obj2 Put obj1 into obj2.
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 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 GETP obj,prop VAL Returns specified property of obj. If obj has no property prop, returns prop'th element of default property table.
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 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 ADD int1,int2 VAL Adds the integers.
213 SUB int1,int2 VAL Subtracts int2 from int1.
214 MUL int1,int2 VAL Multiplies the integers.
215 DIV int1,int2 VAL Divides int1 by int2, returning the truncated quotient.
216 MOD int1,int2 VAL Divides int1 by int2, returning the remainder.
217 - - - -
218 - - - -
219 - - - -
220 - - - -
221 - - - -
222 - - - -
223 - - - -
224 - CALL fcn{,any1}{,any2}{,any3} Begins execution of the function pointed to by fcn times 4, supplying it with any arguments given in the CALL instruction. Note that fcn is a quad-pointer and functions are always quad-aligned. See RETURN for the method of returning from this instruction. If fcn equals zero, the CALL is special. In this case, it ignores its other arguments (except for the value specifier) and acts as if it had called a function that did an immediate RFALSE.
225 PUT table,item,any Inverse of GET. Sets the word pointed to to any.
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.
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.
230 PRINTN int Print int as a signed number.
231 RANDOM int VAL Returns a random value between 1 and int, inclusive.
232 PUSH any Pushes any onto the stack.
233 POP var Pops the top word off the stack and puts it into var. Note that “POP 'STACK” will have the effect of flushing the next to the top word of the stack.
234 SPLIT int If option bit 5 in the mode byte is zero, this operation is ignored otherwise it divides the screen into two windows: #1 occupies int lines, preferably at the top of the screen, and #0 occupies the remainder of the screen. If int is zero, this operation restores the normal screen format. Window #1 is special in that it never scrolls if the program outputs characters beyond the right-hand margin, they are not displayed.
235 SCREEN int If option bit 5 in the mode byte is zero, this operation is ignored otherwise it causes subsequent screen output to fall into window #int. If int is 1, the output cursor is moved to the upper left-hand corner. If int is 0, the output cursor is restored to its previous position. This operation is ignored if the screen is not split, or if int is not zero or one.
236 - XCALL fcn,any1-4{,any5}{,any6}{,any7} VAL Same as CALL, but with from 4-7 arguments supplied. This instruction is never invoked with fewer than 4 arguments.
237 - CLEAR int If option bit 0 in the mode byte is zero, this operation is ignored. If int is 1 or 0, it clears window #int. If int is -1, it unsplits the screen (if it has been split) and clears the entire screen. Other values for int are ignored.
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).
240 - CURGET CURGET output:tbl In EZIP, this is not currently implemented, although 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).
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
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 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.
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 - - BCOM word VAL Bitwise logical complement. Note that in XZIP COM is a different opcode.
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 - - 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 - - LEX inbuf:tbl,lexv:tbl,lexicon:tbl,preserve:bool Tokenizes and looks up an input buffer's contents.
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 - - COPYT source:table,dest:table,length:int Copies elements of source into dest until length bytes have been copied.
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 - - 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

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies