mnemon.doc
mud++0.33/doc/vm/mnemon.doc · 7.6 KB
From the archive mud++0.33.tar.gz
Download the archive « Back to the archive contents
List of menmonic with arguments and explanation
---
aadd
aadd [u8/p24]
v2,v1 -> v1
Pops item from stack and add it to end of array v2. Array will be enlarged
if needed. Array pointer stays on stack.
Can be used only with array + item of type compatible to given array.
---
abort
abort [u8/p24]
(do not use stack)
Aborts VM with error code. Used internally to catch errors. Not for normal use.
---
add
add [u8/p24]
v2,v1 -> v1
Adds together two values from stack and put sum on stack. Sets flags as an option.
Can be used with ints or floats, but both items must be same type.
---
alen
alen [u8/p24]
v1 -> v1,v2
Returns length of array. Array stays on stack and is under length.
Can be used only with arrays.
---
apop
apop [u8/p24]
v3,v2,v1 -> v1
Pops value from stack into array at given index ( v3[v2] = v1; ).
Can be used with {array, int, object conforming to array type }
---
apush
apush [u8/p24]
v2,v1 -> v2,v1
Pushes value from array at given index to stack.
Can be used with {array, int}
---
cast2f
cast2f [u8/p24]
v1 -> v1
Casts int value to float.
Can be used only with int.
---
cast2i
cast2i [u8/p24]
v1 -> v1
Casts float value to int.
Can be used only with float.
---
clone
clone [u8/p24]
v1 -> v1, v2
Clones any object at stack, take care of all needed registrations.
Can be used with any item.
---
cmp
cmp [u8/p24]
v2,v1 -> v1
Compares two values and pop one. Always sets flags.
Can be used with ints or floats, but both items must be same type.
---
dec
dec [u8/p24]
v1 -> v1
Decreases value on stack by 1. Always sets flags.
Can be used with int or float.
---
decl
decl (u16 local_id) [u8/p8/u16]
(do not use stack)
Decreases value of local variable by 1. Always sets flags.
Can be used with int or float.
---
div
div [u8/p24]
v2,v1 -> v1
Divides v2 by v1 and put result on stack. Sets flags as an option.
Can be used with ints or floats, but both items must be same type.
---
eval
eval [u8/p24]
v1 -> v1
Checks if v1 is 0. Always sets flags. (same as: push(i/f)z; cmp;)
Can be used with int or float.
---
exit
exit (u8 exit_value) [u8/u8/p16]
(do not use stack)
Ends VM execution and sets exitCode to exit_value. (should we use ret ?)
---
fcall
fcall ((cond condition) (word name_of_fun)) [u8/u8/p16, s32]
(do not use stack)
Calls function written in mudasm if conditions are fullfilled. Leaves trace
so later ret will return to following instruction.
---
icall
icall ((cond condition) (word name_of_fun)) [u8/u8/p16,s32]
(do not use stack)
Leaves trace,calls interface function written in C and then collect trace.
It is possible that interface fun will modify trace stack actually allowing
to return to other point, or call some mudasm fun.
---
inc
inc [u8/p24]
v1 -> v1
Increases value on stack by 1. Optionally sets flags.
Can be used with int or float.
---
incl
incl (u16 local_id) [u8/p8/u16]
(do not use stack)
Increases value of local variable by 1. Optionally sets flags.
Can be used with int or float.
---
initl
initl (u16 number) [u8/p8/u16]
(do not use stack)
Allocates space for 'number' of additional local variables and fill them
with nulls.
---
initp
initp (u16 n ) [u8/p8/u16]
vn, vn-1, .., v2, v1 -> _
Allocates space for 'n' local variables and fill them with items from stack.
Top of stack will be local 0, next one local 1 and so on.
Should be used to initlialize arguments at start of function.
(same as: initl n; popl 0; popl 1; ..;popl n-2; popl n-1; )
Can be used with any types of items.
---
isnull
isnull [u8/p24]
v1 -> v1
Check if VMObject pointer at stack is null. Always sets flags.
Can be used only with VMObject.
---
mod
mod [u8/p24]
v2,v1 -> v1
Put v2 modulo v1 on stack. Optionally sets flags.
Can be used only with ints.
---
movc
movc ((local loc) (constant c) ) [u8/p8/u16] [s32]
(do not use stack)
Puts constant into local variable. Same as: pushc c; popl loc;
---
movf
movf ((local loc) (float f)) [u8/p8/u16] [float]
(do not use stack)
Put float value in given local variable. Same as: pushf f; popl loc;
---
movi
movi ((local loc) (int i)) [u8/p8/u16] [int]
(do not use stack)
Put int value in given local variable. Same as: pushi i; popl loc;
---
mpop
mpop (u8 number) [u8/u8/p16]
vn, vn-1, .., v2, v1 -> _
Pops 'number' of items from stack. (same as: pop; pop; pop; ...; pop; n times)
Can be used with any types of items.
---
mul
mul [u8/p24]
v2,v1 -> v1
Multipy v2 and v1 and puts result on stack.
Can be used with ints or floats, but both items must be same type.
---
nop
nop [u8/p24]
(do not use stack)
Do nothing.
---
ocmp
ocmp [u8/p24]
v2,v1 -> v1
Compares two VMObject pointers and pop one. Always sets flags.
Can be used only with VMObjects.
---
pop
pop [u8/p24]
v1 -> _
Pops one item from stack.
Can be used with any type of item.
---
popl
popl (u16 nlocal) [/u8/p8/u16]
v1 -> _
Pops item from stack and puts it into local variable number 'nlocal'.
Takes acre of dereferencing previous item.
Can be used with any type of item.
---
pushc
pushc ((constype type) (something val)) [u8/p24, s32]
_ -> v1
Pushes constant on stack. Most common use is pushing strings.
(ie. pushc string Hello world~ )
---
pushf
pushf (float val) [u8/p24, float]
_ -> v1
Pushes float value to stack.
---
pushfz
pushfz [u8/p24]
_ -> v1
Pushes float zero to stack. (same as: pushf 0;)
---
pushi
pushi (int val) [u8/p24, s32]
Pushes int value to stack.
---
pushiz
pushiz [u8/p24]
Pushes int zero to stack. (same as: pushi 0;)
---
pushl
pushl (u16 localn) [u8/p8/u16]
Pushes local number 'localn' to stack. Takes care of cloning refrence to
item.
Can be used with any type of item.
---
pushthis
pushthis [u8/p24]
_ -> v1
Pushes 'this' pointer to stack. For now it stands for pushl 0; but in
future it may change.
---
rcall
rcall (cond condtition) (word label_name) [u8/u8/s16]
(do not use stack)
Leaves trace and jumps to 'label_name'.
---
reducel
reducel (u16 number) [u8/p8/u16]
(do not use stack)
OBSOLETE.
Free allocated place for local variables and dereference them as needed.
'ret' do this automatically, it is obsolete now. I will delete it soon.
---
ret
ret [u8/p24]
(do not use stack)
Collects trace, returning to previous function.
Dereference local variables automatically.
---
rjmp
rjmp (cond condition) (word label) [u8/u8/s16]
(do not use stack)
Jumps to label.
---
scmp
scmp [u8/p24]
v1,v2 -> v1
Compares two strings and pops one. Case sensitive. Always sets flags.
Can be used only with strings.
---
sconcat
sconcat [u8/p24]
v1,v2 -> v1
Concatenates two strings and push resulting string on stack.
Can be used only with strings.
---
sfloatcat
sfloatcat [u8/p24]
v1,v2 -> v1
Concatenates float and string.
Can be used only with pair (string, float ).
---
sgetarg
sgetarg [u8/p24]
_ -> v1
Get next argument from current_args string.
---
sgetargrest
sgetargrest [u8/p24]
_ -> v1
Get all the rest of current_args string.
---
sintcat
sintcat [u8/p24]
v1,v2 -> v1
Concatenates int and string.
Can be used only with pair (string,int ).
---
sisempty
sisempty [u8/p24]
v1 -> v1
Checks if string on stack is empty (""). Always sets flags.
(same as: spushempty; scmp;)
Can be used only with string.
---
sisnumber
sisnumber [u8/p24]
v1 -> v1
Checks if string can be converted to int and sets flags accordingly.
Can be used only with string.
---
sstartargs
sstartargs [u8/p24]
v1 -> _
Initializes string from stack to be current_args.(later use sgetarg/sgetargrest)
Can be used only with string.
---
stoint
stoint [u8/p24]
v1 -> v1
Converts string to int.
Can be used only with string.
---
spushempty
spushempty [u8/p24]
_ -> v1
Push empty string to stack ("").
---
sub
sub [u8/p24]
v2,v1 -> v1
Substract v1 from v2 and put result to stack.
Can be used with ints or floats, but both items must be same type.
---
swap
swap [u8/p24]
v2,v1 -> v1,v2
Swaps v1 with v2.
Can be used for any types of item.