This is an assembler, disassembler, and simulator for the Simple Computer described in chapter 9 of Logic and Computer Design Fundamentals (4th edition).
You can download the figues and tables from the chapter here: http://writphotec.com/mano4/Figures_Tables/Fig_&_Tbl_Chapter_9.pdf
I wrote this for Virginia Tech's ECE-2504 class. We had a homework assignment in which we had to write a bit of assembly, but the provided assembler for the processor we had to use was very rudimentary. So, instead of just dealing with it and getting my homework done, I first wrote a better assembler.
Comments start with //
or #
.
Comments may appear on the same line as instructions.
Assembly instructions are specified like so:
MNEMONIC OP[, OP[, OP]]
Bytecode instructions are specified as 4 hex digits.
Assembly and bytecode may be mixed at will (useful when implementing new instructions).
Values are given in C-style syntax:
0xBEEF
for base 161984
for base 10\007
for base 8
with an optional -
before the radix specifier prefix to denote a negative
value.
Additional whitespace is allowed anywhere.
To keep backwards compatibility, values may be prefixed with 'r', and opcodes may be lower case.
The simulator works but would probably need some optimization for use with larger programs.