2,051
edits
(→quitPauseRestart: added from website) |
m (behaviour -> behavior) |
||
(17 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
Currently all entries from the reference on the [http://www.scummvm.org/docs/specs/scrp-v6.php main ScummVM website] have been transferred - please proofread and fix formatting where applicable. | |||
=SCUMM V6 opcodes= | =SCUMM V6 opcodes= | ||
The following conventions are used in the encoding descriptions. | The following conventions are used in the encoding descriptions. | ||
Line 242: | Line 245: | ||
Performs a division operation on the stack. Note the order. | Performs a division operation on the stack. Note the order. | ||
An attempt to divide by zero will cause undefined | An attempt to divide by zero will cause undefined behavior, and may cause the interpreter to crash. | ||
==MM 83 doSentence== | ==MM 83 doSentence== | ||
Line 254: | Line 257: | ||
'''Stack''' | '''Stack''' | ||
''( left , top , right , bottom , | ''( left , top , right , bottom , color : -)'' | ||
'''Operation''' | '''Operation''' | ||
Draws a solid box on the backbuffer from ( left , top ) to ( right , bottom ) in the | Draws a solid box on the backbuffer from ( left , top ) to ( right , bottom ) in the color color . | ||
==dup== | ==dup== | ||
Line 426: | Line 429: | ||
If value is any of arg1 .. argn , bool := 1, otherwise bool := 0 | If value is any of arg1 .. argn , bool := 1, otherwise bool := 0 | ||
Tests 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 | Tests 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 behavior will result. | ||
==MM 98 isSoundRunning== | ==MM 98 isSoundRunning== | ||
Line 604: | Line 607: | ||
value := arg[index] | value := 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 | 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 behavior will result, usually involving the interpreter shutting down. | ||
==pickOneOfDefault== | ==pickOneOfDefault== | ||
Line 619: | Line 622: | ||
If index is in the range 0.. n , value := arg[index] ; otherwise value := default . | If 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 | 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 behavior will result, usually involving the interpreter shutting down. | ||
==MM 84 pickupObject== | ==MM 84 pickupObject== | ||
Line 751: | Line 754: | ||
==startScript== | ==startScript== | ||
'''Encoding''' | |||
''5F'' | |||
'''Stack''' | |||
''( script , arg0 , arg1 , arg2 , ..., argn , n : -)'' | |||
'''Operation''' | |||
A 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 startScriptEx== | ==MM 5E startScriptEx== | ||
Line 771: | Line 788: | ||
==sub== | ==sub== | ||
'''Encoding''' | |||
''15'' | |||
'''Stack''' | |||
''( in1 in2: out)'' | |||
'''Operation''' | |||
''out:=in1-in2'' | |||
The 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 talkActor== | ==MM BA talkActor== | ||
Line 785: | Line 815: | ||
==wordArrayDec== | ==wordArrayDec== | ||
'''Encoding''' | |||
''5B arrayp^16'' | |||
'''Stack''' | |||
''( index : -)'' | |||
'''Operation''' | |||
''arrayp [0, index ] := arrayp [0, index ] - 1'' | |||
Increments the value at offset (0, ''index'') in the array whose resource number is pointed to by ''arrayp''. | |||
==wordArrayInc== | ==wordArrayInc== | ||
'''Encoding''' | |||
''53 arrayp^16'' | |||
'''Stack''' | |||
''( index : -)'' | |||
'''Operation''' | |||
''arrayp [0, index ] := arrayp [0, index ] + 1'' | |||
Increments the value at offset (0, index) in the array whose resource number is pointed to by ''arrayp''. | |||
==wordArrayIndexedRead== | ==wordArrayIndexedRead== | ||
'''Encoding''' | |||
''0B arrayp^16'' | |||
'''Stack''' | |||
''( indexx , indexy : value )'' | |||
'''Operation''' | |||
''value := 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. | |||
==wordArrayIndexedWrite== | ==wordArrayIndexedWrite== | ||
'''Encoding''' | |||
''4B arrayp^16'' | |||
'''Stack''' | |||
''( indexx , indexy , value : -)'' | |||
'''Operation''' | |||
''arrayp [ indexx , indexy ] := value'' | |||
Writes 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. | |||
==wordArrayRead== | ==wordArrayRead== | ||
'''Encoding''' | |||
''07 arrayp16'' | |||
'''Stack''' | |||
''( index : value )'' | |||
'''Operation''' | |||
''value := 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. | |||
==wordArrayWrite== | ==wordArrayWrite== | ||
'''Encoding''' | |||
''47 arrayp^8'' | |||
'''Stack''' | |||
''( index value : -)'' | |||
'''Operation''' | |||
''arrayp [0, index ] := value'' | |||
Writes 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. | |||
==wordVarDec== | ==wordVarDec== | ||
'''Encoding''' | |||
''57 pointer^16'' | |||
'''Stack''' | |||
(- : -) | |||
'''Operation''' | |||
''* pointer := * pointer - 1'' | |||
Decrements the variable pointed to by ''pointer''. | |||
==wordVarInc== | ==wordVarInc== | ||
'''Encoding''' | |||
''4F pointer^16'' | |||
'''Stack''' | |||
(- : -) | |||
'''Operation''' | |||
''* pointer := * pointer + 1'' | |||
Increments the variable pointed to by ''pointer''. | |||
==writeByteVar== | ==writeByteVar== | ||
'''Encoding''' | |||
''42 pointer^8'' | |||
'''Stack''' | |||
( ''value'' : -) | |||
'''Operation''' | |||
''* pointer := value'' | |||
Writes ''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. | |||
==writeWordVar== | ==writeWordVar== | ||
'''Encoding''' | |||
''43 pointer^16'' | |||
'''Stack''' | |||
''( value : -)'' | |||
'''Operation''' | |||
''* pointer := value'' | |||
Writes ''value'' to the variable pointed to by ''pointer''. | |||
==zero== | ==zero== | ||
'''Encoding''' | |||
''0D'' | |||
'''Stack''' | |||
( ''value'' : ''bool'' ) | |||
'''Operation''' | |||
If ''value'' = 0, set ''bool'' to 1, otherwise set it to 0 | |||
Tests the value on the stack to see if it compares to zero. | |||
''All material © 2000-2002 David Given, unless where stated otherwise.'' | ''All material © 2000-2002 David Given, unless where stated otherwise.'' |
edits