@@ -10,4 +10,113 @@ programing instructions are in assembly.py
10
10
## Video
11
11
<a href =" https://www.youtube.com/watch?v=WfuhbI8HE7s " target =" _blank " >![ ] ( ./images/video.png ) </a >
12
12
13
+ ## Usage
14
+ Open <a href =" http://golly.sourceforge.net/ " >Golly</a >: "Files>Run script.." select assembly.py.
15
+ ## Programming instructions
16
+ The pattern can be programmed to run your own algorithm by modifying the program variable in assembly.py
13
17
18
+ Variable names start by "a" followed by a number. eg a1 a2 a3 a10 are good variable names
19
+ a0 is used for storing the current program line, so be carefull, modifiying a0 will jump to the line a0
20
+ the instructions are:
21
+ ```
22
+ (let be n an integer in base 10)
23
+ write a1 n
24
+ -> write n to the variable a1 (written in 2's complement if signed)
25
+
26
+ goto n
27
+ -> go to the line n (first line is line 0)
28
+
29
+ move a1 a2
30
+ -> a1=a2
31
+
32
+ jump a1
33
+ -> jump the a1 next lines
34
+
35
+ print a1
36
+ -> print a1
37
+
38
+ disp a1 a2
39
+ -> draw a pixel of coordinates a1 a2
40
+
41
+ erase
42
+ -> erase the 2d display
43
+
44
+ rfb a1 a2
45
+ -> a1 = memory[a2] ; write the content of the address stored in a2 to a1; (if a2=N, a1=aN)
46
+
47
+ wfb a1 a2
48
+ -> memory[a2] = a1 ; write a1 to the address stored in a2; (if a2=N, aN=a1)
49
+
50
+ ++ a1 a2
51
+ -> a1=a2+1
52
+
53
+ - a1 a2 a3
54
+ -> a1 = a2-a3
55
+
56
+ + a1 a2 a3
57
+ -> a1 = a2+a3
58
+
59
+ or a1 a2 a3
60
+ -> a1=bitwiseOR(a2,a3)
61
+
62
+ and a1 a2 a3
63
+ -> a1=bitwiseAND(a2,a3)
64
+
65
+ xor a1 a2 a3
66
+ -> a1=bitwiseXOR(a2,a3)
67
+
68
+ not a1 a2
69
+ -> a1=bitwiseNOT(a2)
70
+
71
+ >> a1 a2
72
+ -> a1 = shift_right(a2)
73
+
74
+ << a1 a2
75
+ -> a1 = shift_left(a2)
76
+
77
+ rr a1 a2
78
+ -> a1 = rotate_right(a2)
79
+
80
+ rl a1 a2
81
+ -> a1 = rotate_left(a2)
82
+
83
+ =0 a1 a2
84
+ -> a1 = 1 if a2==0 else a1=0
85
+
86
+ !=0 a1 a2
87
+ -> a1 = 1 if a2!=0 else a1=0
88
+
89
+ less a1 a2
90
+ -> a1 = 1 if less_significant_bit(a2)==1 else a1=0
91
+
92
+ most a1 a2
93
+ -> a1 = 1 if most_significant_bit(a2)==1 else a1=0
94
+
95
+ *- a1 a2
96
+ -> a1 = -a2
97
+ ```
98
+
99
+ The wollowing example will print Fibonacci sequence:
100
+ ```
101
+
102
+ program = """
103
+ write a1 1
104
+ write a2 1
105
+ + a1 a1 a2
106
+ print a1
107
+ + a2 a1 a2
108
+ print a2
109
+ goto 2
110
+ """
111
+ ```
112
+
113
+
114
+ ## Screenshots
115
+
116
+ ![ ] ( ./images/computer.png )
117
+ ![ ] ( ./images/alu.png )
118
+ ![ ] ( ./images/adder.png )
119
+ ![ ] ( ./images/decoder.png )
120
+ ![ ] ( ./images/display.png )
121
+ ![ ] ( ./images/memory.png )
122
+ ![ ] ( ./images/output.png )
0 commit comments