At least 2 versions of STK were made, I have called them STK-1 and STK-2. Syntax of both is more or less the same except for the LD and LDW command which are switched around:
STK can be used on a VIP with printer output and a hex keypad as input. This is the only pseudo language using 12 bit variables and 16 bit arithmetic functions.
V0-F are stored on memory locations 0780-079F, where V0 is stored on 0780-0781 and VF on 079E-079F.
This info is also available online on the Emma 02 site.
aaa | 12 bit address |
kk | 8 bit constant |
n | 4 bit constant |
x | Register number Vx (x = 0 to F) |
y | Register number Vy (y = 0 to F) |
[Vx] | Memory value of address in register Vx, in 'W' commands this is a 16 bit value where [Vx] is highest byte and [Vx+1] lowest |
[Vy] | Memory value of address in register Vy, in 'W' commands this is a 16 bit value where [Vy] is highest byte and [Vy+1] lowest |
. | Not used, value doesn't matter |
1..9, A..F | Hexadecimal digits |
5xkk | ADD | Vx, kk | Vx = Vx + kk |
7xkk | ADD | [Vx], kk | [Vx] = [Vx] + kk |
9x0y | ADDW | [Vx], [Vy] | [Vx] = [Vx] + [Vy], both [Vx] and [Vy] are 16 bit values |
2aaa | CALL | aaa | Call subroutine at aaa. The subroutine must end in RETURN |
9x4y | DIVW | [Vx], [Vy] | [Vx] = [Vx] / [Vy], [Vx] is a 16 bit values, [Vy] 8 bit |
Baaa | JP | aaa | Jump to address aaa |
Ex8. | KEY | [Vx] | Wait for a hex key, return value in [Vx] and send it to the printer |
Ax4y | LD | B, [Vy], [Vx] | Store 4 digit BCD value on [Vx] in [Vy]->[Vy+3] |
Ax2y | LD | H, [Vy], [Vx] | Store 16 bit hexadecimal of 4 digit BCD value of [Vx]->[Vx+3] in [Vy]->[Vy+1] |
Ax8y | LD | N, [Vy], [Vx] | Store 4 nibbles of [Vx]->[Vx+1] in [Vy]->[Vy+3], i.e. [Vy] = [Vx].n1, [Vy+1] = [Vx].n0, [Vy+2] = [Vx+1].n1, [Vy+3] = [Vx+1].n0 |
0aaa | LD | V0, aaa |
V0 = aaa |
3x.y | LD | Vy, Vx | Vy = Vx |
8xkk | LD | [Vx], kk | [Vx] = kk |
1x0y (STK-1) 1x8y (STK-2) |
LD | [Vy] , [Vx} | [Vx] = [Vy] |
1x8y (STK-1) 1x0y (STK-2) |
LDW | [Vy] , [Vx} | [Vx] = [Vy], both [Vx] and [Vy] are 16 bit values |
9x8y | MULW | [Vx], [Vy] | [Vx] = [Vx] * [Vy], [Vx] is a 16 bit values, [Vy] 8 bit |
Ex4. | [Vx] | Print character on [Vx] | |
Ex1. | A, [Vx] | Print ASCII value of lowest nibble on [Vx] | |
E.0n | n | Print character n | |
E.2n | 2n | Print character 2n | |
E.3n | 3n | Print character 3n | |
A.0. | RETURN | Return from subroutine | |
4... | RESET | Reset computer | |
Cxkk | SE | [Vx], kk | Skip next instruction if [Vx] = kk |
Dxkk | SNE | [Vx], kk | Skip next instruction if [Vx] != kk |
6xkk | SUB | [Vx], kk | [Vx] = [Vx] - kk |
9x2y | SUBW | [Vx], [Vy] | [Vx] = [Vx] - [Vy], both [Vx] and [Vy] are 16 bit values |
F... | SYS | Call CDP1801 at address following F... instruction, first byte needs to be 00, second is the address it will call. |