This is an alternate implementation of an assembler for the Four-Bit-Badge, inspired by an implementation by Mike Szczys. Mike's version uses a classic pythonic approach, and seems to be well-written using ordinary token string manipulation.
This version is an experiment using a more perlesque implementation based on regular expression processing, to see how these 2 approaches compare.
Warning: This is an incomplete implementation. Some questions on the requirements and specifications remain to be addressed.
For command line help:
fbb_as2.py -h
fbb_dis2.py -h
To run a test, execute the test.sh script. This will assemble test input with valid statements and error statements. The resulting output binary is compared with a reference implementation. The reference binary is dissassembled and the source code generated is assembled and compared with the
original.
Test files:
test.sAssembly test with valid and error statementstest.lstAssembly listing outputtest.binAssembly binary outputtest2.binReference copy of test.bintest2.sDissassembled output with hex codetest3.sDissassembled test2.bin without hex codetest3.binRe-assembled test3.s binary outputtest3.lstListing output of test3.s assembly