START_CLASSIFIED_TRANSMISSION
TITLE: dcpu specs, classified, not final
TO: redacted
DATE: 20120328
VERSION: 4
16 bit architecture
0x10000 words of ram (128kb)
8 registers (A, B, C, X, Y, Z, I, J)
program counter
(PC)
stack pointer (SP)
overflow (O)
all values are 16 bit unsigned and are set to 0 on startup
opcodes, 16bits: bbbbbbaaaaaaoooo
oooo: - all values are stored in a
0: -RESERVED-
1: SET a, b - sets value of b to a
2: ADD a, b - adds b to
a, sets O
3: SUB a, b - subtracts b from a, sets O
4: MUL a, b - multiplies a by b, sets O
5: DIV a, b -
divides a by b, sets O
6: MOD a, b - remainder of a over b
7: SHL a, b - shifts a left b places, sets O
8:
SHR a, b - shifts a right b places, sets O
9: AND a, b - binary and of a and b
10: BOR a, b - binary or of a
and b
11: XOR a, b - binary xor of a and b
12: IFE a, b - skips one instruction if a!=b
13: IFN a, b -
skips one instruction if a==b
14: IFG a, b - skips one instruction if a<=b
15: IFB a, b - skips one
instruction if (a&b)==0
aaaaaa, bbbbbb: - brackets = memory lookup of value
0-7: register value - register values
8-15: [register
value] - value at address in registries
16-23: [next word of ram + register value] - memory address offset by
register value
24: POP - value at stack address, then increases stack counter
25: PEEK - value at stack
address
26: PUSH - decreases stack address, then value at stack address
27: SP - current stack pointer value -
current stack address
28: PC - program counter - current program counter
29: O - overflow - current value of
the overflow
30: [next word of ram] - memory address
31: next word of ram - literal, does nothing on
assign
32-63: literal value 0-31 - literal, does nothing on assign
assembler example: http://pastebin.com/raw.php?i=qb7k8fNa
END_CLASSIFIED_TRANSMISSION