summaryrefslogtreecommitdiff
path: root/asmblr.py
diff options
context:
space:
mode:
authorMichael Abed <michael@pidgey.localdomain>2012-01-31 09:41:01 -0500
committerMichael Abed <michael@pidgey.localdomain>2012-01-31 09:41:01 -0500
commitc356b7a1848449b31278659e8b0df503881ed008 (patch)
treeb33a806c93ebe221a7cb1f7bcb68099fabf08e68 /asmblr.py
parent27d58baae806abab09941a9569a4c803cc3f708d (diff)
downloadec327-hw1-c356b7a1848449b31278659e8b0df503881ed008.tar.gz
ec327-hw1-c356b7a1848449b31278659e8b0df503881ed008.tar.bz2
ec327-hw1-c356b7a1848449b31278659e8b0df503881ed008.zip
correctly handle blank lines
Diffstat (limited to 'asmblr.py')
-rwxr-xr-xasmblr.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/asmblr.py b/asmblr.py
index ba2c89c..93dd097 100755
--- a/asmblr.py
+++ b/asmblr.py
@@ -4,7 +4,7 @@ import sys
def tokenize(i):
- if i[0] == ';': return None
+ if i[0] == ';' or i.strip() == '': return None
x = i.strip().split(' ')
if len(x) == 3 and ',' in x[1]:
x[1] = x[1].split(',')[0]
@@ -104,6 +104,7 @@ for i in prgm:
tokens = filter(None, tokens)
+
addresses = genaddresses(tokens)
code = gencode(tokens, addresses, opcodes)