From 42477a07676e0d43646a8492a9f6cfc09ab005cd Mon Sep 17 00:00:00 2001 From: Jeff Connelly Date: Fri, 16 May 2008 17:04:46 -0700 Subject: [PATCH] Assembler: check instruction length for correct # and size of operands. For example, lwi's immediate operand is 2 trits. A label is 1 trit, so lwi on an address label will only generate 2 trits, and generate this error. --- asm/asm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/asm/asm.py b/asm/asm.py index 0cc65a3..d3c4811 100644 --- a/asm/asm.py +++ b/asm/asm.py @@ -129,11 +129,13 @@ def assemble(asmfile): literal_map.get(op))) if x is None: print "Bad register, label, or literal: %s" % (op, ) + print "Labels: %s" % (labels,) raise SystemExit else: machine_code.extend(x) - #print machine_code + assert len(machine_code) == 3, \ + "Incorrect operand count, instruction trits:: %s" % (machine_code,) tritstream.extend(machine_code) pc += 1 if pc > 3: -- 2.11.4.GIT