ABCDEFGHIJKLMNOPQRSTUVWXYZ
1
2
Core Instructions:
3
Op CodeOperand 1Operand 2Operand 3Full NameExplanationCommutative?Importance For Being Able to Run URCLGeneral Notes:
4
ADDRegisterRegisterRegisterAddAdd Op2 to Op3 then put result into Op1Yes for Ops 2 and 3Very HighOperands 1, 2 or 3 can be an immediate value if it makes sense.
5
RegisterRegisterImmediate or LabelYes for Ops 2 and 3Very HighBoth absolute addresses and addresses stored in registers are supported for memory. For branching relative addresses or labels must be used.
6
RegisterImmediate or LabelImmediate or LabelYes for Ops 2 and 3Highcyan = core, yellow = complex, red = special instructions, also cyan? = directives
7
Relative addresses will be denoted by a number with a + or - symbol prefixed, so +5 is 5 instructions ahead of the current.
8
SUBRegisterRegisterRegisterSubtractSubtract Op3 from Op2 then put result into Op1NoVery HighRegister zero (R0 or $0) is a register that cannot be written to and always reads zero when read from.
9
RegisterRegisterImmediate or LabelNoVery HighIf a cpu doesnt directly support the zero register then just replace it with a real register or an immediate value of zero.
10
RegisterImmediate or LabelRegisterNoVery HighThe flags are updated every ALU instruction. This includes bitwise logic, arithmetic, shifting, and compare. (I potentially forgot to mention something but close enough)
11
RegisterImmediate or LabelImmediate or LabelNoHighURCL code should use the .urcl file extention. However, .txt files will most likely still be supported.
12
The CPU word size must be specified in the .urcl file header along with the minimum number of registers, minimum amount of RAM and libraries that need to be imported.
13
RSHRegisterRegisterRight shiftRight shift Op2 once then put result into Op1NoVery HighPSH and POP refer to a generic global stack that is accessable anywhere in a program. This stack should not be used for long term storage of values.
14
RegisterImmediate or LabelNoVery HighCAL and RET use the call stack, which is seporate from the generic stack. The call stack can only be modified by CAL and RET.
15
If required, the program counter can be read from or written to just like any other general perpose register - however this should be avoided where possible to increase compatibility with simpler CPUs.
16
LSHRegisterRegisterLeft ShiftLeft shift Op2 once then put result into Op1NoVery HighAll complex instructions should be able to be emulated using appropriate core instructions, if a CPU does not support the instruction directly (no hardware multiplier for example).
17
RegisterImmediate or LabelNoVery HighAll core and complex instructions should not modify the source registers as well as any other registers outside of the registers specified by the operands in the instruction.
18
The generic stack can be used to store temporary/intermediate values for a function or instruction. However, those values must be POP-ed off after they have been used.
19
INCRegisterRegisterIncrementAdd 1 to Op2 then put result into Op1NoVery HighThe word length for all registers and memory are the same in URCL, so an 8 bit cpu must have 8 bit memory words ect. If this is not true in a specific cpu, then this has to be dealt with on an individual isa basis.
20
RegisterImmediate or LabelNoVery HighCommutative means that specific operands can be switched without affecting the instruction (usually Ops 2 and 3)
21
M or # should be used as the prefix for memory address values.
22
DECRegisterRegisterDecrementSubtract 1 from Op2 then put result into Op1NoVery HighAll directives, if used should be defined by the individual URCL interpreter. Only these few directives are defined explicitly because they are very common place
23
RegisterImmediate or LabelNoVery HighAll instructions are unsigned unless otherwise stated.
24
If there is a combination of operands that you need missing from this sheet then say something in #urcl-concerns in the URCL discord
25
XORRegisterRegisterRegisterBitwise XORBitwise XOR Op2 and Op3 then put result into Op1Yes for Ops 2 and 3High
26
RegisterRegisterImmediate or LabelYes for Ops 2 and 3High
27
RegisterImmediate or LabelImmediate or LabelYes for Ops 2 and 3Low
28
29
ANDRegisterRegisterRegisterBitwise ANDBitwise AND Op2 and Op3 then put result into Op1Yes for Ops 2 and 3Very High
30
RegisterRegisterImmediate or LabelYes for Ops 2 and 3Very High
31
RegisterImmediate or LabelImmediate or LabelYes for Ops 2 and 3High
32
33
ORRegisterRegisterRegisterBitwise ORBitwise OR Op2 and Op3 then put result into Op1Yes for Ops 2 and 3High
34
RegisterRegisterImmediate or LabelYes for Ops 2 and 3High
35
RegisterImmediate or LabelImmediate or LabelYes for Ops 2 and 3Low
36
37
NORRegisterRegisterRegisterBitwise NORBitwise NOR Op2 and Op3 then put result into Op1Yes for Ops 2 and 3High
38
RegisterRegisterImmediate or LabelYes for Ops 2 and 3High
39
RegisterImmediate or LabelImmediate or LabelYes for Ops 2 and 3Low
40
41
NANDRegisterRegisterRegisterBitwise NANDBitwise NAND Op2 and Op3 then put result into Op1Yes for Ops 2 and 3High
42
RegisterRegisterImmediate or LabelYes for Ops 2 and 3High
43
RegisterImmediate or LabelImmediate or LabelYes for Ops 2 and 3Low
44
45
XNORRegisterRegisterRegisterBitwise XNORBitwise XNOR Op2 and Op3 then put result into Op1Yes for Ops 2 and 3High
46
RegisterRegisterImmediate or LabelYes for Ops 2 and 3High
47
RegisterImmediate or LabelImmediate or LabelYes for Ops 2 and 3Low
48
49
NOTRegisterRegisterBitwise NOTBitwise NOT of Op2 then put result into Op1NoVery High
50
RegisterImmediate or LabelNoVery High
51
52
MOVRegisterRegisterMoveCopy Op2 to Op1, Op2 can be an immediate or registerNoVery High
53
54
IMMRegisterImmediate or LabelCopy Op2 to Op1, Op2 must be an immediateNoVery High
55
56
LODRegisterRAM Address or LabelLoadCopy RAM value pointed to by Op2 into Op1NoHigh<-- a label can only be used if the program is stored in ram that is accessable by the LOD instruction, otherwise labels cannot be used here
57
RegisterRegisterNoLow
58
59
STRRAM Address or LabelRegisterStoreCopy Op2 into RAM value pointed to by Op1NoHigh<-- a label can only be used if the program is stored in ram that is accessable by the STR instruction, otherwise labels cannot be used here
60
RegisterRegisterNoLow
61
RAM Address or LabelImmediate or LabelNoHigh<-- a label in the first operand can only be used if the program is stored in ram that is accessable by the STR instruction, otherwise labels cannot be used here
62
RegisterImmediate or LabelNoLow
63
64
BRARelative AddressBranch AlwaysBranch to address specified by Op1NoVery High
65
LabelNoVery High
66
RegisterNoHigh
67
68
BRCRelative AddressBranch if CarryBranch to address specified by Op1 if the previous instruction generated a carryNoHigh
69
LabelNoHigh
70
RegisterNoLow
71
72
BNCRelative AddressBranch if No CarryBranch to address specified by Op1 if the previous instruction did not generate a carryNoHigh
73
LabelNoHigh
74
RegisterNoLow
75
76
BRZRelative AddressBranch if ZeroBranch to address specified by Op1 if the result of the previous instruction is zeroNoHigh
77
LabelNoHigh
78
RegisterNoLow
79
80
BNZRelative AddressBranch if Not ZeroBranch to address specified by Op1 if the result of the previous instruction is not zeroNoHigh
81
LabelNoHigh
82
RegisterNoLow
83
84
BRNRelative AddressBranch if NegativeBranch to address specified by Op1 if the result of the previous instruction is negative (AKA the upper most bit is active)NoHigh
85
LabelNoHigh
86
RegisterNoLow
87
88
BRPRelative AddressBranch if PositiveBranch to address specified by Op1 if the result of the previous instruction is positive (AKA the upper most bit is not active)NoHigh
89
LabelNoHigh
90
RegisterNoLow
91
92
NOPNo OpDo nothingNoVery Low
93
94
HLTHaltStop ExecutionNoVery Low
95
96
97
Complex Instructions:
98
Op CodeOperand 1Operand 2Operand 3Full NameExplanationCommutative?Importance
99
MLTRegisterRegisterRegisterMultiplyMultiply Op2 by Op3 then put answer into Op1Yes for Ops 2 and 3High
100
RegisterRegisterImmediate or LabelYes for Ops 2 and 3High