Skip to content

Toon Syntax Reference

Cabintech edited this page Nov 21, 2024 · 45 revisions
Statement Syntax Examples Comments
Register to Register Copy Statements
<target> = <source> R2 = MR102
R0 = SWITCH
Copy between CR, MR, and SFR.
Supported combinations
  • CR = CR
  • CR = MR
  • CR = SFR
  • MR = CR
  • SFR = CR
<targetCR> = (<sourceCR>) R0 = (R4) Indirect addressing of MR by source register (cpy_cmx instruction)
<cr> = ACC64.U
<cr> = ACC64.L
ACC64.U = <cr>
ACC64.L = <cr>
r4 = acc64.u Copy upper/lower 32 bits of ACC64 to/from a CR
Delay Memory Load/Store
ACC32 = <op1> <instr> <op2> acc32 = acc32 xor r5
acc32 = r5 addi 0x05
Supported instructions
  • ADDI
  • ADD
  • ADDS
  • ADDSI
32 Bit Math Operations
ACC32 = <op1> <instr> <op2> acc32 = acc32 xor r5
acc32 = r5 addi 0x05
Supported instructions
  • ADDI
  • ADD
  • ADDS
  • ADDSI
  • SUB
  • SUBS
  • SL
  • SLR
  • SLS
  • SLSR
  • SR
  • SRR
  • SRA
  • SRAR
  • MULTRR
  • MULTRI
ACC32 = <instr> <cr> acc32 = neg R6 Supported instructions
  • INV
  • ABS
  • NEG
  • LOG2
  • EXP2
64 Bit Accumulating Math Operations
ACC64 += <op1> <instr> <op2> acc64 += R0 macrr R1
acc64 += R8 machri -0.7
Supported instructions
  • MACRR
  • MACRI
  • MACRD
  • MACID
  • MACHRR
  • MACHRI
  • MACHRD
  • MACHID
Bitwise Operations
acc32 = <op1> <instr> <op2> acc32 = R0 xor R1
acc32 = R8 andi 0x0400
Supported instructions
  • OR
  • ORI
  • AND
  • ANDI
  • XOR
  • XORI
Conditional Branching
IF <cr> <cond> [GOTO] <label> if r7 >=0 goto mylabel
if acc32 neg mylabel
if r0 nz goto mylabel
GOTO keyword is optional
Supported conditions and [synonyms]
  • =0 [z] [jz]
  • <>0 [nz] [jnz]
  • >=0 [gez] [jgez]
  • <0 [neg] [jneg]
  • !=acc32.sign [zc] [jzc]
JMP <label>
GOTO <label>
goto mylabel Unconditional branch.
JMP and GOTO are synonyms.

}

Clone this wiki locally