Open main menu

Difference between revisions of "SCUMM/V5 opcodes"

5,924 bytes added ,  07:28, 26 March 2009
→‎SCUMM V5 opcodes: Not many left! (Also reformatted)
m (isSoundRunning misisng some words)
(→‎SCUMM V5 opcodes: Not many left! (Also reformatted))
Line 3: Line 3:


{| border="1" cellpadding="2" width=100%
{| border="1" cellpadding="2" width=100%
 
|- style="background:whitesmoke"
|-|
|Term||Description
|-
|opcode||The instruction's opcode, with the appropriate bits set according to the parameters.
|opcode||The instruction's opcode, with the appropriate bits set according to the parameters.
|-
|-
Line 23: Line 24:
|value[o]||The offset word for parameter value. This is only encoded if needed, but always at the position indicated. If not specified, the offset word occurs immediately after the parameter.
|value[o]||The offset word for parameter value. This is only encoded if needed, but always at the position indicated. If not specified, the offset word occurs immediately after the parameter.
|-
|-
|value[s]||A null-terminated ASCII string.
|value[c]||An ASCII character. (Because some instructions use null-terminated strings and some use $FF, the exact format of a string is described in the instruction)
|-
|-
|(term)||An optional term.
|(term)||An optional term.
Line 36: Line 37:


===Encoding===
===Encoding===
''opcode actor[p8]''
opcode actor[p8]


===Operation===
===Operation===
Line 45: Line 46:


===Encoding===
===Encoding===
''opcode result x[p16] y[p16]''
opcode result x[p16] y[p16]


===Operation===
===Operation===
Line 55: Line 56:


===Encoding===
===Encoding===
''opcode actor[p8] sub-opcode... $FF''
opcode actor[p8] sub-opcode... $FF


sub-opcode can be any of the following:<br>
sub-opcode can be any of the following:
''$01 costume[p8]''<br>
$01 costume[p8]
''$02 xspeed[p8] yspeed[p8]''<br>
$02 xspeed[p8] yspeed[p8]
''$03 sound[p8]''<br>
$03 sound[p8]
''$04 walkframe[p8]''<br>
$04 walkframe[p8]
''$05 starttalk[p8] endtalk[p8]''<br>
$05 starttalk[p8] endtalk[p8]
''$06 standframe[p8]''<br>
$06 standframe[p8]
''$07 arg1[p8] arg2[p8] arg3[p8]''<br>
$07 arg1[p8] arg2[p8] arg3[p8]
''$08''<br>
$08
''$09 elevation[p16]''<br>
$09 elevation[p16]
''$0A''<br>
$0A
''$0B index[p8] value[p8]''<br>
$0B index[p8] value[p8]
''$0C colour[p8]''<br>
$0C colour[p8]
''$0D name[s]''<br>
$0D name[c]... $00
''$0E initframe[p8]''<br>
$0E initframe[p8]
''$10 width[p8]''<br>
$10 width[p8]
''$11 xscale[p8] yscale[p8]''<br>
$11 xscale[p8] yscale[p8]
''$12''<br>
$12
''$13 zplane[p8]''<br>
$13 zplane[p8]
''$14''<br>
$14
''$15 animspeed[p8]''<br>
$15 animspeed[p8]
''$16 mode[p8]''<br>
$16 mode[p8]


===Operation===
===Operation===
Line 84: Line 85:


{| border="1" cellpadding="2" width=100%
{| border="1" cellpadding="2" width=100%
|- style="background:silver"
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|Opcode||Meaning||Description
|-
|-
Line 107: Line 108:
|$09||SO_ELEVATION||Sets the actor's elevation to the given value.
|$09||SO_ELEVATION||Sets the actor's elevation to the given value.
|-
|-
|$0A||SO_ANIMATION_DEFAULT||Initializes the actor's animation frames.<br>Init frame = 1<br>Walk frame = 2<br>Stand frame = 3<br>Talk start frame = 4<br> Talk stop frame = 5
|$0A||SO_ANIMATION_DEFAULT||Initializes the actor's animation frames.Init frame = 1Walk frame = 2Stand frame = 3Talk start frame = 4 Talk stop frame = 5
|-
|-
|$0B||SO_PALETTE||Sets the colour at the given index to a new value (another entry in the colour lookup table/CLUT). Index must be between 0 and 31 (the number of colours in a costume).
|$0B||SO_PALETTE||Sets the colour at the given index to a new value (another entry in the colour lookup table/CLUT). Index must be between 0 and 31 (the number of colours in a costume).
Line 141: Line 142:


===Encoding===
===Encoding===
''opcode object[p16] classes[v16]...''
opcode object[p16] classes[v16]...


===Operation===
===Operation===
Line 150: Line 151:


===Encoding===
===Encoding===
''opcode result value[p16]''
opcode result value[p16]


===Operation===
===Operation===
''result := result + value''
result := result + value


The variable pointed to by result is read, value is added to it, and the result written back.
The variable pointed to by result is read, value is added to it, and the result written back.
Line 162: Line 163:


===Encoding===
===Encoding===
''opcode result value[p16]''
opcode result value[p16]


===Operation===
===Operation===
''result := result and value''
result := result and value


The variable pointed to by result is read, logically ANDed with value, and the result written back.
The variable pointed to by result is read, logically ANDed with value, and the result written back.
Line 173: Line 174:


===Encoding===
===Encoding===
''opcode actor[p8] anim[p8]'''
opcode actor[p8] anim[p8]'


===Operation===
===Operation===
Line 183: Line 184:


===Encoding===
===Encoding===
''opcode $01 array[p8]''<br>
opcode $01 array[p8]
''opcode $02 dest[p8] src[p8]''<br>
opcode $02 dest[p8] src[p8]
''opcode $03 array[p8] index[p8] data[p8]''<br>
opcode $03 array[p8] index[p8] data[p8]
''opcode $04 result array[p8] index[p8]''<br>
opcode $04 result array[p8] index[p8]
''opcode $05 array[p8] size[p8]''<br>
opcode $05 array[p8] size[p8]


===Operation===
===Operation===
Line 193: Line 194:


{| border="1" cellpadding="2" width=100%
{| border="1" cellpadding="2" width=100%
|- style="background:silver"
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|Opcode||Meaning||Description
|-
|-
Line 212: Line 213:


===Encoding===
===Encoding===
''opcode''
opcode


===Operation===
===Operation===
Line 222: Line 223:


===Encoding===
===Encoding===
''opcode script[p8] args[v16]...''
opcode script[p8] args[v16]...


===Operation===
===Operation===
Line 232: Line 233:


===Encoding===
===Encoding===
''opcode sub-opcode''
opcode sub-opcode


sub-opcode can be any of the following:
sub-opcode can be any of the following:
''$01''<br>
$01
''$02''<br>
$02
''$03''<br>
$03
''$04''<br>
$04
''$05''<br>
$05
''$06''<br>
$06
''$07''<br>
$07
''$08''<br>
$08
''$0A cursornum[p8] charletter[p8]''<br>
$0A cursornum[p8] charletter[p8]
''$0B index[p8] x[p8] y[p8]''<br>
$0B index[p8] x[p8] y[p8]
''$0C cursor[p8]''<br>
$0C cursor[p8]
''$0D charset[p8]''<br>
$0D charset[p8]
''$0E colours[v16]...''<br>
$0E colours[v16]...


===Operation===
===Operation===
Line 253: Line 254:


{| border="1" cellpadding="2" width=100%
{| border="1" cellpadding="2" width=100%
|- style="background:silver"
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|Opcode||Meaning||Description
|-
|-
Line 290: Line 291:


===Encoding===
===Encoding===
''opcode args[v16]...''
opcode args[v16]...


===Operation===
===Operation===
Line 300: Line 301:


===Encoding===
===Encoding===
''opcode param[p16]''
opcode param[p16]


===Operation===
===Operation===
Line 310: Line 311:


===Encoding===
===Encoding===
''opcode result''
opcode result


===Operation===
===Operation===
''result := result - 1''
result := result - 1


Reads the variable pointed to by result, decrements it, and writes it back.  
Reads the variable pointed to by result, decrements it, and writes it back.  
Line 322: Line 323:


===Encoding===
===Encoding===
''opcode param[24]''
opcode param[24]


===Operation===
===Operation===
Line 332: Line 333:


===Encoding===
===Encoding===
''opcode var''
opcode var


===Operation===
===Operation===
Line 342: Line 343:


===Encoding===
===Encoding===
''opcode result value[p16]''
opcode result value[p16]


===Operation===
===Operation===
''result := result / value''
result := result / value


The variable pointed to by result is read, divided by value, and the result written back. If value is zero, the result is undefined (and the interpeter may halt with an error).  
The variable pointed to by result is read, divided by value, and the result written back. If value is zero, the result is undefined (and the interpeter may halt with an error).  
Line 353: Line 354:


===Encoding===
===Encoding===
''opcode verb[p8] objectA[p16] objectB[p16]''
opcode verb[p8] objectA[p16] objectB[p16]


===Operation===
===Operation===
Performs a verb sentence action. If verb is $FE, the current sentence script is stopped, status cleared etc.
Performs a verb sentence action, e.g. "Use monkey on hydrant". If verb is $FE, the current sentence script is stopped, status cleared etc.




Line 363: Line 364:


===Encoding===
===Encoding===
''opcode left[p16] top[p16] auxopcode[8] right[p16] bottom[p16] colour[p8]''
opcode left[p16] top[p16] auxopcode[8] right[p16] bottom[p16] colour[p8]


===Operation===
===Operation===
Line 372: Line 373:


==drawObject ($05)==
==drawObject ($05)==
===Encoding===
opcode object[p16] sub-opcode
sub-opcodes:
$01 xpos[p16] ypos[p16]
$02 state[p16]
$1F
===Operation===
{| border="1" cellpadding="2" width=100%
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|-
|$01||Draw At||Moves the given object to the given co-ordinates, and adds it to the drawing queue.
|-
|$02||Set State||Sets the state of the object, adds it to the drawing queue.
|-
|$1F||Draw||Does not change the object's position (or state?), still adds it to the drawing queue.
|}
===Variants===
Small header games only support the parameters used with sub-opcode $01, e.g:
opcode object[p16] xpos[p16] ypos[p16]




Line 377: Line 402:


===Encoding===
===Encoding===
''opcode''
opcode


===Operation===
===Operation===
Line 389: Line 414:


===Encoding===
===Encoding===
''opcode'''
opcode'


===Operation===
===Operation===
Line 396: Line 421:


==equalZero ($28)==
==equalZero ($28)==
jumps
jumps


===Encoding===
===Encoding===
''opcode var target[16]''
opcode var target[16]


===Operation===
===Operation===
''unless (var == 0) goto target''
unless (var == 0) goto target


Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Line 409: Line 433:


==expression ($AC)==
==expression ($AC)==
===Encoding===
opcode result subopcode... $FF
sub-opcodes:
$01 value[p16]
$02
$03
$04
$05
$06 nested-opcode
===Operation===
Expression mode operates on a stack. Values are pushed on, and operators are applied to the top two items on the stack.
{| border="1" cellpadding="2" width=100%
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|-
|$01||Value||Pushes a value onto the top of the stack.
|-
|$02||Add||stack[top - 1] + stack[top]
|-
|$03||Subtract||stack[top - 1] - stack[top]
|-
|$04||Multiply||stack[top - 1] * stack[top]
|-
|$05||Divide||stack[top - 1] / stack[top]  (if stack[top] is 0 an error occurs)
|-
|$06||Nested Opcode||An entire instruction that returns a result, such as getActorScale. This is interpreted like a normal opcode, but the result is pushed onto the expression stack. (The opcode is passed the special "VAR_RESULT" parameter for "result")
|}




Line 414: Line 469:


===Encoding===
===Encoding===
''opcode actor[p8] object[p16]''
opcode actor[p8] object[p16]


===Operation===
===Operation===
Line 423: Line 478:


===Encoding===
===Encoding===
''opcode result x[p8] y[p8]''
opcode result owner[p8] index[p8]
 
===Operation===
object := owner.inventory[index] ???




Line 429: Line 487:


===Encoding===
===Encoding===
''opcode result x[p8] y[p8]''
opcode result x[p8] y[p8]
 
===Operation===
Returns the first "touchable" local object at the given co-ordinates. Will not match on the bottom or right-hand edges of an object.




Line 435: Line 496:


===Encoding===
===Encoding===
''opcode script[p8]''
opcode flag[p8]


===Operation===
===Operation===
Freezes given script. Unfreezes all scripts if script is 0.
Freezes all scripts (by setting the high bit on each script's status). If flag is >= $80, all freeze resistent scripts will also be frozen. If flag is 0, all scripts are unfrozen. Freezing effects are cumulative - i.e. if script A is frozen twice, and unfrozen once, it will still be frozen until unfrozen a second time. A script is unfrozen by clearing the high bit.




Line 444: Line 505:


===Encoding===
===Encoding===
''opcode result actor[p8]''
opcode result actor[p8]


===Operation===
===Operation===
Line 453: Line 514:


===Encoding===
===Encoding===
''opcode result actor[p8]''
opcode result actor[p8]


===Operation===
===Operation===
Line 462: Line 523:


===Encoding===
===Encoding===
''opcode result actor[p8]''
opcode result actor[p8]


===Operation===
===Operation===
Line 471: Line 532:


===Encoding===
===Encoding===
''opcode result actor[p8]''
opcode result actor[p8]


===Operation===
===Operation===
Line 480: Line 541:


===Encoding===
===Encoding===
''opcode result actor[p8]''
opcode result actor[p8]


===Operation===
===Operation===
Line 489: Line 550:


===Encoding===
===Encoding===
''opcode result actor[p8]''
opcode result actor[p8]


===Operation===
===Operation===
Line 501: Line 562:


===Encoding===
===Encoding===
''opcode result actor[p8]''
opcode result actor[p8]


===Operation===
===Operation===
Line 510: Line 571:


===Encoding===
===Encoding===
''opcode result actor[p8]''
opcode result actor[p8]


===Operation===
===Operation===
Line 519: Line 580:


===Encoding===
===Encoding===
''opcode result actor[p16]''
opcode result actor[p16]


===Operation===
===Operation===
Line 528: Line 589:


===Encoding===
===Encoding===
''opcode result actor[p16]''
opcode result actor[p16]


===Operation===
===Operation===
Line 538: Line 599:


===Encoding===
===Encoding===
''opcode result actor[p8]''
opcode result actor[p8]


===Operation===
===Operation===
Line 547: Line 608:


===Encoding===
===Encoding===
''opcode result actor[p16]''
opcode result actor[p16]


===Operation===
===Operation===
Line 556: Line 617:


===Encoding===
===Encoding===
''opcode result objA[p16] objB[p16]''
opcode result objA[p16] objB[p16]


===Operation===
===Operation===
Line 565: Line 626:


===Encoding===
===Encoding===
''opcode result actor[p8]''
opcode result actor[p8]


===Operation===
===Operation===
Line 574: Line 635:


===Encoding===
===Encoding===
''opcode result actor[p16]''
opcode result actor[p16]


===Operation===
===Operation===
Line 584: Line 645:


===Encoding===
===Encoding===
''opcode result object[p16]''
opcode result object[p16]


===Operation===
===Operation===
Line 591: Line 652:
===Variants===
===Variants===
In small header games, the encoding becomes:
In small header games, the encoding becomes:
''opcode object[p16] state[p8] target[16]''
opcode object[p16] state[p8] target[16]
operation becomes
operation becomes
''unless (getState(object) == state) goto target''
unless (getState(object) == state) goto target




Line 599: Line 660:


===Encoding===
===Encoding===
''opcode result seed[p8]''
opcode result seed[p8]


===Operation===
===Operation===
Line 608: Line 669:


===Encoding===
===Encoding===
''opcode result script[p8]''
opcode result script[p8]


===Operation===
===Operation===
Line 617: Line 678:


===Encoding===
===Encoding===
''opcode result strptr[p8]''
opcode result strptr[p8]


===Operation===
===Operation===
Line 626: Line 687:


===Encoding===
===Encoding===
''opcode result object[p16] verb[p16]''
opcode result object[p16] verb[p16]


===Operation===
===Operation===
Line 633: Line 694:


==ifClassOfIs ($1D)==
==ifClassOfIs ($1D)==
jumps
jumps


===Encoding===
===Encoding===
''opcode value[p16] args[p16]...''
opcode value[p16] args[p16]... target[16]


===Operation===
===Operation===
''unless (value.class is one of [args.class]) goto target''
unless (value.class is one of [args.class]) goto target


Compares the value's class with all classes given in args.
Compares the value's class with all classes given in args.
Line 648: Line 708:


==increment ($46)==
==increment ($46)==
no parameters, uses result
no parameters, uses result


===Encoding===
===Encoding===
''opcode result''
opcode result


===Operation===
===Operation===
''result := result + 1''
result := result + 1


Reads the variable pointed to by result, increments it, and writes it back.  
Reads the variable pointed to by result, increments it, and writes it back.  
Line 663: Line 722:


===Encoding===
===Encoding===
''opcode actor[p8] box[p8] target[16]''
opcode actor[p8] box[p8] target[16]


===Operation===
===Operation===
If the actor's co-ordinates are not within the bounds of the given box, jump to target.
Unless the actor's co-ordinates are within the bounds of the given box, jump to target.


Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Line 674: Line 733:


===Encoding===
===Encoding===
''opcode var value[p16] target[16]''
opcode var value[p16] target[16]


===Operation===
===Operation===
''unless (value == var) goto target''
unless (value == var) goto target


Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Line 685: Line 744:


===Encoding===
===Encoding===
''opcode var value[p16] target[16]''
opcode var value[p16] target[16]


===Operation===
===Operation===
''unless (value > var) goto target''
unless (value > var) goto target


Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Line 696: Line 755:


===Encoding===
===Encoding===
''opcode var value[p16] target[16]''
opcode var value[p16] target[16]


===Operation===
===Operation===
''unless (value >= var) goto target''
unless (value >= var) goto target


Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Line 707: Line 766:


===Encoding===
===Encoding===
''opcode var value[p16] target[16]''
opcode var value[p16] target[16]


===Operation===
===Operation===
''unless (value < var) goto target''
unless (value < var) goto target


Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Line 718: Line 777:


===Encoding===
===Encoding===
''opcode var value[p16] target[16]''
opcode var value[p16] target[16]


===Operation===
===Operation===
''unless (value != var) goto target''
unless (value != var) goto target


Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Line 729: Line 788:


===Encoding===
===Encoding===
''opcode result sound[p8]''
opcode result sound[p8]


===Operation===
===Operation===
Line 736: Line 795:


==jumpRelative ($18)==
==jumpRelative ($18)==
jumps
jumps


===Encoding===
===Encoding===
''opcode target[16]''
opcode target[16]


===Operation===
===Operation===
''PC := PC + target''
PC := PC + target


The inline constant target is read as a signed word and added to the program counter after the instruction has been read. Therefore, if target is zero, the instruction will do nothing; if target is -3, an infinite loop will result.  
The inline constant target is read as a signed word and added to the program counter after the instruction has been read. Therefore, if target is zero, the instruction will do nothing; if target is -3, an infinite loop will result.  
Line 749: Line 807:


==lessOrEqual ($38)==
==lessOrEqual ($38)==
jumps
jumps


===Encoding===
===Encoding===
''opcode var value[p16] target[16]''
opcode var value[p16] target[16]


===Operation===
===Operation===
''unless (value <= var) goto target''
unless (value <= var) goto target


Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Line 762: Line 819:


==lights ($70)==
==lights ($70)==
===Encoding===
opcode arg1[p8] arg2[8] arg3[8]
===Operation===
If arg3 is 0, the "current lights" variable is set to arg1.
If arg3 is 1, the size of the "flashlight" light is determined by arg1 and arg2, for width and height in stripes (which are equivalent to 8 pixels each; see [[SCUMM/Technical Reference/Image resources]]).




==loadRoom ($72)==
==loadRoom ($72)==
===Encoding===
opcode room[p8]
===Operation===
Loads the given room into memory.




==loadRoomWithEgo ($24)==
==loadRoomWithEgo ($24)==
===Encoding===
opcode object[p16] room[p8] x[16] y[16]
===Operation===
Places the Ego actor in room at object's position. If x is not -1, Ego will start moving towards the given x and y co-ordinates. If object is not in the given room an error will occur.
(I think...)




==matrixOp ($30)==
==matrixOp ($30)==
===Encoding===
opcode sub-opcode
sub-opcodes:
$01 box[p8] val[p8]
$02 box[p8] val[p8]
$03 box[p8] val[p8]
$04
===Operation===
This instruction manipulates boxes.
{| border="1" cellpadding="2" width=100%
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|-
|$01||setBoxFlags||Sets the box's flags to the given value.
|-
|$02||setBoxScale||Sets the box's scale.
|-
|$03||setBoxScale||Sets the box's scale to ((val - 1) OR $8000).
|-
|$04||createBoxMatrix||Initializes the matrix of boxes, by determining the distances and shortest paths between boxes.
|}
===Variants===
SCUMM V3 only has the one instruction, which behaves like setBoxFlags:
opcode box[p8] val[8]




Line 776: Line 882:


===Encoding===
===Encoding===
''opcode result value[p16]''
opcode result value[p16]


===Operation===
===Operation===
''result := value''
result := value


Value is moved into result.
Value is moved into result.
Line 787: Line 893:


===Encoding===
===Encoding===
''opcode result value[p16]''
opcode result value[p16]


===Operation===
===Operation===
''result := result * value''
result := result * value


The variable pointed to by result is read, multiplied by value, and written back.
The variable pointed to by result is read, multiplied by value, and written back.
Line 798: Line 904:


===Encoding===
===Encoding===
''opcode var target[16]''
opcode var target[16]


===Operation===
===Operation===
''unless (var != 0) goto target''
unless (var != 0) goto target


Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Target is a byte offset (measured from after this instruction), which will be added to the instruction pointer.
Line 807: Line 913:


==or ($57)==
==or ($57)==
one parameter, uses result
one parameter, uses result


===Encoding===
===Encoding===
''opcode result value[p16]''
opcode result value[p16]


===Operation===
===Operation===
''result := result or value''
result := result or value


The variable pointed to by result is read, logically ORed with value, and the result written back.
The variable pointed to by result is read, logically ORed with value, and the result written back.




==overRide ($58)==
==override ($58)==
 
===Encoding===
opcode sub-opcode
 
sub-opcodes:
$00
$01 $18 target[16]
 
===Operation===
If the sub-opcode is 0, marks the end of an override section.
If the sub-opcode is not 0, marks the beginning of an override section.
Overrides are used by cutscenes; if a cutscene is skipped (if the user presses the ESC key), the script will jump by the given target (offset from this instruction).




==panCameraTo ($12)==
==panCameraTo ($12)==
===Encoding===
opcode x[p16]
===Operation===
Starts the camera panning to the given x co-ordinate.




==pickupObject ($25)==
==pickupObject ($25)==
===Encoding===
opcode object[p16] room[p8]
===Operation===
Adds the given object (located in the given room) to the Ego actor's inventory.
===Variants===
In SCUMM V3 and V4, this opcode is used for drawObject.




==print ($14)==
==print ($14)==
===Encoding===
opcode actor[p8] sub-opcode
sub-opcodes
$00 xpos[p16] ypos[p16]
$01 colour[p8]
$02 right[p16]
$03 width[p16] height[p16]
$04
$06
$07
$08 offset[p16] delay[p16]
$15 string[c]... $FF
===Operation===
Sets text properties and displays dialogue.
{| border="1" cellpadding="2" width=100%
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|-
|$00||SO_AT||Sets the position of the text that follows.
|-
|$01||SO_COLOR||Sets the colour of the text.
|-
|$02||SO_CLIPPED||Clips the text's right-hand side (for wrapping?).
|-
|$03||SO_ERASE||Erases characters (not used in ScummVM).
|-
|$04||SO_CENTER||Centres the text.
|-
|$06||SO_LEFT||Left-aligns the text.
|-
|$07||SO_OVERHEAD||Overhead-aligns the text.
|-
|$15||SO_TEXTSTRING||Prints the text string that follows. Terminated by $FF.
|}
===Variants===
In SCUMM V3, text function $06 sets the height of the text:
$06 height[p16]
In Loom CD (SCUMM V4), there is an additional text function $08 (SO_SAY_VOICE), which plays a portion of the CD audio track.
$08 offset[p16] delay[p16]




==printEgo ($D8)==
==printEgo ($D8)==
===Encoding===
opcode text[sf]
===Operation===
Exactly the same as print, except the actor is implicitly Ego.




==pseudoRoom ($CC)==
==pseudoRoom ($CC)==
===Encoding===
opcode val[8] res[8]... $00
===Operation===
forall (res) {
if (res >= $80) then _resourceMapper[res & $7F] := val
}
What does this actually do? We may never know.




==putActor ($01)==
==putActor ($01)==
===Encoding===
opcode actor[p8] x[p16] y[p16]
===Operation===
Puts the actor at the given co-ordinates.




==putActorAtObject ($0E)==
==putActorAtObject ($0E)==
===Encoding===
opcode actor[p8] object[p16]
===Operation===
Puts the actor at the given object's position. If the object can not be found, a default position is returned (the centre of the screen in ScummVM).




==putActorInRoom ($2D)==
==putActorInRoom ($2D)==


===Encoding===
opcode actor[p8] room[p8]


==quitPauseRestart ($98)==
===Operation===
Puts the actor in the given room.




Line 875: Line 1,083:


===Encoding===
===Encoding===
''opcode result number[8] values[8]...''<br>
opcode result number[8] values[8]...
or<br>
or
''opcode result number[8] values[16]...''<br>
opcode result number[8] values[16]...


===Operation===
===Operation===
for (i = 0; i < number; i++) {
&#42;result + i := values[i];
}
This sets a number of variables to the given parameters. The starting variable is given as "result", and the number of variables to modify is given as "number". This is followed by the same number of values, which will be put into the variable locations. The values are constants, and can be either 16-bit, if the highest bit of the opcode is set, i.e. $A6; or 8-bit, if the highest bit of the opcode is not set, i.e. $26. Note that all values are affected by the opcode's high bit; you can't mix 8 and 16-bit values.
This sets a number of variables to the given parameters. The starting variable is given as "result", and the number of variables to modify is given as "number". This is followed by the same number of values, which will be put into the variable locations. The values are constants, and can be either 16-bit, if the highest bit of the opcode is set, i.e. $A6; or 8-bit, if the highest bit of the opcode is not set, i.e. $26. Note that all values are affected by the opcode's high bit; you can't mix 8 and 16-bit values.


===descumm example===
===descumm example===
''setVarRange(Var[178],9,[0,0,0,0,0,0,0,0,0]);''
setVarRange(Var[178],9,[0,0,0,0,0,0,0,0,0]);


This sets variables 178 to 186 (inclusive) to 0.
This sets variables 178 to 186 (inclusive) to 0.
Line 902: Line 1,114:


===Encoding===
===Encoding===
''opcode script[p8] args[v16]...''
opcode script[p8] args[v16]...


===Operation===
===Operation===
Line 910: Line 1,122:


{| border="1" cellpadding="2" width=10%
{| border="1" cellpadding="2" width=10%
|- style="background:silver"
|- style="background:whitesmoke"
|7||6||5||4  0
|7||6||5||4  0
|-
|-
Line 938: Line 1,150:


===Encoding===
===Encoding===
''opcode result value[p16]''
opcode result value[p16]


===Operation===
===Operation===
''result := result - value''
result := result - value


The variable pointed to by result is read, value is subtracted from it, and the result written back.
The variable pointed to by result is read, value is subtracted from it, and the result written back.




==animateActor ($11)==
==systemOps ($98)==
 
===Encoding===
opcode sub-opcode
 
sub-opcodes:
$01
$02
$03


===Operation===
{| border="1" cellpadding="2" width=100%
|- style="background:whitesmoke"
|Opcode||Meaning||Description
|-
|$01||SO_RESTART||Restarts the game.
|-
|$02||SO_PAUSE||Pauses/unpauses the game.
|-
|$03||SO_QUIT||Quits the game.
|}


==wait ($AE)==
==wait ($AE)==
125

edits