annotate python/asm.py @ 159:5e1dd04cb61c

Added attempt to assembler
author Windel Bouwman
date Fri, 08 Mar 2013 17:16:22 +0100
parents
children
rev   line source
159
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
1 #!/usr/bin/python
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
2
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
3 # Assembler
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
4
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
5 import sys, argparse
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
6 import pdb
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
7
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
8 import libasm
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
9
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
10 parser = argparse.ArgumentParser(description="Assembler")
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
11 pdb.set_trace()
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
12 parser.add_argument('sourcefile', type=argparse.FileType('r'), help='the source file to assemble')
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
13 args = parser.parse_args()
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
14
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
15
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
16 a = libasm.Assembler()
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
17 obj = a.assemble(args.sourcefile.read())
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
18
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
19 print('object:', obj)
5e1dd04cb61c Added attempt to assembler
Windel Bouwman
parents:
diff changeset
20