<opcodes>
	<!--
# Tags:
# (hex number): hex opcode
# name: assembler opcode mnemonic from opcodes.h
# asm_nmo: assembler output format
# asm_comment: assembler comment output format
# ucs_nmo: script function output format
# num_bytes: number of data bytes
# param_types: data types of bytes
# num_pop: number of elements it pops from the stack
# num_push: number of elements it pushes to the stack
# The following are self-closing tags, whose presence is enough to set a flag
# to true (and whose absence sets this flag to zero).
#       call_effect: If present, this is a 'call type' opcode. Uses the extern
#               function passed as parameter.
#       function_effect: If present, this is a 'call type' opcode. Uses passed
#                parameter as function ID.
#       return: If present, it signifies that the function this opcode is found
#               in returns a variable on the stack.
#       paren:  If present, we output a pair of parenthesis around the usecode
#               script output.
#       debug: If present, marks the opcode as being a debug function opcode.
#               This means that the first string in the data segment is the
#               function name, and each subsequent string is the name of either
#               a parameter or a variable.
#       nosemicolon: If present, prevents the end-of-line semi-colon from being
#               output.
#       abort: If present, indicates that the opcode causes the usecode machine
#               to quit, like a C++ throw() statement.
#       staticref: If present, signals that the opcode as references a static
#               variable
#       loop: If present, marks the opcode as representing a for loop.
#       new_effect: If present, marks this as being a class allocating opcode.
#       method_effect: If present, causes the number of elements indicated by
#               the corresponding method to be popped.
#       not_param: If present, prevents the opcode from counting as a parameter
#               for other opcodes.
# The following self-closing tags are only for the usecode script output, and
# while recognized by UCXT, have no effect on output.
#       indent_inc: If present, output the opcode then increment the indentation
#               level by 1.
#       indent_dec: If present, output the opcode then decrement the indentation
#               level by 1.
#       indent_tmpinc: If present, increment the indent level by 1, output the
#               opcode, then decrement the indent level by 1.
#       indent_tmpdec: If present, decrement the indent level by 1, output the
#               opcode, then increment the indent level by 1.

# DataType Notes:
# long == dataoffset32 == offset32 == 4 bytes
# flag == extoffset == dataoffset == varoffset == offset == short == 2 bytes
# byte == 1 byte

# offset is calculated from the relative offset it
# A "false" value is defined as integer 0, a null string, or an empty array.
# (stateing obvious) Logically a "true" value would be the opposite of this.

# "Truth value"s pushed on the stack are integer 1 for true, and integer 0
# for false.

# REMEMBER: All arrays are indexed with as 1 based rather then 0 based.

# Notes on number of bytes popped/pushed:
# All numbers are the number of bytes popped/pushed from the stack, with the
# exception of 0xFF, which currently means the number of bytes in the first
# opcode parameter (see opcode 0x07). and 0xFE means the second parameter.
# Logic: parameter referenced is abs(0x100 - value)

# NOTE: Description of function appears below the relevant function.

	-->
	<0x02>
		<name> UC_LOOPTOP </>
		<asm_nmo> `loop\t[%1], [%2], [%3], [%4], %5` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `for (%v3 in %v4 with %v1 to %v2) attend label%f*_%5` </>
		<num_bytes> 10 </>
		<param_types> {short,short,short,varoffset,offset} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<loop/>
		<!--
TODO: To be done...
* {varoffset} is the array to loop over.
* {short}(1st) is used to store the "counter".
* {short}(2nd) is used to store the "max" value. Which is the number of elements  stored in {varoffset} or 1 if it's a string or integer.
* {offset} is the relative offset to jump to after the loop is completed.
		-->
	</>
	<0x04>
		<name> UC_CONVERSE </>
		<asm_nmo> `startconv\t%1` </>
		<asm_comment> `` </>
		<ucs_nmo> `converse attend label%f*_%1` </>
		<num_bytes> 2 </>
		<param_types> {offset} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!--
Display the Avatar's conversation options and ask for the user's input.
It jumps to {offset} if there is no conversation answers available.
		-->
	</>
	<0x05>
		<name> UC_JNE </>
		<asm_nmo> `jne\t%1` </>
		<asm_comment> `` </>
		<ucs_nmo> `if (!%p1) goto label%f*_%1` </>
		<num_bytes> 2 </>
		<param_types> {offset} </>
		<num_pop> 1 </>
		<num_push> 0 </>
		<!--
Pops a value from the stack, tests if it's false, if it's false jumps to
the relative {offset}.
		-->
	</>
	<0x06>
		<name> UC_JMP </>
		<asm_nmo> `jmp\t%1` </>
		<asm_comment> `` </>
		<ucs_nmo> `goto label%f*_%1` </>
		<num_bytes> 2 </>
		<param_types> {offset} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!-- Jumps to the relative {offset} provided. -->
	</>
	<0x07>
		<name> UC_CMPS </>
		<asm_nmo> `cmps\t%1H, %2` </>
		<asm_comment> `\t\t;` </>
		<ucs_nmo> `case %p, attend label%f*_%2:` </>
		<num_bytes> 4 </>
		<param_types> {short,offset} </>
		<num_pop> 0xFF </>
		<num_push> 0 </>
		<nosemicolon/>
		<!--
