summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2022-01-27 00:40:08 +0100
committerGustav Sörnäs <gustav@sornas.net>2022-01-27 00:40:08 +0100
commita42b91bd790eb134cf896d55616999628d690cc2 (patch)
treed2e948b7994c1335151ba07f618119eff09d3994
parent2c21d9d4723f29acdb16d963a934707cf7574de9 (diff)
downloadtsea83-a42b91bd790eb134cf896d55616999628d690cc2.tar.gz
syntax in ucode
-rw-r--r--lab1asm.py1
-rw-r--r--lab1ucode.in2
-rw-r--r--lab1ucode.out2
-rw-r--r--lab1ucode.py11
4 files changed, 8 insertions, 8 deletions
diff --git a/lab1asm.py b/lab1asm.py
index f6c7997..46dd3f6 100644
--- a/lab1asm.py
+++ b/lab1asm.py
@@ -72,6 +72,7 @@ def write(prog, labels):
print("PM:")
print(prog)
+ print("\n".join(["{}: {:02x}".format(*label) for label in labels.items()]), file=sys.stderr)
if __name__ == "__main__":
diff --git a/lab1ucode.in b/lab1ucode.in
index 26bcc7b..c3ad920 100644
--- a/lab1ucode.in
+++ b/lab1ucode.in
@@ -77,7 +77,7 @@ ar->pc, 0->upc
beq:
pc->ar
z=1? beq_yes
-bra beq_no
+b beq_no
beq_yes:
ar+'ir->ar
beq_no:
diff --git a/lab1ucode.out b/lab1ucode.out
index e28c060..e0fd79f 100644
--- a/lab1ucode.out
+++ b/lab1ucode.out
@@ -59,7 +59,7 @@ MyM:
39: 0000180
3a: 02c0000
3b: 000043d
-3c: 0000000
+3c: 000033e
3d: 1040000
3e: 0118000
3f: 0000180
diff --git a/lab1ucode.py b/lab1ucode.py
index 814ff4a..07b24f6 100644
--- a/lab1ucode.py
+++ b/lab1ucode.py
@@ -148,13 +148,12 @@ def compile(lines):
if hs == "0000000":
todo.append(inst)
- return ["{:02x}: {}".format(addr, line) for addr, line in linked], labels
- """
- todo:
- """
+ if todo:
+ print("todo", file=sys.stderr)
+ print("\n".join(todo), file=sys.stderr)
+ assert False
- print("todo")
- print("\n".join(todo))
+ return ["{:02x}: {}".format(addr, line) for addr, line in linked], labels
def write(prog, labels):