changeset 8:81dd03d17c22

first_pass() didn't need a pc
author james <jb302@eecs.qmul.ac.uk>
date Sat, 07 Dec 2013 20:32:27 +0000
parents 4549109a0d1e
children ad2121f39b91
files assembler/assembler.py assembler/language.py tests/label_test.asm
diffstat 3 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/assembler/assembler.py	Sat Dec 07 16:42:30 2013 +0000
+++ b/assembler/assembler.py	Sat Dec 07 20:32:27 2013 +0000
@@ -19,8 +19,6 @@
     source_code = filter(lambda l: l != '\n', f.readlines())
     
     asm = []
-    pc = 0
-    
     # <line> ::= [<statement>] [";"<comment>] <EOL>
     for line in source_code:
         # remove EOL
@@ -58,8 +56,6 @@
         symbols, constants = tokenize(arguments)
         asm.append([mnemonic, symbols, constants, label])
         
-        pc = pc  + 1
-
     return asm
 
 # take preprocessed asm and write machine code to binary file
--- a/assembler/language.py	Sat Dec 07 16:42:30 2013 +0000
+++ b/assembler/language.py	Sat Dec 07 20:32:27 2013 +0000
@@ -243,7 +243,7 @@
                  ('a', 'r3'): 147}}
 
 # take a list of arguments
-# identify dataant data:
+# identify constant data:
 #       pack that data into a bit string
 # return data type symbols and data
 def tokenize(args):
--- a/tests/label_test.asm	Sat Dec 07 16:42:30 2013 +0000
+++ b/tests/label_test.asm	Sat Dec 07 20:32:27 2013 +0000
@@ -1,4 +1,4 @@
-; pc ofset set
+; label test
 label_1: MOV A, #0xFF       ; 0: 0x15 0xFF
 label_2: JNZ label_2        ; 2: 0xE1 0x02
 label_4:                    ; 4: