16 bit instructions, variable length
each additional 16 bit value represents either a register or immediate value, any register indices are wrapped mod 32
32 total registers, incl. program counter, stack pointer, and disk index
index 0 is reserved for passing data in interrupts, pc, sp, and disk index are index 31, 30, and 29 respectively
16 bit address space for ram, dedicated vram accessed by separate instructions, also 64Kib, for a 256x256 B/W display
32 bit address space for disk, split into 64Kib blocks indexed by register - 4GB is definitely too much for a test project, but the capability can exist for the sake of it.
bits 1-4 determine the conditions upon which the command is executed
0xxx = flag 1 unchecked
x0xx = flag 2 unchecked
1x0x = flag 1 is 0
1x1x = flag 1 is 1
x1x0 = flag 2 is 0
x1x1 = flag 2 is 1
first 2 bits are activations, second 2 bits are conditions
bits 5-8 determine the instruction category
0000 = halt
0001 = arithmetic
0010 = logical
0011 = condition check
0100 = control flow
0101 = memory access
bits 9-14 determine the specific instruction
arithmetic: - 2 REG IN, 1 REG OUT on all
xx00 = addition
xx01 = subtraction
xx10 = multiplication
xx11 = division
x1xx = set flag 1 on overflow
1xxx = invert output
logical: - 2 REG IN, 1 REG OUT on all
xx00 = and
xx01 = or
xx10 = xor
x1xx = invert output
1xxx = set flag 2 if nonzero result
condition check: - 2 REG IN on all
0xxx = write to flag 1
1xxx = write to flag 2
x0xx = normal write
x1xx = inverted write
xx00 = equal
xx01 = greater than
xx10 = less than
control flow: - 1 REG IN
00x0 = static jump
00x1 = relative jump
0x1x = push pc before jump
01x0 = pop to pc - NO ADDITIONAL INPUTS
01x1 = interrupt (jump to 0) - NO ADDITIONAL INPUTS
1000 = enable interrupts - NO ADDITIONAL INPUTS
1001 = disable interrupts (default) - NO ADDITIONAL INPUTS
memory access: - 2 REG IN, TARGET REG, THEN ADDRESS REG
0000 = push - 1 REG IN
0001 = pop - 1 REG IN, NO IMMEDIATE
xx10 = store
xx11 = load - NO IMMEDIATE ON TARGET REG
001x = access RAM
011x = access DISK
101x = access VRAM
111x = serial port I/O
bits 15-16 determine input immediacy:
1x = 1st input (if used) is an immediate value
x1 = 2nd input (if used) is an immediate value