| Programming with Ophis | ||
|---|---|---|
| <<< Previous | The basics | Next >>> | 
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.
Ophis takes a list of source files and produces an output file based on assembling each file you give it, in order. You can add a line to your program like this to name the output file:
| .outfile "hello.prg" | 
      Alternately, you can use the -o option on the
      command line. This will override any .outfile
      directives. If you don't specify any name, it will put the
      output into a file named ophis.bin.
    
      If you are using Ophis as part of some larger toolchain, you can
      also make it run in pipe mode. If you give
      a dash - as an input file or as the output
      target, Ophis will use standard input or output for
      communication.
    
Table 2. Ophis Options
| Option | Effect | 
|---|---|
| -o FILE | Overrides the default filename for output. | 
| -l FILE | Specifies an optional listing file that gives the emitted binary in human-readable form, with disassembly. | 
| -m FILE | Specifies an optional map file that gives the in-source names for every label used in the program. | 
| -u | Allows the 6510 undocumented opcodes as listed in the VICE documentation. | 
| -c | Allows opcodes and addressing modes added by the 65C02. | 
| -4 | Allows opcodes and addressing modes added by the 4502. (Experimental.) | 
| -q | Quiet operation. Only reports warnings and errors. | 
| -v | Verbose operation. Reports files as they are loaded. | 
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 -v hello1.oph
Loading hello1.oph
Assembly complete: 45 bytes output (14 code, 29 data, 2 filler)
     | 
This will produce a file named hello.prg. 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. If you have access to a device like the 1541 Ultimate II, you can even load the file directly into the actual hardware.
| <<< Previous | Home | Next >>> | 
| Writing the actual code | Up | Labels and aliases |