Pop {short} number of values from the stack, compare each one to the
last response from the user, and jumps to the {offset} if it's not found,
else continue as normal.
NOTE: only do this comparing if we haven't found a correct answer on
any of the previous CMPSs or DEFAULTs since the last ASK.
		-->
	</>
	<0x09>
		<name> UC_ADD </>
		<asm_nmo> `add` </>
		<asm_comment> `` </>
		<ucs_nmo> `%p2 + %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!-- Adds %p1 to %p2. -->
	</>
	<0x0A>
		<name> UC_SUB </>
		<asm_nmo> `sub` </>
		<asm_comment> `` </>
		<ucs_nmo> `%p2 - %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!-- Subtracts %p1 from %p2. -->
	</>
	<0x0B>
		<name> UC_DIV </>
		<asm_nmo> `div` </>
		<asm_comment> `` </>
		<ucs_nmo> `%p2 / %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!-- Divides %p2 by %p1. -->
	</>
	<0x0C>
		<name> UC_MUL </>
		<asm_nmo> `mul` </>
		<asm_comment> `` </>
		<ucs_nmo> `%p2 * %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!-- Multiplies %p1 by %p2. -->
	</>
	<0x0D>
		<name> UC_MOD </>
		<asm_nmo> `mod` </>
		<asm_comment> `` </>
		<ucs_nmo> `%p2 %% %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!-- Mods %p2 by %p1. -->
	</>
	<0x0E>
		<name> UC_AND </>
		<asm_nmo> `and` </>
		<asm_comment> `` </>
		<ucs_nmo> `%p2 &amp;&amp; %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!--
Pops two elements from the stack, converts them to true/false, logically
"and"s the values, and pushes the resulting truth value back on the stack
as a 1/0(true/false).
		-->
	</>
	<0x0F>
		<name> UC_OR </>
		<asm_nmo> `or` </>
		<asm_comment> `` </>
		<ucs_nmo> `%p2 || %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!--
The "logical or" counterpart the the "logical and" (opcode 0x0E). Refer to
that opcode for more information.
		-->
	</>
	<0x10>
		<name> UC_NOT </>
		<asm_nmo> `not` </>
		<asm_comment> `` </>
		<ucs_nmo> `!%p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 1 </>
		<num_push> 1 </>
		<paren/>
		<!--
Pops one element from the stack converts it to a truth value, logically "not"s
it, and then pushes the resulting truth value on the stack.
		-->
	</>
	<0x12>
		<name> UC_POP </>
		<asm_nmo> `pop\t[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%v1 = %p1` </>
		<num_bytes> 2 </>
		<param_types> {varoffset} </>
		<num_pop> 1 </>
		<num_push> 0 </>
		<!--
