Menu

Instructions

Csaba Skrabák

Instruction List

This is a complete list of imeight instructions. The descriptions are concise here, you may find details in the tutorials (appearing on the deployed development environment's web UI.)

Legend for the Arguments column below:

  • name is a name to define, see [Names]
  • label-ref is the name of a label that is placed before or after the reference
  • ref is a variable name or an element in an array; latter one referenced in the format, name(expr) where value of expr is the index; the array must exist when referenced; neither the variable nor the array element needs to be initialized
  • expr is evaluated; see [Expressions]
  • instruction is executed, see [Instructions]
  • brackets denote optional parts, ellipsis (...) means one or more repetitions
Instruction Arguments Byte Token Description
@ name place a label: points to the next non-remark instruction
END none 0 terminate program with STATUS 0 (normal)
FOR ref = expr TO expr [STEP expr] 1 start a loop with ref as the counter, specified inclusive range; default step is +1
NEXT [counter] 2 iterate or end the current (innermost) loop; programmer may clarify which loop they intend to iterate by adding the counter name
DATA expr, ... prepare data items (expressions) for READ
INPUT [expr,] ref 3 expect a line of input from user; assign to ref; expr is the prompt, by default "ENTER VALUE FOR " + the ref
DIM name([expr]) 4 define an array; expr evaluates but has no effect on the defined array, should document the designated size
READ ref 5 fetch a value from DATA items; may trigger evaluation of expressions in one DATA instruction (when there are no evaluated items left)
LET ref = expr 6 assign a value to a variable or to an array member
PUSH expr 7 push a value on the stack (the argument stack)
PULL ref 8 pull from the stack (the argument stack)
GOTO label-ref 9 continue running at a label
IF expr THEN instruction:..., up to the end of line 10 conditional instructions
THEN see IF 11 end of condition in an IF construct
_DEFER - 12 start of a DATA item list, evaluation of which is deferred until READ
RESTORE [label-ref] 13 set the data read pointer
GOSUB label-ref 14 call a subprogram (uses the argument stack)
RETURN [label-ref] 15 return from a subprogram (uses the argument stack)
REM text, up to the end of line 16 remark
STOP none 17 terminate the program with STATUS 1, keeping the program counter for CONT command; see [Commands]
ON expr GOTO/GOSUB/G. label-ref, ... 18 select continuation path based on a numeric value; last label-ref is default, others (1st, 2nd, and so on) are followed when integer part of expr is 1, 2, etc., respectively
WAIT none 19 sleep until next event: keystroke, clock tick or touch, whichever comes earlier
DEF name([ref, ...]) = expr define a function
_NAMELIST - 20 comma that separates by-reference arguments (see [Overloaded Operators])
_FN - 21 function definition, evaluation deferred until a function call
POKE expr, expr 22 write a byte (2nd expr value) into a memory register (1st)
PRINT expr 23 write string to the text layer
CLR none 24 clear all variables, functions, arrays; reset built-in variable values
GET ref 25 process an event: keystroke, clock tick or touch, whichever came earlier; assign numeric event code to ref
_LET ref = expr 26 assignment without an explicit LET instruction in the list
T. abbreviation of THEN
G. abbreviation of GOTO
N. abbreviation of NEXT
R. abbreviation of RETURN
W. abbreviation of WAIT
' abbreviation of REM; may appear after an instruction without a separating colon (:)

Listed Instruction vs Runner Instruction

The instructions with names starting with _ only appear in runner (the program array), not in textual program list.
On the other hand, DATA and DEF only appears in textual list of the program, not the program array of the runner.

Byte Tokens

The numbers that you can see in the JavaScript array program refer to instructions. See [Internals]

Other Keywords of the Language

Other than instructions, the imeight language also has:

  • expected keywords in the arguments of FOR instruction: TO, STEP
  • expected keywords in the arguments of ON instruction: GOTO, G., GOSUB
    • these words also appear as instructions outside ON, but after ON, they are considered arguments
  • these operators are made of letters rather than a sign character: MOD, AND, OR, XOR
  • built-in function, array and variable names: [Built-in Names]

Related

Wiki: Built-in Names
Wiki: Commands
Wiki: Expressions
Wiki: Hacks
Wiki: Home
Wiki: Instructions
Wiki: Internals
Wiki: Names
Wiki: Overloaded Operators

Discussion

Anonymous
Anonymous

Add attachments
Cancel