Debug migliore nell'assembler
This commit is contained in:
parent
ec1576e017
commit
9d1cadf7d4
@ -45,7 +45,6 @@ def to_uint8(data):
|
||||
return None
|
||||
|
||||
def to_uint16(data):
|
||||
print(data)
|
||||
alphanum = re.compile("^[0-9]+$")
|
||||
if isinstance(data, int):
|
||||
return struct.pack("<h", data)
|
||||
@ -65,7 +64,7 @@ def is_reg(data):
|
||||
|
||||
def assemble_code(line):
|
||||
global assembled
|
||||
sys.stdout.write("CODE:")
|
||||
sys.stdout.write("CODE: ")
|
||||
instruction = [x for x in re.split('\W', line) if x]
|
||||
op_name = instruction[0]
|
||||
|
||||
@ -73,13 +72,13 @@ def assemble_code(line):
|
||||
sys.stderr.write(
|
||||
"ERROR WHILE ASSEMBLING UNKNOWN OPERATION: {}\n".format(op_name))
|
||||
return False
|
||||
sys.stdout.write("{} {}\n".format(op_name, ", ".join(instruction[1::])))
|
||||
if op_name == "MOVI":
|
||||
op = ops[op_name]
|
||||
dst = instruction[1]
|
||||
if (is_reg(dst)):
|
||||
dst = to_uint8(regs[dst])
|
||||
src = to_uint16(instruction[2])
|
||||
print("SRC: {} | DST: {}".format(src, dst))
|
||||
else:
|
||||
sys.stderr.write(
|
||||
"ERROR WHILE ASSEMBLING UNKNOWN REGISTER: {}\n".format(dst))
|
||||
|
Loading…
Reference in New Issue
Block a user