Pops one element from the stack and assigns it to the local variable pointed
to by {varoffset}.
MENTAL NOTE: assert(varoffset&gt;=0 &amp;&amp; varoffset&lt;num_local_variables);
		-->
	</>
	<0x13>
		<name> UC_PUSHTRUE </>
		<asm_nmo> `push\ttrue` </>
		<asm_comment> `` </>
		<ucs_nmo> `true` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<!-- Pushes true onto the stack. -->
	</>
	<0x14>
		<name> UC_PUSHFALSE </>
		<asm_nmo> `push\tfalse` </>
		<asm_comment> `` </>
		<ucs_nmo> `false` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<!-- Pushes false onto the stack. -->
	</>
	<0x16>
		<name> UC_CMPGT </>
		<asm_nmo> `cmpgt` </>
		<asm_comment> `` </>
		<ucs_nmo> `%p2 &gt; %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!-- Tests if %p2 is greater then %p1. -->
	</>
	<0x17>
		<name> UC_CMPLT </>
		<asm_nmo> `cmplt` </>
		<asm_comment> `` </>
		<ucs_nmo> `%p2 &lt; %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!-- Tests if %p2 is less then %p1. -->
	</>
	<0x18>
		<name> UC_CMPGE </>
		<asm_nmo> `cmpge` </>
		<asm_comment> `` </>
		<ucs_nmo> `%p2 &gt;= %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!-- Tests if %p2 is greater then or equal to %p1. -->
	</>
	<0x19>
		<name> UC_CMPLE </>
		<asm_nmo> `cmple` </>
		<asm_comment> `` </>
		<ucs_nmo> `%p2 &lt;= %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!-- Tests if %p2 is less then or equal to %p1. -->
	</>
	<0x1A>
		<name> UC_CMPNE </>
		<asm_nmo> `cmpne` </>
		<asm_comment> `` </>
		<ucs_nmo> `%p2 != %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!-- Tests if %p2 is not equal to %p1. -->
	</>
	<0x1C>
		<name> UC_ADDSI </>
		<asm_nmo> `addsi\tL%1` </>
		<asm_comment> `\t\t\t; %tc1` </>
		<ucs_nmo> `message(\"%t1\")` </>
		<num_bytes> 2 </>
		<param_types> {dataoffset} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!--
Appends a string from the data segment {dataoffset} to the string register.
		-->
	</>
	<0x1D>
		<name> UC_PUSHS </>
		<asm_nmo> `pushs\tL%1` </>
		<asm_comment> `\t\t\t; %tc1` </>
		<ucs_nmo> `\"%t1\"` </>
		<num_bytes> 2 </>
		<param_types> {dataoffset} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<!-- Pushes the string at {dataoffset} onto the stack. -->
	</>
	<0x1E>
		<name> UC_ARRC </>
		<asm_nmo> `arrc\t%1H` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `[%p,]` </>
		<num_bytes> 2 </>
		<param_types> {short} </>
		<num_pop> 0xFF </>
		<num_push> 1 </>
		<!--
Pops {short} number of elements from the stack, and creates an array of
them, first off the stack is the first appended to the end of the array
(ie. the elements were appended originally to the stack in the order 3, 2,
1 would create an array of the form {1, 2, 3}). The created array is then
appended to the stack.
		-->
	</>
	<0x1F>
		<name> UC_PUSHI </>
		<asm_nmo> `pushi\t%1H` </>
		<asm_comment> `\t\t\t; %d1` </>
		<ucs_nmo> `0x%1` </>
		<num_bytes> 2 </>
		<param_types> {short} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<!--
Pushes the element {short} to the stack as a signed 16bit integer.
		-->
	</>
	<0x21>
		<name> UC_PUSH </>
		<asm_nmo> `push\t[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%v1` </>
		<num_bytes> 2 </>
		<param_types> {varoffset} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<!--
Pushes the variable stored at {varoffset} onto the stack.
		-->
	</>
	<0x22>
		<name> UC_CMPEQ </>
		<asm_nmo> `cmpeq` </>
		<asm_comment> `` </>
		<ucs_nmo> `%p2 == %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!-- Tests if %p2 is equal to %p1. -->
	</>
	<0x24>
		<name> UC_CALL </>
		<asm_nmo> `call\textern:[%1]` </>
		<asm_comment> `\t\t;` </>
		<ucs_nmo> `%f1(%p,)` </>
		<num_bytes> 2 </>
		<param_types> {extoffset} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<call_effect/>
		<!--
References the "external usecode function table" (Exult code calls this
"externals"), with the {extoffset} value passed in the opcode call
(eg: external_table[extoffset]), then "calls" that function to continue
execution.
		-->
	</>
	<0x25>
		<name> UC_RET </>
		<asm_nmo> `ret` </>
		<asm_comment> `` </>
		<ucs_nmo> `return` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!--
Returns to the "caller" function, after showing any text remaining in the
string buffer. Does not return any elements on the stack (ie: returns "void").
		-->
	</>
	<0x26>
		<name> UC_AIDX </>
		<asm_nmo> `aidx\t[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%v1[%p1]` </>
		<num_bytes> 2 </>
		<param_types> {varoffset} </>
		<num_pop> 1 </>
		<num_push> 1 </>
		<!--
Pops one (pop v1) element off the stack (the array index), and uses it as an
index of the local variable {varoffset}. (varoffset[v1]) The element obtained
is then pushed onto the stack.
TODO: NOTE: This opcode has been changed... need to re-document.
		-->
	</>
	<0x2C>
		<name> UC_RET2 </>
		<asm_nmo> `ret2` </>
		<asm_comment> `` </>
		<ucs_nmo> `return` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!--
Yet Another Return. Exult implements this identically to the RET opcode (0x25).
		-->
	</>
	<0x2D>
		<name> UC_RETV </>
		<asm_nmo> `retv` </>
		<asm_comment> `` </>
		<ucs_nmo> `return %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 1 </>
		<num_push> 0 </>
		<return/>
		<!--
Pops the top most element off the stack, stores it in the return register and returns from function.
		-->
	</>
	<0x2E>
		<name> UC_LOOP </>
		<asm_nmo> `initloop` </>
		<asm_comment> `` </>
		<ucs_nmo> `enum()` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!--
Part one of the two opcode for...each opcode loop. Details under opcode 0x02.
		-->
	</>
	<0x2F>
		<name> UC_ADDSV </>
		<asm_nmo> `addsv\t[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `message(%v1)` </>
		<num_bytes> 2 </>
		<param_types> {varoffset} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!--
Appends the local variable pointed to by {varoffset} onto the end of the
string register.
		-->
	</>
	<0x30>
		<name> UC_IN </>
		<asm_nmo> `in` </>
		<asm_comment> `\t\t\t\t;` </>
		<ucs_nmo> `%p2 in %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!--
Tests if a value is in an array. Pops two elements from the stack (pop v1,
then pop v2) test if any of the elements inside the array v1 are equal to
the element v2 (v2 cannot be an array), and pushes the resulting truth value
on the stack.
		-->
	</>
	<0x31>
		<name> UC_DEFAULT </>
		<asm_nmo> `default\t%1, %2` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `default(0x%1) attend label%f*_%2:` </>
		<num_bytes> 4 </>
		<param_types> {short,offset} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<nosemicolon/>
		<!--
This is a version of CMPS that pops no values from the stack (ignores the
{short} parameter) and either jumps to the {offset} if an answer has been
handled by a previous CMPS or marks an answer as being found and continue
as normal.
NOTE: Placing this before CMPS or DEFAULT opcodes will mean they never match a
response from the user. You never need more than one DEFAULT in an ASK, and you
should always place it after all CMPS cases of an ASK.
		-->
	</>
	<0x32>
		<name> UC_RETZ </>
		<asm_nmo> `retz` </>
		<asm_comment> `` </>
		<ucs_nmo> `return 0` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<return/>
		<!--
Stores the value zero on the return value and returns from the function.
		-->
	</>
	<0x33>
		<name> UC_SAY </>
		<asm_nmo> `say` </>
		<asm_comment> `` </>
		<ucs_nmo> `say()` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!--
Displays the string register to the screen (as appropriate talk, sign, scroll,
book, whatever). Has the side effect of clearing the string register.
		-->
	</>
	<0x38>
		<name> UC_CALLIS </>
		<asm_nmo> `callis\t%i1@%b2` </>
		<asm_comment> `\t\t; %1` </>
		<ucs_nmo> `UI_%i1(%p,)` </>
		<num_bytes> 3 </>
		<param_types> {short,byte} </>
		<num_pop> 0xFE </>
		<num_push> 1 </>
		<!--
Calls the intrinsic {short} with {byte} number of parameters popped from the
stack passed to it. Eg: if you were calling intrinsic 23 (short) with 3 (byte)
parameters, and the stack looked like this: {4, 3, 2, 1} (4 was the first
element pushed upon the stack), the intrinsic function call in a c-like form
would look like: intrinsic23( 1, 2, 3);

The intrinsic called will return a value on the stack.

The intrinsic called also has the same "event" flag as the caller function.
		-->
	</>
	<0x39>
		<name> UC_CALLI </>
		<asm_nmo> `calli\t%i1@%b2` </>
		<asm_comment> `\t\t; %1, %d2` </>
		<ucs_nmo> `UI_%i1(%p,)` </>
		<num_bytes> 3 </>
		<param_types> {short,byte} </>
		<num_pop> 0xFE </>
		<num_push> 0 </>
		<!--
Same as opcode CALLIS (0x38), except no return value.
		-->
	</>
	<0x3E>
		<name> UC_PUSHITEMREF </>
		<asm_nmo> `push\titemref` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `item` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<!--
Pushes the identifier of the item (for which the usecode event handler is
called) onto the stack.
		-->
	</>
	<0x3F>
		<name> UC_ABRT </>
		<asm_nmo> `abrt` </>
		<asm_comment> `` </>
		<ucs_nmo> `abort` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<abort/>
		<!--
Stores the text "abort executed" in the return register.
Shows any text in the string register, and exits the function immediatly.
ABRT also exits all calling functions, effectively stopping the usecode interpreter,
unless caught in a try/catch block.
		-->
	</>
	<0x40>
		<name> UC_CONVERSELOC </>
		<asm_nmo> `endconv` </>
		<asm_comment> `` </>
		<ucs_nmo> `endconv` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!--
Always seems to be called right before a "goodbye", so guessing
it means 'end conversation'.
		-->
	</>
	<0x42>
		<name> UC_PUSHF </>
		<asm_nmo> `pushf\tflag:[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `gflags[%g1]` </>
		<num_bytes> 2 </>
		<param_types> {flag} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<!-- TODO: document -->
	</>
	<0x43>
		<name> UC_POPF </>
		<asm_nmo> `popf\tflag:[%1]` </>
		<asm_comment> `\t\t;` </>
		<ucs_nmo> `gflags[%g1] = %p1` </>
		<num_bytes> 2 </>
		<param_types> {flag} </>
		<num_pop> 1 </>
		<num_push> 0 </>
		<!-- TODO: document -->
	</>
	<0x44>
		<name> UC_PUSHB </>
		<asm_nmo> `pushb\t%b1H` </>
		<asm_comment> `\t\t\t; %d1` </>
		<ucs_nmo> `(byte)0x%b1` </>
		<num_bytes> 1 </>
		<param_types> {byte} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<!-- TODO: document -->
	</>
	<0x46>
		<name> UC_POPARR </>
		<asm_nmo> `setarrayelem\t[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%v1[%p1] = %p2` </>
		<num_bytes> 2 </>
		<param_types> {varoffset} </>
		<num_pop> 2 </>
		<num_push> 0 </>
		<!-- TODO: document -->
	</>
	<0x47>
		<name> UC_CALLE </>
		<asm_nmo> `calle\t%1H` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%p1-&gt;%f#1()` </>
		<num_bytes> 2 </>
		<param_types> {short} </>
		<num_pop> 1 </>
		<num_push> 0 </>
		<function_effect/>
		<!--
Calls the function (short) with "item" being equal to the
element at the top of the stack. It does not return a
value on the stack.

In c-style notation, if the topmost element of the stack
is AVATAR = -356, and function 0x261 (Func0261) is
being called, we would have AVATAR->Func0261() and
inside Func0261, "item" would be the avatar.
		-->
	</>
	<0x48>
		<name> UC_PUSHEVENTID </>
		<asm_nmo> `push\teventid` </>
		<asm_comment> `` </>
		<ucs_nmo> `event` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<!-- TODO: document -->
	</>
	<0x4A>
		<name> UC_ARRA </>
		<asm_nmo> `arra` </>
		<asm_comment> `\t\t\t\t;` </>
		<ucs_nmo> `%p2 &amp; %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 1 </>
		<paren/>
		<!--
Appends second param. to the list in first param.
		-->
	</>
	<0x4B>
		<name> UC_POPEVENTID </>
		<asm_nmo> `pop\teventid` </>
		<asm_comment> `` </>
		<ucs_nmo> `event = %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 1 </>
		<num_push> 0 </>
		<!-- TODO: document -->
	</>
	<0x4C>
		<name> UC_DBGLINE </>
		<asm_nmo> `dbgline %1` </>
		<asm_comment> `` </>
		<ucs_nmo> `// Line: %1` </>
		<num_bytes> 2 </>
		<param_types> {short} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<not_param/>
		<!--
Debug opcode -- currently only found in the .es version of SI
		-->
	</>
	<0x4D>
		<name> UC_DBGFUNC </>
		<asm_nmo> `dbgfunc %1 %2 ` </>
		<asm_comment> `; %t1` </>
		<ucs_nmo> `// Function: %t1 %2` </>
		<num_bytes> 4 </>
		<param_types> {short,dataoffset} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<debug/>
		<not_param/>
		<!--
Debug opcode -- currently only found in the .es version of SI
		-->
	</>
	<0x50>
		<name> UC_PUSHSTATIC </>
		<asm_nmo> `push\tstatic\t[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%vs1` </>
		<num_bytes> 2 </>
		<param_types> {varoffset} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<staticref/>
		<!--
Pushes the static variable stored at {varoffset} onto the stack.
		-->
	</>
	<0x51>
		<name> UC_POPSTATIC </>
		<asm_nmo> `pop\tstatic\t[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%vs1 = %p1` </>
		<num_bytes> 2 </>
		<param_types> {varoffset} </>
		<num_pop> 1 </>
		<num_push> 0 </>
		<staticref/>
		<!--
Pops one element from the stack and assigns it to the static variable pointed
to by {varoffset}.
MENTAL NOTE: assert(varoffset&gt;=0 &amp;&amp; varoffset&lt;num_local_variables);
		-->
	</>
	<0x52>
		<name> UC_CALLO </>
		<asm_nmo> `callo\t%1H` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%p1-&gt;%f#1.original(%p+2)` </>
		<num_bytes> 2 </>
		<param_types> {short} </>
		<num_pop> 1 </>
		<num_push> 0 </>
		<function_effect/>
		<!--
Calls the original game function (short) with "item" being equal
to the element at the top of the stack. It does not return a
value on the stack.

In c-style notation, if the topmost element of the stack
is AVATAR = -356, and function 0x261 (Func0261) is
being called, we would have AVATAR->Func0261() and
inside Func0261, "item" would be the avatar.
		-->
	</>
	<0x53>
		<name> UC_CALLIND </>
		<asm_nmo> `callind` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%p2-&gt;(*%p1)()` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 0 </>
		<!--
Calls function pushed onto the stack.
		-->
	</>
	<0x54>
		<name> UC_PUSHTHV </>
		<asm_nmo> `push\tclsvar\t[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%vc1` </>
		<num_bytes> 2 </>
		<param_types> {varoffset} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<!--
Pushes the class variable stored at {varoffset} onto the stack.
		-->
	</>
	<0x55>
		<name> UC_POPTHV </>
		<asm_nmo> `pop\tclsvar\t[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%vc1 = %p1` </>
		<num_bytes> 2 </>
		<param_types> {varoffset} </>
		<num_pop> 1 </>
		<num_push> 0 </>
		<!--
Pops one element from the stack and assigns it to the class variable pointed
to by {varoffset}.
MENTAL NOTE: assert(varoffset&gt;=0 &amp;&amp; varoffset&lt;num_local_variables);
		-->
	</>
	<0x56>
		<name> UC_CALLM </>
		<asm_nmo> `callm\t[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `(%p1-&gt;*0x%1)(%p+2)` </>
		<num_bytes> 2 </>
		<param_types> {short} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<method_effect/>
		<!-- TODO: document. Opcode partially decoded; needs static data flow analysis. -->
	</>
	<0x57>
		<name> UC_CALLMS </>
		<asm_nmo> `callms\t[%2:%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%p1-&gt;%fm21(%p+2)` </>
		<num_bytes> 4 </>
		<param_types> {short,short} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<method_effect/>
		<!-- TODO: document -->
	</>
	<0x58>
		<name> UC_CLSCREATE </>
		<asm_nmo> `clscreate` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `new %c1(%p,)` </>
		<num_bytes> 2 </>
		<param_types> {short} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<new_effect/>
		<!-- TODO: document -->
	</>
	<0x59>
		<name> UC_CLASSDEL </>
		<asm_nmo> `classdel` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `delete %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 1 </>
		<num_push> 0 </>
		<!--
Pops one element from the stack and deletes its class data.
		-->
	</>
	<0x5A>
		<name> UC_AIDXS </>
		<asm_nmo> `aidxs\t[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%vs1[%p1]` </>
		<num_bytes> 2 </>
		<param_types> {varoffset} </>
		<num_pop> 1 </>
		<num_push> 1 </>
		<staticref/>
		<!--
Pops one (pop v1) element off the stack (the array index), and uses it as an
index of the static variable {varoffset}. (varoffset[v1]) The element obtained
is then pushed onto the stack.
TODO: NOTE: This opcode has been changed... need to redocument.
		-->
	</>
	<0x5B>
		<name> UC_POPARRS </>
		<asm_nmo> `setstaticarrayelem\t[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%vs1[%p1] = %p2` </>
		<num_bytes> 2 </>
		<param_types> {varoffset} </>
		<num_pop> 2 </>
		<num_push> 0 </>
		<staticref/>
		<!-- TODO: document -->
	</>
	<0x5C>
		<name> UC_LOOPTOPS </>
		<asm_nmo> `staticloop\t[%1], [%2], [%3], [%4], %5` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `for (%v3 in %vs4 with %v1 to %v2) attend label%f*_%5` </>
		<num_bytes> 10 </>
		<param_types> {short,short,short,varoffset,offset} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<staticref/>
		<loop/>
		<!--
TODO: To be done...
* {varoffset} is the array to loop over.
* {short}(1st) is used to store the "counter".
* {short}(2nd) is used to store the "max" value. Which is the number of elements  stored in {varoffset} or 1 if it's a string or integer.
* {offset} is the relative offset to jump to after the loop is completed.
		-->
	</>
	<0x5D>
		<name> UC_AIDXTHV </>
		<asm_nmo> `aidxclsvar\t[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%vc1[%p1]` </>
		<num_bytes> 2 </>
		<param_types> {varoffset} </>
		<num_pop> 1 </>
		<num_push> 1 </>
		<!--
Pops one (pop v1) element off the stack (the array index), and uses it as an
index of the class variable {varoffset}. (varoffset[v1]) The element obtained
is then pushed onto the stack.
TODO: NOTE: This opcode has been changed... need to redocument.
		-->
	</>
	<0x5E>
		<name> UC_POPARRTHV </>
		<asm_nmo> `setclsvararrayelem\t[%1]` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%vc1[%p1] = %p2` </>
		<num_bytes> 2 </>
		<param_types> {varoffset} </>
		<num_pop> 2 </>
		<num_push> 0 </>
		<!-- TODO: document -->
	</>
	<0x5F>
		<name> UC_LOOPTOPTHV </>
		<asm_nmo> `clsvarloop\t[%1], [%2], [%3], [%4], %5` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `for (%v3 in %vc4 with %v1 to %v2) attend label%f*_%5` </>
		<num_bytes> 10 </>
		<param_types> {short,short,short,varoffset,offset} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<loop/>
		<!--
TODO: To be done...
* {varoffset} is the array to loop over.
* {short}(1st) is used to store the "counter".
* {short}(2nd) is used to store the "max" value. Which is the number of elements  stored in {varoffset} or 1 if it's a string or integer.
* {offset} is the relative offset to jump to after the loop is completed.
		-->
	</>
	<0x60>
		<name> PUSHCHOICE </>
		<asm_nmo> `push\tchoice` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `user_choice` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<!--
Pushes the element {short} to the stack as a signed 16bit integer.
		-->
	</>
	<0x61>
		<name> UC_TRYSTART </>
		<asm_nmo> `starttry\t%1` </>
		<asm_comment> `` </>
		<ucs_nmo> `try catch label%f*_%1` </>
		<num_bytes> 2 </>
		<param_types> {offset} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!--
Prepares to catch abort/throw on given label instead of exiting usecode machine.
		-->
	</>
	<0x62>
		<name> UC_TRYEND </>
		<asm_nmo> `endtry` </>
		<asm_comment> `` </>
		<ucs_nmo> `endtry()` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!--
Prepares to catch abort/throw on given label instead of exiting usecode machine.
		-->
	</>
	<0x06>
		<name> UC_JMP </>
		<asm_nmo> `jmp\t%1` </>
		<asm_comment> `` </>
		<ucs_nmo> `goto label%f*_%1` </>
		<num_bytes> 2 </>
		<param_types> {offset} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!-- Jumps to the relative {offset} provided. -->
	</>
	<0x82>
		<name> UC_LOOPTOP32 </>
		<asm_nmo> `loop32\t[%1], [%2], [%3], [%4], %5` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `for (%v3 in %v4 with %v1 to %v2) attend label%f*_%n5` </>
		<num_bytes> 12 </>
		<param_types> {short,short,short,varoffset,offset32} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<loop/>
		<!-- The 32bit version of 0x02 - UC_LOOPTOP -->
	</>
	<0x84>
		<name> UC_CONVERSE32 </>
		<asm_nmo> `startconv32\t%1` </>
		<asm_comment> `` </>
		<ucs_nmo> `converse attend label%f*_%1` </>
		<num_bytes> 4 </>
		<param_types> {offset32} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!-- The 32bit version of 0x04 - UC_CONVERSE -->
	</>
	<0x85>
		<name> UC_JNE32 </>
		<asm_nmo> `jne32\t%1` </>
		<asm_comment> `` </>
		<ucs_nmo> `if (!%p1) goto label%f*_%n1` </>
		<num_bytes> 4 </>
		<param_types> {offset32} </>
		<num_pop> 1 </>
		<num_push> 0 </>
		<!-- The 32bit version of 0x05 - UC_JNE -->
	</>
	<0x86>
		<name> UC_JMP32 </>
		<asm_nmo> `jmp32\t%1` </>
		<asm_comment> `` </>
		<ucs_nmo> `goto label%f*_%n1` </>
		<num_bytes> 4 </>
		<param_types> {offset32} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!-- The 32bit version of 0x06 - UC_JMP -->
	</>
	<0x87>
		<name> UC_CMPS32 </>
		<asm_nmo> `cmps32\t%1H, %n2` </>
		<asm_comment> `\t\t;` </>
		<ucs_nmo> `case %p, attend label%f*_%2:` </>
		<num_bytes> 6 </>
		<param_types> {short,offset32} </>
		<num_pop> 0xFF </>
		<num_push> 0 </>
		<nosemicolon/>
		<!-- The 32bit version of 0x07 - UC_CMPS -->
	</>
	<0x9C>
		<name> UC_ADDSI32 </>
		<asm_nmo> `addsi32\tL%n1` </>
		<asm_comment> `\t\t\t; %tc1` </>
		<ucs_nmo> `message(\"%t1\")` </>
		<num_bytes> 4 </>
		<param_types> {dataoffset32} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!-- The 32bit version of 0x1C - UC_ADDSI -->
	</>
	<0x9D>
		<name> UC_PUSHS32 </>
		<asm_nmo> `pushs32\t%n1H` </>
		<asm_comment> `\t\t\t; %tc1` </>
		<ucs_nmo> `\"%t1\"` </>
		<num_bytes> 4 </>
		<param_types> {dataoffset32} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<!-- The 32bit version of 0x1D - UC_PUSHS -->
	</>
	<0x9F>
		<name> UC_PUSHI32 </>
		<asm_nmo> `pushi32\t%n1H` </>
		<asm_comment> `\t\t\t; %d1` </>
		<ucs_nmo> `(long)0x%1` </>
		<num_bytes> 4 </>
		<param_types> {long} </>
		<num_pop> 0 </>
		<num_push> 1 </>
		<!-- The 32bit version of 0x1F - UC_PUSHI -->
	</>
	<0xA4>
		<name> UC_CALL32 </>
		<asm_nmo> `call32\t%1` </>
		<asm_comment> `\t\t;` </>
		<ucs_nmo> `%f#1(%p,)` </>
		<num_bytes> 4 </>
		<param_types> {long} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<call_effect/>
		<!--
Calls the function specified by the 32-bit parameter.
		-->
	</>
	<0xAE>
		<name> UC_LOOP32 </>
		<asm_nmo> `initloop32` </>
		<asm_comment> `` </>
		<ucs_nmo> `//enum32()` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!-- The 32bit version of 0x2E - UC_LOOP -->
	</>
	<0xB1>
		<name> UC_DEFAULT32 </>
		<asm_nmo> `default32\t%1 %2` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `default(0x%1) attend label%f*_%2:` </>
		<num_bytes> 6 </>
		<param_types> {short,offset32} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<nosemicolon/>
		<!-- The 32bit version of 0x31 - UC_DEFAULT -->
	</>
	<0xBF>
		<name> UC_THROW </>
		<asm_nmo> `throw` </>
		<asm_comment> `` </>
		<ucs_nmo> `throw %p1` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 1 </>
		<num_push> 0 </>
		<return/>
		<!--
Pops the top most element off the stack, stores it in the return register.
Then shows any text in the string register, and exits the function immediately.
THROW also exits all calling functions, effectively stopping the usecode interpreter,
unless caught in a try/catch block.
		-->
	</>
	<0xC2>
		<name> UC_PUSHFVAR </>
		<asm_nmo> `pushfvar` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `gflags[%p1]` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 1 </>
		<num_push> 1 </>
		<!-- TODO: document -->
	</>
	<0xC3>
		<name> UC_POPFVAR </>
		<asm_nmo> `popfvar` </>
		<asm_comment> `\t\t;` </>
		<ucs_nmo> `gflags[%p1] = %p2` </>
		<num_bytes> 0 </>
		<param_types> {} </>
		<num_pop> 2 </>
		<num_push> 0 </>
		<!-- TODO: document -->
	</>
	<0xC7>
		<name> UC_CALLE32 </>
		<asm_nmo> `calle32\t%1H` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%p1-&gt;%f#1()` </>
		<num_bytes> 4 </>
		<param_types> {long} </>
		<num_pop> 1 </>
		<num_push> 0 </>
		<function_effect/>
		<!--
Calls the function (long) with "item" being equal to the
element at the top of the stack. It does not return a
value on the stack.

In c-style notation, if the topmost element of the stack
is AVATAR = -356, and function 0x261 (Func0261) is
being called, we would have AVATAR->Func0261() and
inside Func0261, "item" would be the avatar.
		-->
	</>
	<0xCD>
		<name> UC_DBGFUNC32 </>
		<asm_nmo> `dbgfunc32 %1 %2 ` </>
		<asm_comment> `; %t1` </>
		<ucs_nmo> `// Function: %t1 %2` </>
		<num_bytes> 6 </>
		<param_types> {short,dataoffset32} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<debug/>
		<not_param/>
		<!-- Debug opcode, 32-bit version -->
	</>
	<0xD4>
		<name> UC_CALLINDEX </>
		<asm_nmo> `callindex\t%1H` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `%p2-&gt;(*%p1)(%p+3)` </>
		<num_bytes> 1 </>
		<param_types> {byte} </>
		<num_pop> 0xBF </>
		<num_push> 0 </>
		<!--
Calls function pushed onto the stack.
		-->
	</>
	<0xDC>
		<name> UC_LOOPTOPS32 </>
		<asm_nmo> `staticloop32\t[%1], [%2], [%3], [%4], %5` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `for (%v3 in %vs4 with %v1 to %v2) attend label%f*_%5` </>
		<num_bytes> 12 </>
		<param_types> {short,short,short,varoffset,offset32} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<staticref/>
		<loop/>
		<!-- The 32bit version of 0x5C - UC_LOOPTOPS -->
	</>
	<0xDF>
		<name> UC_LOOPTOPTHV32 </>
		<asm_nmo> `clsvarloop32\t[%1], [%2], [%3], [%4], %5` </>
		<asm_comment> `\t\t\t;` </>
		<ucs_nmo> `for (%v3 in %vc4 with %v1 to %v2) attend label%f*_%5` </>
		<num_bytes> 12 </>
		<param_types> {short,short,short,varoffset,offset32} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<loop/>
		<!-- The 32bit version of 0x5F - UC_LOOPTOPTHV -->
	</>
	<0xE1>
		<name> UC_TRYSTART32 </>
		<asm_nmo> `starttry32\t%1` </>
		<asm_comment> `` </>
		<ucs_nmo> `try catch label%f*_%n1` </>
		<num_bytes> 4 </>
		<param_types> {offset32} </>
		<num_pop> 0 </>
		<num_push> 0 </>
		<!-- The 32bit version of 0x61 - UC_TRYSTART -->
	</>
	<0x101>
		<name> LABEL </>
		<asm_nmo> `(invalid)` </>
		<asm_comment> `` </>
		<ucs_nmo> `label%f*_%1` </>
		<num_bytes> 2 </>
		<param_types> {offset} </>
		<num_pop> 1 </>
		<num_push> 0 </>
		<indent_tmpdec/>
		<!--
Fake opcode -- for use with optimisations within ucxt
		-->
	</>
</>

