Software for the Agon Light™ written in eZ80 Assembly for the spasm-ng assembler. (no need for the rather bloated Zilog Developer Studio)
- The file init.asm in the include directory provides the necessary header for an assembly program to work with the MOS.
- The file helper_functions.asm has some essential functions (work in Progress - to be expanded)
Feel free to contribute.
-
Clone this git repo to your local machine
git clone https://github.com/schur/Agon-Light-Assembly/
-
Download and compile spasm-ng
-
Assemble the desired programs with
spasm -E -T <filename>
If you would like to write your own programs, feel free to use the include files from this repository.
-
Make sure to include the following lines at the top of your main.asm:
; uncomment one of the below to chose between ADL (24-bit) or Z80 legacy (16-bit) mode ; if nothing is uncommented, Z80 legacy mode will be used ; #define ADL ; #undefine ADL #include "../include/init.inc" #include "../include/mos_api.inc" #include "../include/helper_functions.asm"
-
Write your own code with the main function labelled "MAIN"
MAIN: <your code here> CALL <your helper function calls here> RET
In ADL mode, the program is aware of the full address space. The Agon MOS loads programs by default to address $40000, so if ADL mode is set (#define ADL), the init.asm include file will set the .org $40000 directive.
In Z80 legacy mode, the program will, from its point of view, be located from address $0000. The program will have 32kb of address space to $7FFF available to itself. Note, the SPS stack expands downwards from $7FFF, so if your assembled code is very large, you need to make sure it doesn't clas with the stack.
If you want to use your assembled program as a MOS command (saved in the /mos folder of the SD card), you must use Z80 legacy (16-bit) mode. This is because the MOS will load your program, if executed as a MOS command, to $B0000. Please note, your assembled program must be 32kb or less.
In addition, the SPS stack pointer needs to be set to $7FFE before starting to push any values onto the SPS, otherwise the MOS command's SPS will conflict with the global SPL. Note: This is already taken care of by the init.inc include file in this repository. See the stacktest example program for more details on this.
The MOS header is stored from bytes 64 in the executable and consists of the following:
- A three byte ASCII representation of the word MOS
- A single byte for the header version
- A single byte for the executable type: 0 = Z80, 1 = ADL
Note: This is already taken care of by the init.inc include file in this repository.
There is no manual for the spasm-ng assembler itself. However, the syntax for assembler directives follows tasm, so you can refer to the Source File Format, Expressions and Assembler Directives sections of the TASM Manual
- eZ80 Heaven
- TASM Manual
- MOS Information and Memory Map
- MOS API
- VDP Commands
- Learn eZ80 Assembly
- Zilog eZ80 Manual
convert .hex files to .bin files:
objcopy --input-target=ihex --output-target=binary <filename>.hex <filename>.bin