![]() |
V6 opcode list
V6 opcode list The following conventions are used in the encoding descriptions:
The following conventions are used in the stack descriptions:
abs$C4Stack(in : out)Operationout := abs(in)The absolute value of the top-most item on the stack is calculated. (The absolute value being the value with the sign bit stripped off.) actorFollowCamera$79actorSet$9Dadd$14Stack(in1, in2 : out)Operationout := in1 + in2Performs a division operation on the stack. animateActor$82arrayOpsThis instruction varies considerably according to the form.Encoding
Stack
6.4.7 MM 95 beginOverrideMM 6C breakHereMM CA breakMaybeMM 5A byteArrayDecMM 52 byteArrayIncbyteArrayIndexedReadEncoding0A arrayp8Stack( indexx , indexy : value )Operationvalue := arrayp [ indexx , indexy ]Reads the value at offset ( indexx , indexy ) from the array whose resource number is pointed to by arrayp . The array can be a byte or word array; byte values are not sign extended. Note that because arrayp is encoded as a byte, it can only point to a word variable in the range 0000 to 00FF. Use wordArrayIndexedRead for a more general form. byteArrayIndexedWriteEncoding4A arrayp8Stack( indexx , indexy , value : -)Operationarrayp [ indexx , indexy ] := valueWrites value to the array whose resource number is pointed to by arrayp at offset ( indexx , indexy ). The array can be a byte or word array; byte when writing to a byte array, value is truncated. Note that because arrayp is encoded as a byte, it can only point to a word variable in the range 0000 to 00FF. Use wordArrayIndexedWrite for a more general form. byteArrayReadEncoding06 arrayp8Stack( index : value )Operationvalue := arrayp [0, index ]Reads the value at position (0, index ) from the array whose resource number is pointed to by arrayp . The array can be a byte or word array; when writing to an array, byte values are not sign extended. Note that because arrayp is encoded as a byte, it can only point to a word variable in the range 0000 to 00FF. Use wordArrayRead for a more general form. byteArrayWriteEncoding46 arrayp8Stack( index value : -)Operationarrayp [0, index ] := valueWrites value to the array whose resource number is pointed to by arrayp at offset (0, index ). The array can be a byte or word array; when writing to a byte array, value is truncated. Note that because arrayp is encoded as a byte, it can only point to a word variable in the range 0000 to 00FF. Use wordArrayWrite for a more general form. MM 56 byteVarDecMM 4E byteVarIncMM 9A createBoxMatrixMM 6B cursorCommandMM 68 cutScenedelayEncodingB0Stack( delay : -)OperationPrevents the current thread from being rescheduled until delay ticks have passed. Deschedules immediately.delayLongerEncodingB1Stack( delay : -)OperationPrevents the current thread from being rescheduled until delay� 60 ticks have passed ( delay seconds). Deschedules immediately.delayVeryLongEncodingB2Stack( delay : -)OperationPrevents the current thread from being rescheduled until delay� 3600 ticks have passed ( delay minutes). Deschedules immediately.dimEncodingBC type8 arrayp16Stack( max : -)OperationAllocates or frees an array.If type is CC, then the array whose resource number is pointed to by arrayp is freed. Otherwise, a new one-dimensional array with a maximum index of max (i.e., max is one less than the size) is allocated and the resource number written to arrayp . When allocating an array, if type is C7 then the array will contain words; if it is CB, then it will contain bytes. All other values are undefined. [Currently they all produce a byte array. What are they?] dim2EncodingC0 type8 arrayp16Stack( maxx , maxy : -)OperationAllocates an array.A new two-dimensional array is allocated and the resource number is written to arrayp . The new array will have a maximum X index of maxx and a maximum Y index of maxy (i.e., maxy is one less than the size). When allocating an array, if type is C7 then the array will contain words; if it is CB, then it will contain bytes. All other values are undefined. [Currently they all produce a byte array. What are they?] MM C5 distObjectObjectMM C6 distObjectPtMM C7 distPtPtdivEncoding17Stack( in1 , in2 : out )Operationout := in1 / in2Performs a division operation on the stack. Note the order. An attempt to divide by zero will cause undefined behaviour, and may cause the interpreter to crash. MM 83 doSentencedrawBoxEncodingA6Stack( left , top , right , bottom , colour : -)OperationDraws a solid box on the backbuffer from ( left , top ) to ( right , bottom ) in the colour colour .dupEncoding0CStack( value : value , value )OperationDuplicates the top-most item on the stack.MM 67 endCutSceneMM 96 endOverrideeqEncoding0EStack( value1 , value2 : bool )OperationIf value1=value2 , set bool to 1, otherwise set it to 0Tests the top two values on the stack to see if they are equal. MM 81 faceActorMM 92 findInventoryMM A0 findObjectfreezeUnfreezeEncoding6AStack( bool : -)Operation
geEncoding13Stack( value1 value2 : bool)OperationIf value1� value2 , set bool to 1, otherwise set it to 0Compares the top two values on the stack. Note the order. MM AB getActorAnimCounter1MM 91 getActorCostumeMM A2 getActorElevationMM 9F getActorFromXYMM 8A getActorMovingMM 8C getActorRoomMM AA getActorScaleXMM 90 getActorWalkBoxMM A8 getActorWidthMM 93 getInventoryCountMM 8F getObjectDirMM 8D getObjectXMM 8E getObjectYMM 72 getOwnergetRandomNumberEncoding87Stack( max : result )OperationA random number in the range 0 to max inclusive is calculated, and the result pushed onto the stack. The result is also written to the RandomNumber word variable (see 6.5).getRandomNumberRangeEncoding88Stack( min , max , : result )OperationA random number in the range min to max inclusive is calculated, and the result pushed onto the stack. The result is also written to the RandomNumber word variable (see 6.5).MM 8B getScriptRunningMM 6F getStateMM A3 getVerbEntryPointMM 94 getVerbFromXYgtEncoding10Stack( value1 , value2 : bool )OperationIf value1 > value2 , set bool to 1, otherwise set it to 0Compares the top two values on the stack. Note the order. MM 6D ifClassOfIsMM AF isActorInBoxisAnyOfEncodingADStack( arg1 , arg2 , arg3 , ..., argn , n , value : bool )OperationIf value is any of arg1 .. argn , bool := 1, otherwise bool := 0Tests to see if value is equal to any of the passed in arguments. If n is less than the number of entries on the stack, undefined behaviour will result. MM 98 isSoundRunningMM 73 jumpEncoding73 offset16Stack(- : -)Operationpc := pc + offsetoffset is added to the current program counter after the instruction has been decoded. jumpFalseEncoding5D offset16Stack( bool : -)Operationif bool = 0, pc := pc + offsetPops the top value off the stack. If zero, then offset is added to the current program counter after the instruction has been decoded. jumpTrueEncoding5C offset16Stack( bool : -)Operationif bool � 0, pc := pc + offsetPops the top value off the stack. If non-zero, then offset is added to the current program counter after the instruction has been decoded. killEncoding1AStack( value : -)OperationPops the top value off the stack and discards it.landEncoding18Stack( in1 in2 : out)Operationout:=in1 && in2Performs a logical and operation on the stack (not a bitwise and). Note the order. The boolean values are as in C, with 0 for false and non-zero for true. leEncoding12Stack( value1 value2 : bool)OperationIf value1� value2 , set bool to 1, otherwise set it to 0Compares the top two values on the stack. Note the order. MM 7B loadRoomMM 85 loadRoomWithEgolorEncoding19Stack( in1 in2 : out)Operationout:=in1 || in2Performs a logical or operation on the stack (not a bitwise or). Note the order. The boolean values are as in C, with 0 for false and non-zero for true. ltEncoding11Stack( value1 value2 : bool)OperationIf value1<value2 , set bool to 1, otherwise set it to 0Compares the top two values on the stack. Note the order. MM C9 miscOpsmulEncoding16Stack( in1 in2 : out)Operationout:=in1� in2Performs a multiplication operation on the stack. Note the order. neqEncoding0FStack( value1 , value2 : bool )OperationIf value1 � value2 , set bool to 1, otherwise set it to 0Tests the top two values on the stack to see if they are not equal. MM 78 panCameraTopickOneOfEncodingCBStack( index , arg0 , arg1 , arg2 , ..., argn , n : value )Operationvalue := arg[index]Returns the index th argument on the stack. If n is less than the number of entries on the stack or index is out of range, undefined behaviour will result, usually involving the interpreter shutting down. pickOneOfDefaultEncodingCCStack( index , arg0 , arg1 , arg2 , ..., argn , n , default : value )OperationIf index is in the range 0.. n , value := arg[index] ; otherwise value := default .Returns the index th argument on the stack. If index is out of range, default is returned instead. If n is less than the number of entries on the stack, undefined behaviour will result, usually involving the interpreter shutting down. MM 84 pickupObjectMM B8 printActorMM B9 printEgoMM B4 print0MM B5 print1MM B6 print2MM B7 print3MM A1 pseudoRoompushByteEncoding00 value8Stack(- : value )OperationPushes value onto the stack. It is not sign extended.pushByteVarEncoding02 pointer8Stack(- : value )OperationDereferences pointer and pushes the result onto the stack. Note that because pointer is encoded as a byte, it can only point to a word variable in the range 0000-00FF. Use pushWordVar for a more general version of this instruction.pushWordEncoding01 value16Stack(- : value )OperationPushes value onto the stack.pushWordVarEncoding03 pointer16Stack(- : value )OperationDereferences pointer and pushes the result onto the stack.MM 80 putActorAtObjectMM 7F putActorInRoomquitPauseRestartThis instruction varies according to the form.Encoding
Stack(- : -) (both forms)OperationPauses and quits the game. [Details, details!]MM 9B resourceRoutinesMM 9C roomOpsMM BF runScriptQuickMM BE runVerbCodeQuickMM A5 saveRestoreVerbsMM 99 setBoxFlagsMM 7A setCameraAtMM 6E setClassMM 97 setObjectNameMM 61 setObjectStateMM 62 setObjectXYMM 71 setOwnerMM 70 setStateMM AC soundKludgeMM 76 startMusicMM 60 startObjectstartScriptEncoding5FStack( script , arg0 , arg1 , arg2 , ..., argn , n : -)OperationA new thread is started, running the code in the script whose resource number is script . arg0 .. argn form the thread's initial local variables; unspecified variables are not initialised to any specific value.The new thread starts executing immediately and the current thread is put into the PENDING state until the new thread is descheduled. MM 5E startScriptExMM 74 startSoundMM 69 stopMusicMM 65 stopObjectCodeMM 66 stopObjectCodeMM 77 stopObjectScriptMM 7C stopScriptMM B3 stopSentenceMM 75 stopSoundsubEncoding15Stack( in1 in2: out)Operationout:=in1-in2The top two items on the stack are popped off, the first subtracted from the second, and the result pushed back on the stack. Note the order. MM BA talkActorMM BB talkEgoMM 9E verbOpsMM A9 waitMM 7E walkActorToMM 7D walkActorToObjwordArrayDecEncoding5B arrayp16Stack( index : -)Operationarrayp [0, index ] := arrayp [0, index ] - 1Increments the value at offset (0, index ) in the array whose resource number is pointed to by arrayp . wordArrayIncEncoding53 arrayp16Stack( index : -)Operationarrayp [0, index ] := arrayp [0, index ] + 1Increments the value at offset (0, index ) in the array whose resource number is pointed to by arrayp . wordArrayIndexedReadEncoding0B arrayp16Stack( indexx , indexy : value )Operationvalue := arrayp [ indexx , indexy ]Reads the value at offset ( indexx , indexy ) from the array whose resource number is pointed to by arrayp . The array can be a byte or word array; byte values are not sign extended. wordArrayIndexedWriteEncoding4B arrayp16Stack( indexx , indexy , value : -)Operationarrayp [ indexx , indexy ] := valueWrites value to the array whose resource number is pointed to by arrayp at offset ( indexx , indexy ). The array can be a byte or word array; when writing to a byte array, value is truncated. wordArrayReadEncoding07 arrayp16Stack( index : value )Operationvalue := arrayp [0, index ]Reads the value at offset (0, index ) from the array whose resource number is pointed to by arrayp . The array can be a byte or word array; byte values are not sign extended. wordArrayWriteEncoding47 arrayp8Stack( index value : -)Operationarrayp [0, index ] := valueWrites value to the array whose resource number is pointed to by arrayp at offset (0, index ). The array can be a byte or word array; when writing to a byte array, value is truncated. wordVarDecEncoding57 pointer16Stack(- : -)Operation* pointer := * pointer - 1Decrements the variable pointed to by pointer . wordVarIncEncoding4F pointer16Stack(- : -)Operation* pointer := * pointer + 1Increments the variable pointed to by pointer . writeByteVarEncoding42 pointer8Stack( value : -)Operation* pointer := valueWrites value to the variable pointed to by pointer . Note that as pointer is encoded as a byte, it can only point to word variables in the range 0x0000 to 0x00FF. For a more general form of this instruction, use writeWordVar. writeWordVarEncoding43 pointer16Stack( value : -)Operation* pointer := valueWrites value to the variable pointed to by pointer . zeroEncoding0DStack( value : bool )OperationIf value = 0, set bool to 1, otherwise set it to 0Tests the value on the stack to see if it compares to zero. All material © 2000-2002 David Given, unless where stated otherwise. |