Line 266... |
Line 266... |
|
|
will successively push the values 0x10, 0x20, and the character 'x' onto the
|
will successively push the values 0x10, 0x20, and the character 'x' onto the
|
data stack. The character 'x' will be at the top of the data stack after these
|
data stack. The character 'x' will be at the top of the data stack after these
|
3 instructions.
|
3 instructions.
|
|
|
See the COMPUTED VALUES section for using computing values in the assembler.
|
Numeric values can be represented in binary, octal, decimal, and hex. Binary
|
|
values start with the two characters "0b" followed by a sequence of binary
|
|
digits; octal numbers start with a "0" followed by a sequence of octal digits;
|
|
decimal values can start with a "+" or "-" have a non-zero first digit and have
|
|
zero or more decimal digits; and hex values start with the two characters "0X"
|
|
followed by a sequence of hex digits.
|
|
|
|
Examples of equivalent numeric values are:
|
|
binary: 0b01 0b10010
|
|
octal: 01 022
|
|
decimal: 1 18
|
|
hex: 0x1 0x12
|
|
|
|
See the COMPUTED VALUES section for using computed values in the assembler.
|
|
|
There are four ways to specify strings in the assembler. Simply stating the
|
There are four ways to specify strings in the assembler. Simply stating the
|
string
|
string
|
|
|
"Hello World!"
|
"Hello World!"
|
Line 867... |
Line 880... |
to clear the entire memory, etc.
|
to clear the entire memory, etc.
|
|
|
The available single-cycle memory operation macros are:
|
The available single-cycle memory operation macros are:
|
.fetch(mem_name) replaces T with the value at the address T in the memory
|
.fetch(mem_name) replaces T with the value at the address T in the memory
|
mem_name
|
mem_name
|
|
Note: .fetchram(var_name) is safer.
|
.fetch+(mem_name) pushes the value at address T in the memory mem_name
|
.fetch+(mem_name) pushes the value at address T in the memory mem_name
|
into the data stack below T and increments T
|
into the data stack below T and increments T
|
Note: This is useful for fetching successive values
|
Note: This is useful for fetching successive values
|
from memory into the data stack.
|
from memory into the data stack.
|
|
Note: .fetchram+(var_name) is safer.
|
.fetch-(mem_name) similar to .fetch+ but decrements T
|
.fetch-(mem_name) similar to .fetch+ but decrements T
|
|
Note: .fetchram-(var_name) is safer.
|
.store(ram_name) stores N at address T in the RAM ram_name, also drops
|
.store(ram_name) stores N at address T in the RAM ram_name, also drops
|
the top of the data stack
|
the top of the data stack
|
|
Note: .storeram(var_name) is safer.
|
.store+(ram_name) stores N at address T in the RAM ram_name, also drops N
|
.store+(ram_name) stores N at address T in the RAM ram_name, also drops N
|
from the data stack and increments T
|
from the data stack and increments T
|
|
Note: .storeram+(var_name) is safer.
|
.store-(ram_name) similar to .store+ but decrements T
|
.store-(ram_name) similar to .store+ but decrements T
|
|
Note: .storeram-(var_name) is safer.
|
|
|
The following multi-cycle macros provide more generalized access to the
|
The following multi-cycle macros provide more generalized access to the
|
memories:
|
memories:
|
.fetchvalue(var_name) fetches the single-byte value of var_name
|
|
Note: This is equivalent to "var_name .fetch(mem_name)"
|
|
where mem_name is the memory in which var_name is
|
|
stored.
|
|
.fetchindexed(var_name)
|
.fetchindexed(var_name)
|
uses the top of the data stack as an index into var_name
|
uses the top of the data stack as an index into var_name
|
Note: This is equivalent to the 3 instruction sequence
|
Note: This is equivalent to the 3 instruction sequence
|
"var_name + .fetch(mem_name)"
|
"var_name + .fetch(mem_name)"
|
.fetchoffset(var_name,offset)
|
.fetchoffset(var_name,offset)
|
fetches the single-byte value of var_name offset by
|
fetches the single-byte value of var_name offset by
|
"offset" bytes
|
"offset" bytes
|
Note: This is equivalent to
|
Note: This is equivalent to
|
"${var_name+offset} .fetch(mem_name)"
|
"${var_name+offset} .fetch(mem_name)"
|
|
.fetchram(var_name) is similar to the .fetch(mem_name) macro except that the
|
|
variable name is used to identify the memory instead of
|
|
the name of the memory
|
|
.fetchram+(var_name) is similar to the .fetch+(mem_name) macro except that
|
|
the variable name is used to identify the memory instead
|
|
of the name of the memory
|
|
.fetchram-(var_name) is similar to the .fetch-(mem_name) macro except that the
|
|
the variable name is used to identify the memory instead
|
|
of the name of the memory
|
|
.fetchvalue(var_name) fetches the single-byte value of var_name
|
|
Note: This is equivalent to "var_name .fetch(mem_name)"
|
|
where mem_name is the memory in which var_name is
|
|
stored.
|
|
.fetchvalueoffset(var_name,offset)
|
|
fetches the single-byte value stored at var_name+offset
|
|
Note: This is equivalent to
|
|
"${var_name+offset}" .fetch(mem_name)
|
|
where mem_name is the memory in which var_name is
|
|
stored.
|
.fetchvector(var_name,N)
|
.fetchvector(var_name,N)
|
fetches N values starting at var_name into the data
|
fetches N values starting at var_name into the data
|
stack with the value at var_name at the top and the
|
stack with the value at var_name at the top and the
|
value at var_name+N-1 deep in the stack.
|
value at var_name+N-1 deep in the stack.
|
Note: This is equivalent N+1 operation sequence
|
Note: This is equivalent N+1 operation sequence
|
"${var_name+N-1} .fetch-(mem_name) ...
|
"${var_name+N-1} .fetch-(mem_name) ...
|
.fetch-(mem_name) .fetch(mem_name)"
|
.fetch-(mem_name) .fetch(mem_name)"
|
where ".fetch-(mem_name)" is repeated N-1 times.
|
where ".fetch-(mem_name)" is repeated N-1 times.
|
.storevalue(var_name) stores the single-byte value at the top of the data
|
|
stack at var_name
|
|
Note: This is equivalent to
|
|
"var_name .store(mem_name) drop"
|
|
Note: The default "drop" instruction can be replaced by
|
|
providing the optional second argument. For
|
|
example, the following instruction will store and
|
|
then decrement the value at the top of the data
|
|
stack:
|
|
.storevalue(var_name,1-)
|
|
.storeindexed(var_name)
|
.storeindexed(var_name)
|
uses the top of the data stack as an index into var_name
|
uses the top of the data stack as an index into var_name
|
into which to store the next-to-top of the data stack.
|
into which to store the next-to-top of the data stack.
|
Note: This is equivalent to the 4 instruction sequence
|
Note: This is equivalent to the 4 instruction sequence
|
"var_name + .store(mem_name) drop".
|
"var_name + .store(mem_name) drop".
|
Line 926... |
Line 950... |
stack at var_name offset by "offset" bytes
|
stack at var_name offset by "offset" bytes
|
Note: This is equivalent to
|
Note: This is equivalent to
|
"${var_name+offset} .store(mem_name) drop"
|
"${var_name+offset} .store(mem_name) drop"
|
Note: The optional third argument is as per the
|
Note: The optional third argument is as per the
|
optional second argument of .storevalue
|
optional second argument of .storevalue
|
|
.storeram(var_name) is similar to the .store(mem_name) macro except that the
|
|
variable name is used to identify the RAM instead of the
|
|
name of the RAM
|
|
.storeram+(var_name) is similar to the .store+(mem_name) macro except that
|
|
the variable name is used to identify the RAM instead of
|
|
the name of the RAM
|
|
.storeram-(var_name) is similar to the .store-(mem_name) macro except that
|
|
the variable name is used to identify the RAM instead of
|
|
the name of the RAM
|
|
.storevalue(var_name) stores the single-byte value at the top of the data
|
|
stack at var_name
|
|
Note: This is equivalent to
|
|
"var_name .store(mem_name) drop"
|
|
Note: The default "drop" instruction can be replaced by
|
|
providing the optional second argument. For
|
|
example, the following instruction will store and
|
|
then decrement the value at the top of the data
|
|
stack:
|
|
.storevalue(var_name,1-)
|
.storevector(var_name,N)
|
.storevector(var_name,N)
|
Does the reverse of the .fetchvector macro.
|
Does the reverse of the .fetchvector macro.
|
Note: This is equivalent to the N+2 operation sequence
|
Note: This is equivalent to the N+2 operation sequence
|
"var_name .store+(mem_name) ... .store+(mem_name)
|
"var_name .store+(mem_name) ... .store+(mem_name)
|
.store(mem_name) drop"
|
.store(mem_name) drop"
|