Dateien hochladen nach „“
parent
1971a6f15e
commit
cc12a68bc0
|
@ -0,0 +1,255 @@
|
|||
0:0x10010000
|
||||
1:0x111
|
||||
2:0x10100000
|
||||
3:0x1000
|
||||
4:0x11000000
|
||||
5:0x1001
|
||||
6:0x11100001
|
||||
7:0x10
|
||||
8:0x11
|
||||
9:101
|
||||
10:0x10000000
|
||||
11:0x10000000
|
||||
12:0x10000000
|
||||
13:0x10000000
|
||||
14:0x10000000
|
||||
15:0x10000000
|
||||
16:0x10000000
|
||||
17:0x10000000
|
||||
18:0x10000000
|
||||
19:0x10000000
|
||||
20:0x10000000
|
||||
21:0x10000000
|
||||
22:0x10000000
|
||||
23:0x10000000
|
||||
24:0x10000000
|
||||
25:0x10000000
|
||||
26:0x10000000
|
||||
27:0x10000000
|
||||
28:0x10000000
|
||||
29:0x10000000
|
||||
30:0x10000000
|
||||
31:0x10000000
|
||||
32:0x10000000
|
||||
33:0x10000000
|
||||
34:0x10000000
|
||||
35:0x10000000
|
||||
36:0x10000000
|
||||
37:0x10000000
|
||||
38:0x10000000
|
||||
39:0x10000000
|
||||
40:0x10000000
|
||||
41:0x10000000
|
||||
42:0x10000000
|
||||
43:0x10000000
|
||||
44:0x10000000
|
||||
45:0x10000000
|
||||
46:0x10000000
|
||||
47:0x10000000
|
||||
48:0x10000000
|
||||
49:0x10000000
|
||||
50:0x10000000
|
||||
51:0x10000000
|
||||
52:0x10000000
|
||||
53:0x10000000
|
||||
54:0x10000000
|
||||
55:0x10000000
|
||||
56:0x10000000
|
||||
57:0x10000000
|
||||
58:0x10000000
|
||||
59:0x10000000
|
||||
60:0x10000000
|
||||
61:0x10000000
|
||||
62:0x10000000
|
||||
63:0x10000000
|
||||
64:0x10000000
|
||||
65:0x10000000
|
||||
66:0x10000000
|
||||
67:0x10000000
|
||||
68:0x10000000
|
||||
69:0x10000000
|
||||
70:0x10000000
|
||||
71:0x10000000
|
||||
72:0x10000000
|
||||
73:0x10000000
|
||||
74:0x10000000
|
||||
75:0x10000000
|
||||
76:0x10000000
|
||||
77:0x10000000
|
||||
78:0x10000000
|
||||
79:0x10000000
|
||||
80:0x10000000
|
||||
81:0x10000000
|
||||
82:0x10000000
|
||||
83:0x10000000
|
||||
84:0x10000000
|
||||
85:0x10000000
|
||||
86:0x10000000
|
||||
87:0x10000000
|
||||
88:0x10000000
|
||||
89:0x10000000
|
||||
90:0x10000000
|
||||
91:0x10000000
|
||||
92:0x10000000
|
||||
93:0x10000000
|
||||
94:0x10000000
|
||||
95:0x10000000
|
||||
96:0x10000000
|
||||
97:0x10000000
|
||||
98:0x10000000
|
||||
99:0x10000000
|
||||
100:0x10000000
|
||||
101:0x10000000
|
||||
102:0x10000000
|
||||
103:0x10000000
|
||||
104:0x10000000
|
||||
105:0x10000000
|
||||
106:0x10000000
|
||||
107:0x10000000
|
||||
108:0x10000000
|
||||
109:0x10000000
|
||||
110:0x10000000
|
||||
111:0x10000000
|
||||
112:0x10000000
|
||||
113:0x10000000
|
||||
114:0x10000000
|
||||
115:0x10000000
|
||||
116:0x10000000
|
||||
117:0x10000000
|
||||
118:0x10000000
|
||||
119:0x10000000
|
||||
120:0x10000000
|
||||
121:0x10000000
|
||||
122:0x10000000
|
||||
123:0x10000000
|
||||
124:0x10000000
|
||||
125:0x10000000
|
||||
126:0x10000000
|
||||
127:0x10000000
|
||||
128:0x10000000
|
||||
129:0x10000000
|
||||
130:0x10000000
|
||||
131:0x10000000
|
||||
132:0x10000000
|
||||
133:0x10000000
|
||||
134:0x10000000
|
||||
135:0x10000000
|
||||
136:0x10000000
|
||||
137:0x10000000
|
||||
138:0x10000000
|
||||
139:0x10000000
|
||||
140:0x10000000
|
||||
141:0x10000000
|
||||
142:0x10000000
|
||||
143:0x10000000
|
||||
144:0x10000000
|
||||
145:0x10000000
|
||||
146:0x10000000
|
||||
147:0x10000000
|
||||
148:0x10000000
|
||||
149:0x10000000
|
||||
150:0x10000000
|
||||
151:0x10000000
|
||||
152:0x10000000
|
||||
153:0x10000000
|
||||
154:0x10000000
|
||||
155:0x10000000
|
||||
156:0x10000000
|
||||
157:0x10000000
|
||||
158:0x10000000
|
||||
159:0x10000000
|
||||
160:0x10000000
|
||||
161:0x10000000
|
||||
162:0x10000000
|
||||
163:0x10000000
|
||||
164:0x10000000
|
||||
165:0x10000000
|
||||
166:0x10000000
|
||||
167:0x10000000
|
||||
168:0x10000000
|
||||
169:0x10000000
|
||||
170:0x10000000
|
||||
171:0x10000000
|
||||
172:0x10000000
|
||||
173:0x10000000
|
||||
174:0x10000000
|
||||
175:0x10000000
|
||||
176:0x10000000
|
||||
177:0x10000000
|
||||
178:0x10000000
|
||||
179:0x10000000
|
||||
180:0x10000000
|
||||
181:0x10000000
|
||||
182:0x10000000
|
||||
183:0x10000000
|
||||
184:0x10000000
|
||||
185:0x10000000
|
||||
186:0x10000000
|
||||
187:0x10000000
|
||||
188:0x10000000
|
||||
189:0x10000000
|
||||
190:0x10000000
|
||||
191:0x10000000
|
||||
192:0x10000000
|
||||
193:0x10000000
|
||||
194:0x10000000
|
||||
195:0x10000000
|
||||
196:0x10000000
|
||||
197:0x10000000
|
||||
198:0x10000000
|
||||
199:0x10000000
|
||||
200:0x10000000
|
||||
201:0x10000000
|
||||
202:0x10000000
|
||||
203:0x10000000
|
||||
204:0x10000000
|
||||
205:0x10000000
|
||||
206:0x10000000
|
||||
207:0x10000000
|
||||
208:0x10000000
|
||||
209:0x10000000
|
||||
210:0x10000000
|
||||
211:0x10000000
|
||||
212:0x10000000
|
||||
213:0x10000000
|
||||
214:0x10000000
|
||||
215:0x10000000
|
||||
216:0x10000000
|
||||
217:0x10000000
|
||||
218:0x10000000
|
||||
219:0x10000000
|
||||
220:0x10000000
|
||||
221:0x10000000
|
||||
222:0x10000000
|
||||
223:0x10000000
|
||||
224:0x10000000
|
||||
225:0x10000000
|
||||
226:0x10000000
|
||||
227:0x10000000
|
||||
228:0x10000000
|
||||
229:0x10000000
|
||||
230:0x10000000
|
||||
231:0x10000000
|
||||
232:0x10000000
|
||||
233:0x10000000
|
||||
234:0x10000000
|
||||
235:0x10000000
|
||||
236:0x10000000
|
||||
237:0x10000000
|
||||
238:0x10000000
|
||||
239:0x10000000
|
||||
240:0x10000000
|
||||
241:0x10000000
|
||||
242:0x10000000
|
||||
243:0x10000000
|
||||
244:0x10000000
|
||||
245:0x10000000
|
||||
246:0x10000000
|
||||
247:0x10000000
|
||||
248:0x10000000
|
||||
249:0x10000000
|
||||
250:0x10000000
|
||||
251:0x10000000
|
||||
252:0x10000000
|
||||
253:0x10000000
|
||||
254:0x10000000
|
|
@ -0,0 +1,10 @@
|
|||
load 111 to a
|
||||
|
||||
load 1000 to b
|
||||
|
||||
sto a+b to 1001
|
||||
|
||||
HALT
|
||||
num1
|
||||
num2
|
||||
sum
|
|
@ -0,0 +1,23 @@
|
|||
0x10000000 : NULL
|
||||
0x10010*** : load [add] to a
|
||||
0x10100*** : load [add] to b
|
||||
0x10110*** : load *[add] to a
|
||||
0x11111*** : load *[add] to b
|
||||
0x11010*** : sto a to [add]
|
||||
0x11100*** : sto b to [add]
|
||||
0x11110*** : sto a to *[add]
|
||||
0x10000*** : sto b to *[add]
|
||||
0x10001*** : sto a<<(b) to [add]
|
||||
0x10010*1* : sto a>>(b) to [add]
|
||||
0x10011*** : sto a and b to [add]
|
||||
0x10100*** : sto a or b to [add]
|
||||
0x10101*** : sto not(a) to [add]
|
||||
0x10110*** : sto a xor b to [add]
|
||||
0x10111*** : sto a<< to [add]
|
||||
0x11000*** : sto a+b to [add]
|
||||
0x11001*** : goto [cadd]
|
||||
0x11010*** : goto *[cadd]
|
||||
0x11011*** : if a=b goto [cadd]
|
||||
0x11100*** : if a>b goto [cadd]
|
||||
0x11101*** : if a<b goto [cadd]
|
||||
0x11100001: HALT
|
|
@ -0,0 +1,106 @@
|
|||
import ast
|
||||
def updateRAM(toupdate):
|
||||
temp = ""
|
||||
for i in toupdate:
|
||||
temp = temp + i + ":" + toupdate[i] + "\n"
|
||||
file = open("debugRAM", 'w')
|
||||
file.write(temp)
|
||||
file.close()
|
||||
RAM = open("RAM", 'r')
|
||||
RAM = RAM.read()
|
||||
if RAM == "":
|
||||
RAM = {}
|
||||
for i in range(int('11111111', 2)):
|
||||
RAM[str(i)] = "0x10000000"
|
||||
updateRAM(RAM)
|
||||
file = open("RAM", 'w')
|
||||
file.write(str(RAM))
|
||||
file.close()
|
||||
exit()
|
||||
else:
|
||||
RAM = ast.literal_eval(RAM)
|
||||
|
||||
|
||||
line = 0
|
||||
registera = "0x10000000"
|
||||
registerb = "0x10000000"
|
||||
while True:
|
||||
line = str(line)
|
||||
command = RAM[line]
|
||||
arg = RAM[str(int(line)+1)]
|
||||
arg = arg[1:]
|
||||
arg = arg[1:]
|
||||
line = int(line)
|
||||
line += 2
|
||||
line = str(line)
|
||||
print(command)
|
||||
if command == "0x10010000":
|
||||
registera = RAM[str(int(arg, 2))]
|
||||
elif command == "0x10100000":
|
||||
registerb = RAM[str(int(arg, 2))]
|
||||
elif command == "0x10110000":
|
||||
registera = RAM[str(int(RAM[str(int(arg, 2))], 2))]
|
||||
elif command == "0x11111000":
|
||||
registerb = RAM[str(int(RAM[str(int(arg, 2))], 2))]
|
||||
elif command == "0x11010000":
|
||||
RAM[str(int(arg, 2))] = registera
|
||||
elif command == "0x11100000":
|
||||
RAM[str(int(arg, 2))] = registerb
|
||||
elif command == "0x11110000":
|
||||
RAM[str(int(RAM[str(int(arg, 2))], 2))] = registera
|
||||
elif command == "0x10000000":
|
||||
RAM[str(int(RAM[str(int(arg, 2))], 2))] = registerb
|
||||
elif command == "0x10001000":
|
||||
registera = registerb
|
||||
RAM[str(int(arg, 2))] = registera
|
||||
elif command == "0x10010010":
|
||||
registerb = registera
|
||||
RAM[str(int(arg, 2))] = registera
|
||||
elif command == "0x10011000":
|
||||
if registera[0] == "1" and registerb[0] == "1":
|
||||
RAM[str(int(arg, 2))] = "1x10000000"
|
||||
else:
|
||||
RAM[str(int(arg, 2))] = "0x10000000"
|
||||
elif command == "0x10100000":
|
||||
if registera[0] == "1" or registerb[0] == "1":
|
||||
RAM[str(int(arg, 2))] = "1x10000000"
|
||||
else:
|
||||
RAM[str(int(arg, 2))] = "0x10000000"
|
||||
elif command == "0x10101000":
|
||||
if registera[0] == "1":
|
||||
RAM[str(int(arg, 2))] = "0x10000000"
|
||||
else:
|
||||
RAM[str(int(arg, 2))] = "1x10000000"
|
||||
elif command == "0x10110000":
|
||||
if (registera[0] == "0" and registerb[0] == "0") or (registera[0] == "1" and registerb[0] == "1"):
|
||||
RAM[str(int(arg, 2))] = "0x10000000"
|
||||
else:
|
||||
RAM[str(int(arg, 2))] = "1x10000000"
|
||||
elif command == "0x10111000":
|
||||
registera = RAM[str(int(arg, 2))]
|
||||
elif command == "0x11000000":
|
||||
RAM[str(int(arg, 2))] = bin(int(registera[2:], 2) + int(registerb[2:], 2))[2:]
|
||||
elif command == "0x11001000":
|
||||
line = int(arg, 2)
|
||||
elif command == "0x11010000":
|
||||
line = int(RAM[str(int(arg, 2))], 2)
|
||||
elif command == "0x11011000":
|
||||
if registera[0] == registerb[0]:
|
||||
line = int(arg, 2)
|
||||
elif command == "0x11100000":
|
||||
if registera[0] > registerb[0]:
|
||||
line = int(arg, 2)
|
||||
elif command == "0x11101000":
|
||||
if registera[0] < registerb[0]:
|
||||
line = int(arg, 2)
|
||||
elif command == "0x11100001":
|
||||
print()
|
||||
print("programm finished")
|
||||
updateRAM(RAM)
|
||||
exit()
|
||||
|
||||
updateRAM(RAM)
|
||||
|
||||
print()
|
||||
print("programm finished")
|
||||
updateRAM(RAM)
|
|
@ -0,0 +1,21 @@
|
|||
import ast
|
||||
file = open("RAM", 'r')
|
||||
file = file.read()
|
||||
file = ast.literal_eval(file)
|
||||
while True:
|
||||
temp = ""
|
||||
for i in file:
|
||||
temp = temp + i + ":" + file[i] + "\n"
|
||||
print(temp)
|
||||
addr = input("addresse: ")
|
||||
command = input("befehl: ")
|
||||
arg = input("argument: ")
|
||||
file[addr] = command
|
||||
file[str(int(addr)+1)] = arg
|
||||
if input("beenden?") == "y":
|
||||
break
|
||||
code = file
|
||||
|
||||
file = open("RAM", 'w')
|
||||
file.write(str(code))
|
||||
file.close()
|
Loading…
Reference in New Issue