Common and Hidden Instructions in SHENZHEN I/O (Spoilers)

Basic instructions
-
nopDoes nothing. -
mov R/I RCopies the first operand into the second operand. -
jmp LJumps to the specified label and executes the next instruction. -
slp R/ISleeps for the number of time units specified by the operand. -
slx PSleeps until data can be read from the XBus pin specified by the operand.
Arithmetic Instructions
Registers can store integers from -999 to 999, inclusive. If an arithmetic operation produces a result outside this range, the system stores the nearest allowed value. For example, if acc is 800 and you execute add 400, the system stores 999 in acc.
-
add R/Iadds the first operand to the value in the acc register and stores the result in acc. -
sub R/Isubtracts the first operand from the value in the acc register and stores the result in acc. -
mul R/Imultiplies the first operand by the value in the acc register and stores the result in acc. -
notstores 100 in acc if acc is 0; otherwise, it stores 0 in acc. -
dgt R/Iextracts the digit specified by the operand from the acc register and stores the result in acc. -
dst R/I R/Iselects the digit in acc specified by the first operand and sets it to the value of the second operand.
Test Instructions
-
teq R/I R/Itests whether the first operand (A) equals the second operand (B). -
tgt R/I R/Itests whether the first operand (A) is greater than the second operand (B). -
tlt R/I R/Itests whether the first operand (A) is less than the second operand (B). -
tcp R/I R/Icompares the first operand (A) and the second operand (B).
Hidden Instructions
-
gen P R/I R/Igenerates a pulse. The first R/I specifies how long it stays on at 100, and the second R/I specifies how long it stays off at 0. -
@marks initialization code that runs only once.
Published 06/27/2019 · Krunk Zhou
Join the conversation