Running asmj

There are two ways to run Asmj: command line or GUI. But before you do either of those, you have to set up your CLASSPATH.


To run asmj, you must first set the CLASSPATH variable to include the absolute path to the downloaded jar file:
	export CLASSPATH=${CLASSPATH}:/home/fred/asmj.jar

Alternatively, if you get the source code and re-compile it yourself, you would set CLASSPATH to include both of the directories that the class files end up in:

	export CLASSPATH=${CLASSPATH}:/home/fred/asmj:/home/fred/asmj/6809


The GUI is simpler to use, and sure makes a nice demo...

Run it as follows:

	java Gui

The GUI lets you control where the input comes from, where the outputs go, and the list of compile-time symbol definitions. Once you have set up all of that (not as hard as it sounds), you click the "Assemble" button and it does its stuff.

For the input and each output (almost - see below), you can choose whether it should use standard text I/O, a file, or a GUI popup text window. If you choose file, you have to fill in a filename. If you choose a GUI, click on its "show" button when you want to see it. (For the binary output, there is no option to show a text popup window. It would normally not be readable anyway.)

Choose whether you want each output to go into a file, standard (text) output, or to a GUI popup window. Fill in filenames and any symbol definitions you need. If you chose "GUI" for the input, pop up that window and type (or copy+paste) some assembly code in there. Then click on the "Assemble" button and watch the sparks fly!

Command line

The command line is slightly more flexible than the GUI, in that it allows multiple source files to be assembled together. And for real work, you would probably have a build script that calls the command-line version; a GUI won't do.

Run it by calling the Java intepreter, and giving the name of the assembly source files and option flags on the command line. The option flags can come before or after the input filename; it makes no difference.

For instance:

	java Asmj sourcefile.asm

If the name of the source file ends with ".asm", then by default the binary output file will have the same name but with ".bin" instead of ".asm". Otherwise, the output file is just the source filename with that extension appended.

A few option flags are supported. Any of the output-control options can be disabled by using a minus-sign instead of a plus-sign, and any of them can be routed into a file by giving an equals-sign and a filename after the flag (no spaces). If enabled without a filename, the stream goes to standard output (except for the binary output, which can only be written into a file).

Flag Meaning Details
+l=filename Listing Generate a listing showing object code with each source line. (That is a lower case "L", not the digit "one".) By default, a listing is written to standard output. The listing includes any error messages.
+e=filename Error report Generate an error report. Since the listing include error messages, this error report is redundant unless the listing is turned off.
+t=filename Symbol table Generate a table showing the symbols and their values. By default, a symbol table is written to standard output.
+s=filename S-records Write an image of the object code as Motorola S-records.
+b=filename Binary Write the raw binary object code. No addressing information is written into this file. By default, the binary object code is written into a file.
+f=filename Filename Used to specify an input filename that begins with a plus or minus sign. Without this option, such a filename would be mistaken for an option flag.
+D=definition Define symbol Used to put a symbol into the symbol table, to be referenced by the source code.
        # use defaults for all output streams
        java Asmj foo.asm

        # write no binary, put the listing and s-records into files,
	# and the error report to standard output
        java Asmj -b +e +l=foo.lis +s=foo.s19 foo.asm

        # write no binary, send errors to standard output, no other outputs
        java Asmj -b -l -s -t +e foo.asm

        # use defaults for all output streams, define "precision" to be 3
        java Asmj +Dprecision=3 foo.asm

Last revised: 28-Dec-2010