-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSPEC.txt
More file actions
46 lines (41 loc) · 1.53 KB
/
Copy pathSPEC.txt
File metadata and controls
46 lines (41 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
=== OVERVIEW ===
* 8-bit data width
* 8-bit addressing [SXMX] for a total of 256bytes of RAM (16bytes if SX left untouched)
=== ASSEMBLY ===
* Anything after a ";" is considered a comment, whether a line starts with it, or is in the middle of one
* A line of the form " @ ADDR VAL " stores that specific value at the specified address
* A line of the form " # ADDR " basically tells the assembler that the next instruction will be placed in that address
=== INSTRUCTIONS ===
0: NOP
1: LDA mem8 -> AX = [mem8]
2: ADD^ mem8 -> BX = [mem8], AX = AX + BX
3: SUB^ mem8 -> BX = [mem8], AX = AX - BX
4: JMP^ imm4 -> PC = imm4
5: JZ imm4 -> PC = imm4 if ZF = 1 else NOP
6: JC imm4 -> PC = imm4 if CF = 1 else NOP
7: LDS imm4 -> SX = imm4
8: RND -> AX = RND
9: STORE mem8 -> [mem8] = AX
A: JNI imm4 -> PC = imm4 if IF = 0 else NOP
B: READ^ -> AX = keyboard input
C: PRINT -> TTY = AX
D: CLS -> Clear TTY & Kb
E: NS -> PC = 0, SX++
F: HLT -> HALT
* mem8 - a reference (pointer) to an 8-bit (byte) value.
* imm4 - an immediate (i.e. included right in the instruction and thus invariable) 4-bit (byte) value.
^ these instructions load the (F)lags register
=== REGISTERS ===
AX: GP Register
BX: Arithmetics Register
MX: Memory address Register
SX: Segment register
PC: Program counter
RND: Random Number Generator(Read Only)
FR: Flag Register(LSB to MSB)
ZF: Zero Flag
CF: Carry Flag
IF: Input Flag
=== IO ===
TTY: Displays 7bit ASCII character
Keyboard: Sends 7bit ASCII character IF = 1 if buffer is non empty