Values supplied by the current test case.
Machine overview
The branch-capable GVM from the older GP design, with corrected jump and comparison behavior.
C[0] is input count; C[5] is output count; C[1..4] are 1, 0, −1, and 2.
Hold counters and indirect indexes.
Working values, arithmetic, comparisons, and copies.
SET copies a memory value directly to output.
Branches count LBL markers forward or backward.
Data flow
Registers select input, memory, and output positions.
M[R[b]] ← I[R[a]]
Invalid or non-integer indexes are rejected rather than wrapped.
O[R[b]] ← M[R[a]]
The older branch VM copies the floating value directly; it does not round.
Indirect addressing
The operands name registers; the register contents name data cells.
If R[2] contains 1, the source is I[1].
If R[5] contains 3, the destination is M[3].
GET copies I[1] into M[3].
| Instruction | Meaning |
|---|---|
LDC c,r | R[r] ← C[c] |
R2R a,b | R[b] ← R[a] |
M2M a,b | M[R[b]] ← M[R[a]] |
ADD a,b | M[R[b]] ← M[R[b]] + M[R[a]] |
Instruction explorer
Select an opcode to see its corrected behavior.
Loads one of the five machine constants into a register.
R[r] ← C[c]
Conditional branching
Branches use signed relative label counts, not encoded bytes or raw line offsets.
if M[R[a]] > M[R[b]] → LBL j
Corrected to compare the data values selected by the registers, making input-dependent decisions possible.
if M[R[a]] ≤ M[R[b]] → LBL j
Branches when the selected memory values are already in non-descending order.
if R[a] ≠ 0 → LBL j
Useful for register counters and loops.
always → LBL j
An unconditional branch.
Execution rules
Reset, run, and stop behavior.
Set C[0] to the current input count, C[5] to the current output count, and C[1..4] to 1, 0, −1, and 2.
Clear all registers, memory, output, violations, and the instruction count.
Scan the program and record every LBL position.
Begin at instruction zero and execute until EOL, invalid branch, or 10,000 instructions.
Breakpoints pause before the selected instruction executes.
| Stop reason | Meaning |
|---|---|
| EOL | The instruction pointer passed the final program instruction. |
| INVALID BRANCH | The requested forward/backward label does not exist. |
| MAX EXECUTION | The program reached the 10,000-instruction safety limit. |
| BREAKPOINT | The IDE paused before executing a marked line. |
Conditional maximum example
Write the larger of two input values to O[0] without a swap instruction.
0 CLR 0 1 CLR 1 2 GET 0,0 3 INC 0 4 INC 1 5 GET 0,1 6 DEC 0 7 BLE 0,1,+1 8 BR +2 9 LBL 10 M2M 1,0 11 BR +1 12 LBL 13 SET 0,0 14 EOL
Load the two inputs into M[0] and M[1].
If M[0] is less than or equal to M[1], branch to the copy path.
Copy M[1] into M[0] only when the second input is larger.
Write the selected maximum value to O[0].