Programming with Ophis

Michael Martin


Table of Contents
Preface
History of the project
Getting a copy of Ophis
About the examples
I. Using the Ophis Assembler
The basics
A note on numeric notation
Producing Commodore 64 programs
Related commands and options
Writing the actual code
Assembling the code
Labels and aliases
Temporary labels
Anonymous labels
Aliasing
Headers, Libraries, and Macros
Header files and libraries
Macros
Example code
Character maps
Local variables and memory segments
Expressions
Advanced Memory Segments
The Problem
The Solution
Included Platform Support
The Commodore 64 and VIC-20
The Nintendo Entertainment System
The Atari 2600 VCS
Other Atari 8-bits
The Apple II series
II. To HLL and Back
The Second Step
The problem
The solution
Unsigned arithmetic
16-bit addition and subtraction
16-bit comparisons
Structured Programming
Control constructs
The stack
Procedures and register saving
Variables
Data structures
A modest example: Insertion sort on linked lists
Pointers and Indirection
The absolute basics
Pointer arithmetic
What about Indexed Indirect?
Comparison with the other indexed forms
Conclusion
Functionals
Function Pointers
A quick digression on how subroutines work
Dispatch-on-type and Data-Directed Assembler
VTables and Object-Oriented Assembler
A final reminder
Call Stacks
Recursion
Our Goals
Example: Fibonnacci Numbers
Example Programs
hello1.oph
hello2.oph
c64-1.oph
c64kernal.oph
hello3.oph
hello4a.oph
hello4b.oph
hello4c.oph
hello5.oph
hello6.oph
hello7.oph
structuredemo.oph
fibonacci.oph
Ophis Command Reference
Command Modes
Basic arguments
Numeric types
Label types
String types
Compound Arguments
Memory Model
Basic PC tracking
Basic Segmentation simulation
General Segmentation Simulation
Macros
Defining Macros
Invoking Macros
Passing Arguments to Macros
Features and Restrictions of the Ophis Macro Model
Assembler directives