Opcode Playground

Instructions

OpcodeMnemonicEffect
00 BEL Play a tone; the frequency is derived from A
01 NOP Do nothing
02 SWAP Exchange contents of DP and Accumulator
05 NUM Display value in A as decimal number
06 NUMX Display value in A as hexdecimal number
07 JMP (arg) Unconditional jump; next byte is loaded into IP
08 CHAR Print ASCII char based on A
09 NEG Sets A to (256 - A)
10 SETA (arg) Set A to next value after this instruction
11 SETP (arg) Set DP to next value after this instruction
14 ADDA (arg) Adds next value after this instruction to A
15 ADDP (arg) Adds next value after this instruction to DP
16 SUBA (arg) Subtracts next value after this instruction from A
17 SUBP (arg) Subtracts next value after this instruction from DP
20 LOADA [arg] Load value from specified memory location into A
21 LOADP [arg] Load value from specified memory location into DP
22 STORA [arg] Store contents of A into specified memory location
23 STORP [arg] Store contents of DP into specified memory location
24 LADDA [arg] Adds value from specified memory location to A
25 LADDP [arg] Adds value from specified memory location to DP
26 LSUBA [arg] Subtracts value at specified memory location from A
27 LSUBP [arg] Subtracts value at specified memory location from DP
40 GET Get value from location specified by DP into A
42 PUT Put contents of A into location specified by DP
44 GADD Get value from location specified by DP and add to A
46 GSUB Get value from location specified by DP and subtract from A
70 JZ (arg) Jump if A is zero; otherwise continue as usual
71 JNZ (arg) Jump if A is not zero; otherwise continue as usual
74 JZP (arg) Jump if 0 or positive (0 <= A < 128); otherwise continue as usual
75 JP (arg) Jump if positive (1 <= A < 128); otherwise continue as usual
94 INCA Add 1 to A
95 INCP Add 1 to DP
96 DECA Subtract 1 from A
97 DECP Subtract 1 from DP

All other opcodes are equivalent to HLT (the halt instruction which stops the processor).

OpcodePlayground Board

Instr. Speed


Jump Speed


Program output:

Quick Reference Table

0x1x2x4x7x9xpattern
x0BELSETA ()LOADA []GETJZ () (load into A)
x1NOPSETP ()LOADP []JNZ () (load into P)
x2SWAPSTORA []PUT (write A to mem)
x3STORP [] (write P to mem)
x4ADDA ()LADDA []GADDJZP ()INCA (add to A)
x5NUMADDP ()LADDP []JP ()INCP (add to P)
x6NUMXSUBA ()LSUBA []GSUBDECA (subtract from A)
x7JMP ()SUBP ()LSUBP []DECP (subtract from P)
x8CHAR
x9NEG