Lychee Assembler
Lychee assembly (and the instruction set) is highly similar to Gameboy assembly, and thus most of the knowledge transfers over.
Contents
Assembler (LASM)
The lychee assembler (lasm) is a very simple assembler which simply translates the assembly code to machine code that the CPU will understand.
Building
For Debug purposes.
For release and official usage.
Copy the
lasm
orlasm.exe
to yourPATH
or use in place.
Usage
Simply pass in the input file as the first argument and the output rom as the second argument.
Assembly Language
Lychee uses a derivative of the standard assembly.
Syntax
Each instruction is on a new line, and this is very important or the assembler will parse properly. Each value on each line has to be separated by space, nothing else (no commas), so the opcode and subsequent operands have to be spaced y a space.
Opcode: The instruction to call
Operands: Any value that need to passed to the instruction.
Symbols
Lychee assembly uses specialised symbols to to denote data types.
$00
(Hex): A$
followed by numeric values represents a hex value.&name
(Section Names): A&
followed by a tag represents a position in the rom, useful for jumps.
Sections
Sections are placed before a piece of code and is useful for the jump instruction, define a section by adding tag name followed by a :
. Anything below that tag will be ran. Do not if you don't move to somewhere else, the CPU will just move to the next section. And this can be used strategically by placing sections next to each other for a planned behaviour.
Opcodes
To learn more about the available opcodes read /spec/opcode
. If you want to learn more about how some of the opcodes work, there is no documentation on it as of right now, however you can read about how some of them work on the rgbds cpu reference, as the instruction set is similar to the Gameboy.
Last updated