
--------------------------
mov <src>, <dest>
--------------------------
Moves data from <src> to <dest>

<src> can be a literal (string or number), a variable, or the test register

<dest> can be a variable, or the test register

Excluding the test register (which can accept all var types), the types of both
<src> and <dest> much match, however if <dest> is numeric, then any numeric type
(byte/int/long) can be used (byte clipping (at the high order end) will occur if
<dest> is a smaller numeric type than <src>)

Any specified variables will be created and initialised to either 0 (numeric) or
"" (string) if they don't already exist, before the mov instruction is carried out.

e.g.

mov 4, %size
mov "hi", %welcome$
mov %foo, %bar
mov %foo, tst
mov tst, %bar
mov 65535, %bytevar  <-- 
mov +%surname$, %names$[%counter]




--------------------------
arr <type>, <name>
--------------------------
Creates a single-dimension array called <name> of type <type> with a FIXED number of
elements. The number of elements is determined by a number inside square brackets
immediately following the array name. The array name should not start with the usual % as
this is only needed when you are refering to the actual variable, not its name.
For string arrays, each element will be initialised with "".  For numerical arrays,
each element will be initialised with 0.

e.g.

arr int, myarray[20]          <-- 20 elements, 0-19
arr str, my_string_array[4]   <-- 4 elements, 0-3
 



--------------------------
nam <var>, <name>
--------------------------
Gives variable <var> the name <name> for output in GUI.  Only variables who's name
has been set to anything other than "" will be displayed in the GUI. As in the mov
instruction, <var> will be created and initialised if it doesn't already exist.

e.g.

nam %myint, "Number of songs"
nam %myarray, "Track Names"
nam %myarray[0], "Track 1"



--------------------------
bra <label>
--------------------------
Will branch to the <label> specified.  Program execution will continue at the first
instruction after the label. (like a Basic GOTO command)

e.g.

   ...
   bra here
   ...
here:
   ...



--------------------------
jsr <label>
--------------------------
Will jump to the <label> specified and return to instruction immediately following it when
the rts instruction has been encountered (like a Basic GOSUB command).  Whatever value is
in the test register will be saved on calling the subroutine and restored when the rts
command is encountered.

e.g.

   ...
   jsr mysub
   ...
mysub:
   ...
   rts




--------------------------
rts
--------------------------
return from subroutine.  Execution continues at the instruction after the one that started
the subroutine.  The tst register will be restored to it's value before the subroutine call.




--------------------------
beq <value>, <label>
--------------------------
Will branch (GOTO) to the <label> specified if <value> exactly matches the value in the test register.
<value> can be a variable or a literal

e.g.

   mov %id, tst
   beq 255, error
   ...
error:
   ...



--------------------------
bne <value>, <label>
--------------------------
Will branch (GOTO) to the <label> specified if <value> doesn't exactly match the value in the test register.
<value> can be a variable or a literal

e.g.

   mov %id, tst
   bne 255, error
   ...
error:
   ...



--------------------------
jeq <value>, <label>
--------------------------
Will jump (GOSUB) to the <label> specified if <value> exactly matches the value in the test register (see jsr).
<value> can be a variable or a literal

e.g.

   mov %id, tst
   jeq 255, mysub
   ...
mysub:
   ...
   rts


--------------------------
jne <value>, <label>
--------------------------
Will jump (GOSUB) to the <label> specified if <value> doesn't exactly match the value in the test register (see jsr).
<value> can be a variable or a literal

e.g.

   mov %id, tst
   jne 255, mysub
   ...
mysub:
   ...
   rts




--------------------------
end
--------------------------
Terminates the script.  Whatever is in the %err$ variable will be returned.  An empty
%err$ variable signifies there was no error.

e.g.

mov "Invalid Header Type at byte 4", %err$
End



--------------------------
eeq <value>, <msg>
--------------------------
will end the program if <value> exactly matches the value in the test register.
<msg> is the error message to return.
<value> can be a variable or a literal

e.g.

   mov %id, tst
   eeq 255, "Invalid ID"



--------------------------
ene <value>[, <msg>]
--------------------------
will end the program if <value> doesn't exactly match the value in the test register.
<msg> is the error message to return (optional).  If <msg> is "", the %err$
variable will be returned instead.
<value> can be a variable or a literal

e.g.

   mov %id, tst
   eeq 255, "Invalid ID"
   
 
   
   
--------------------------
lon
--------------------------
Turns Little Endian ON for integer/long file reads.  Little Endian reads default to
OFF at the start of a program




--------------------------
lof
--------------------------
Turns Little Endian OFF for integer/long file reads.  Little Endian reads default to
OFF at the start of a program
   
   
   

--------------------------
rdb <var>
--------------------------
reads a byte into the variable <var>.  If <var> doesn't exist it will be created.
advances %fp by 1




--------------------------
rdi <var>
--------------------------
reads an integer (2 bytes) into the variable <var>.  If <var> doesn't exist it will be created.
This will use the Little endian flag to determine how the 2 bytes form the integer.
advances %fp by 2


--------------------------
rdl <var>
--------------------------
reads a long (4 bytes) into the variable <var>.  If <var> doesn't exist it will be created.
This will use the Little endian flag to determine how the 4 bytes form the long.
advances %fp by 4


--------------------------
rds <size>, <var>
--------------------------
reads <size> bytes from the file into the string variable <var>.  If <var> doesn't exist it
will be created.  As usual with string vars, you can use the + operator to prepend/append
to the string.

<size> can be a numeric variable or a numeric literal

If <size> is 0 then it will read from the file into the string variable until
the contents of tst are encountered in the file.  If tst contains a number, rds will read until
it finds a byte who's ascii value matches that of the low-order byte in tst.  If tst contains a
string, it will read until that string is found.  If tst contains an array, a compile error will
occur.

If the value specified in tst is not found,
rds will return 0 in the tst register, else it will return the number of bytes read.  The resulting
value in tst will be of type long.

The file pointer variable (%fp) will end up pointing to the first byte following the found string,
or it will not move at all if the string wasn't found.

e.g.

rds 4, %name$
rds %bytes, %buffer$
mov "findme", tst
rds 0, %a_string$
eeq 0, "string not found"



--------------------------
skp <value>
--------------------------
advances %fp by <value> bytes and ignores what it skipped past








still to sort out: -



inc <var>
increments <var>

dec <var>
decrements <var>

add <value/var>, <var>
adds <value/var> (value or variable) to <var>, result stored in var

sub <value/var>, <var>
subtracts <value/var> (value or variable) from <var>, result stored in var

mul <value/var>, <var>
multiplies <var> by <value/var> (value or variable), result stored in <var>

div <value>, <var>
divides <var> by <value/var> (value or variable), result stored in <var>

mod <value/var>, <var>
stores the modulus (remainder) of dividing <value/var> (value or variable) by <var>, result stored in <var>

and <value/var>, <var>
logical ANDs <var> and <value/var> (value or variable), result stored in <var>

or <value/var>, <var>
logical ORs <var> and <value/var> (value or variable), result stored in <var>

xor <value/var>, <var>
logical XORs <var> and <value/var> (value or variable), result stored in <var>

not <var>
logical NOT's <var>

als <value>, <var>
arithmetic left shifts <var> <value> times, puts 0 in lowest bit

ars <value>, <var>
arithmetic right shifts <var> <value> times, puts 0 in highest bit

rol <value>, <var>
rotate left <var> <value> times, puts highest bit in lowest bit

ror <value>, <var>
rotate right <var> <value> times, puts lowest bit in highest bit