-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpu
More file actions
53 lines (42 loc) · 932 Bytes
/
cpu
File metadata and controls
53 lines (42 loc) · 932 Bytes
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
47
48
49
50
51
52
[ this is how you do comments btw ] drop
[ dumb mapping of registers to make programming nicer ] drop
'r0 0 def
'r1 1 def
'r2 2 def
'r3 3 def
'r4 4 def
'r5 5 def
'r6 6 def
'r7 7 def
[ same with io ports ] drop
'io0 8 def
'io1 9 def
'io2 19 def
'io3 11 def
'io4 12 def
'io5 13 def
'io6 14 def
'io7 15 def
[ <address> <condition> branch ] drop
'branch [ 5 shift-left bitwise-or 1000_0000 bin bitwise-or emit ] def
'uncond 0 def
'cond> 1 def
'cond< 2 def
'cond= 3 def
'jmp [ uncond branch ] def
'br> [ cond> branch ] def
'br< [ cond< branch ] def
'br= [ cond= branch ] def
[ alu instructions ] drop
'alu-no-emit [ 4 shift-left bitwise-or ] def
'alu-op [ alu-no-emit emit ] def
'add [ 0 alu-op ] def
'sub [ 1 alu-op ] def
'rsub [ 2 alu-op ] def
'xor [ 3 alu-op ] def
'nor [ 4 alu-op ] def
'halt [ io0 5 alu-op ] def
'imm [ r0 5 alu-op emit r0 ] def
'cmp [ 6 alu-op ] def
'<-acc [ 7 alu-op ] def
'label [ buffer-pos def ] def