This is an old revision of the document!


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 - - - -
027 - - - -
028 - - - -
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 VAL Bitwise logical complement.
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 Flushes the top off the stack.
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 - - - -
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 - - - -
195 - - - -
196 - - - -
197 - - - -
198 - - - -
199 - - - -
200 - - - -
201 - - - -
202 - - - -
203 - - - -
204 - - - -
205 - - - -
206 - - - -
207 - - - -
208 - - - -
209 - - - -
210 - - - -
211 - - - -
212 - - - -
213 - - - -
214 - - - -
215 - - - -
216 - - - -
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} 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.
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 This is not currently implemented although the operation is reserved.
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 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.
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.
248 - - - -
249 - - - -
250 - - - -
251 - - - -
252 - - - -
253 - - - -
254 - - - -
255 - - - -

Return to Infocom