Author: Samuele Bonini
Instruction counter (IC): contains the index of the current instruction being executed. Normally, after an instruction is executed, the value of IC is increased by 1. Jump instructions such as
goto can alter the content of this register and hence change the logical flow of the program.
Supported registers: D-Risc assembly allows the use of 64 registers, zero-indexed. To access a register, use R + the number of the register, as in
R1. Symbolic register names, like
Rbase, are not supported yet.
Spacing and parameter rules: only one instruction is allowed per line. Parameters must be separated by a comma. The last parameter must not be followed by any comma or other text, except for comments (see below). Valid example:
load r1, r2, r3.
Labels: a label is a short alpha-numerical string followed by a colon, which identifies a line of code. It can be used for jumps, or to describe what a section of the program does (much like a function name). A valid label is, for example,
label:. You can only put labels at the beginning of a line. Valid example:
loop: clear r1.
Comments: you can comment your code by adding a semi-colon at the end of an instruction, or on a line of its own, followed by your comment. For example:
add r1, r2, r3 ;this adds r1 to r2 and puts the result in r3.
Below you can find the full list of supported instructions, alongside their syntax and semantics.
|Instruction||Parameter 1||Parameter 2||Parameter 3||Semantics|
reg = reg + reg
reg = reg + const
reg = reg - reg
reg = reg - const
reg = reg * reg
reg = reg * const
reg = reg / reg
reg = reg / const
reg = 0
reg = reg
reg = const
reg = mem[r + r]
reg = mem[r + const]
mem[r + r] = reg
mem[r + const] = reg
ic = label
Supported: if<, if<=,
if>, if>=, if=, if!=
if(reg condition reg) then ic = label
Supported: if<0, if<=0,
if>0, if>=0, if=0, if!=0
if(reg condition 0) then ic = label
The program found on this page is still in beta mode. This means that you might encounter bugs during its use. If you do, please contact me to report them.
Note: this program has compatibility issues with most mobile phone browsers, and hence will not work properly on a phone. Please only use this tool on a computer browser.
load rbase, rindex, rtemp
SETMEMinstruction that allows to directly manipulate the content of a memory location
Delay in-between instructions: ms
Used memory locations
Previously unused memory locations are initialized to a random value if loaded into a register.