Programming with Ophis
<<< Previous | The basics | Next >>>

# Assembling the code

The Ophis assembler is a collection of Python modules, controlled by a master script. On Windows, this should all have been combined into an executable file ophis.exe; on other platforms, the Ophis modules should be in the library and the ophis script should be in your path. Typing ophis with no arguments should give a summary of available command line options.

Table 2. Ophis Options

Option | Effect
--- | ---
`-6510` | Allows the 6510 undocumented opcodes as listed in the VICE documentation.
`-65c02` | Allows opcodes and addressing modes added by the 65C02.
`-v 0` | Quiet operation. Only reports errors.
`-v 1` | Default operation. Reports files as they are loaded, and gives statistics on the final output.
`-v 2` | Verbose operation. Names each assembler pass as it runs.
`-v 3` | Debug operation: Dumps the entire IR after each pass.
`-v 4` | Full debug operation: Dumps the entire IR and symbol table after each pass.

The only options Ophis demands are an input file and an output file. Here's a sample session, assembling the tutorial file here:

    localhost$ ophis tutor1.oph tutor1.prg -v 2
    Loading tutor1.oph
    Running: Macro definition pass
    Running: Macro expansion pass
    Running: Label initialization pass
    Fixpoint failed, looping back
    Running: Label initialization pass
    Running: Circularity check pass
    Running: Expression checking pass
    Running: Easy addressing modes pass
    Running: Label Update Pass
    Fixpoint failed, looping back
    Running: Label Update Pass
    Running: Instruction Collapse Pass
    Running: Mode Normalization pass
    Running: Label Update Pass
    Running: Assembler
    Assembly complete: 45 bytes output (14 code, 29 data, 2 filler)

If your emulator can run `PRG` files directly, this file will now run (and print `HELLO, WORLD!`) as many times as you type `RUN`. Otherwise, use a `D64` management utility to put the `PRG` on a `D64`, then load and run the file off that.

<<< Previous | Home | Next >>>
Writing the actual code | Up | Labels and aliases