Description
ApAsm is a small Java-based assembler for creating machine code files for use in Logisim's ROM component.
Usage
ApAsm is distributed as an executable JAR file. To assemble a file named test.asm type:
java -jar ApAsm.jar test.asm
This will dump the assembled instructions to the screen. To save to a file, use shell redirection (works in Windows, Mac, or Linux):
java -jar ApAsm.jar test.asm > test.bin
Error messages will still be seen if something is wrong.
Syntax
You file must consist only of assemble-able code. There are no directives, so you may not say things like .data or .text.
A line can start with an optional label. Labels are identifiers that start with a letter, underscore, or period and can contain additional letters, numbers, underscores, or periods. A label declaration is suffixed by a colon (:).
The assembler is not case sensitive, except with label names.
The valid instructions are those supported by the CPU (see the assignment handout). There are no pseudoinstructions at this time.
You may use the 4 registers where appropriate. These are named $R[0-3].
Line comments are introduced by # and extend to the following newline.
Known Issues
There are undoubtedly many bugs in this program. Please let me know if you run into anything, especially an opcode that didn't assemble correctly. I will try to fix bugs as soon as possible.
Right now, the only known issue is that the error messages are less than helpful. It will tell you the line and character number it didn't like (note that a tab is only one character, despite how it shows up on your screen).
Version History
v0.7.1 — 7/20/2016
- Support for the new CPU.
v0.7 — 7/15/2014
- Support for the new CPU.
v0.6 — 11/17/2013
- Support for the new CPU.
v0.5 — 4/18/2013
- Bug fixes.
v0.4 — 4/3/2013
- Support for the new CPU.
v0.3 — 7/26/2012
- Supports hexadecimal constants in the 0xFF format.
- Supports negative immediates in decimal.
- Prints out text of the line that an error occurred on.
v0.2 — 7/19/2012
- Fixes an encoding problem with $RT not being the destination register for the opcodes it should be
- Adds a
-version
flag to see the current version number - Fixes the problem of requiring the code to not have a comment on the last line
v0.1 — 7/18/2012
- Initial release