What makes instructions?
Code lines are inserted in Edit mode.
When a program is Running,the execution starts from Line 000, followed by 001, 002, ...
tip
Line jump instructions, either conditional or unconditional, are often used when concepts like IF statements and loops are needed.
The interface of Edit mode looks like:
In Edit mode,all elements in a code line are input in hexadecimal.
info
The concept of instruction and opcodes on the JoyKit were inspirated from Solaris x86 Assembly Language.
Line Numbers
There are in total 512 lines available in the system, numbering from 000 to 1FF in hexadecimal.
Attempting to edit or to show lines with corresponding numbers greater than 512 i.e. 0x200 will lead to a warning message on the display:
Primary Display
MAX Line Exceeded
Instrcutions
An instruction is a number with 1-byte long (i.e. 0-255, or 0x00-0xFF in hexadecimal), it belongs to one of the following categories:
- Execution
- Register Operation
- Plotting & Printing
- Communication
- Peripheral Operations
- Logic and Computation
Please refer to each link above for details.
Opcode and Sub-Opcode
Two 16-bit opcodes (OP) are defined as optional parameters for the instructions, and each of both can be further divided and treated as two 8-bit sub-opcodes (sOP).
OP-0 | OP-1 |
---|---|
sOP00 | sOP10 |
sOP01 | sOP11 |
The compositon of OPs and sOPs depends on the current instruction. Besides, OPs may represent different meanings in different instructions.
Some specific instructions do not need opcodes, for instance, end of program instruction 0F
, show background instruction 54
, the values of OPs will be ignored in these instructions.
caution
Sometimes the bits in an OP is interpreted bitwise, or values may not be considered as numbers.
INST_Delay
When using delay instruction 02
, OP-0 and OP-1 represent value and unit repectively.
INST_PROG_DELAY | No. | OP-0 | sOP10 | sOP11 |
---|---|---|---|---|
Delay 1000 ms | 02 | 03E8 | 00 | 00 |
02 03E8 0000
in which hexadecimal value 03E8
of OP-0 equals to 1000 in decimal,while OP-1 0000
determines unit of milliseconds.
INST_SET_LED_COLOUR
Another example is instrcution E4
for setting colours of the WS2812B full-colour LED.
E4 02FF 8000
Meaning that LED with index 02
is set to orange represented by FF8000
.
R | G | B |
---|---|---|
FF | 80 | 00 |
In this line, the sOP values are interpreted as below:
sOP00 | sOP01 | sOP10 | sOP11 |
---|---|---|---|
02 | FF | 80 | 00 |
Use Combo key →
+↺
️ to toggle top row of LCD1602 between showing decimals of single-byte (sOP) or double-byte (OP) SDR_switching。
tip
In the combo key description (such as →
+↺
️) in this document, the first key (→
) is pressed and held, and then the second key (↺
) is pressed.