Part 1 C-Instructions

This commit is contained in:
Sven Riwoldt
2024-04-07 20:42:19 +02:00
parent cde347910b
commit b8ecf50e63
2 changed files with 15 additions and 3 deletions

BIN
asm/Assembler.pdf Normal file

Binary file not shown.

View File

@@ -102,8 +102,20 @@ def searchSymbols(asm):
addtoSymboltable(line, i)
i = i+1
def ciinstruction():
c = "111"
def ciinstruction(ci):
c = "1110000000000000"
if ci.__contains__('='):
c2 = ci.split('=')
ic(c2)
#ic("Dest = ", ci[0], " Comp = ", ci[2])
return c +"\n"
#return '{0:016b}'.format(c)+"\n"
#return bin(c)[2:]+"\n" # 111 in binär --> falscher Weg
# dest = comp; jump
@@ -122,7 +134,7 @@ def createAsmFile():
f.write('{0:016b}'.format(symboltable[line]) + "\n")
else:
#M=D
f.write('1111111111111111\n')
f.write(ciinstruction(line))
f.close()