This is my attempt at making an assembler for the Gameboy, in Rust. It takes an assembly file as input and outputs a binary that an emulator can run.
I made this mostly to learn and experiment with various things :)
cargo build --release
gbz80 ./asm/shork/shork.gb.asm -o ./build/shork.gb
gbz80 ./asm/hello/hello.gb.asm -o ./build/hello.gb
-o [FILE]
Set the output destination (required).
-D [SYMBOLS]
Define symbols for conditional compilation.
- A stripped down version of the syntax from the z80
- Constants
- Build-time expressions
- Macros
- Error reporting
An hello world example is available in asm/hello
.
The instruction set is available here or in gen/instructions/opcode.html
.
Some alternative mnemonics from the bottom of the page are used and replace all the other options, such that a plus or minus sign is never used within an instruction.
.vim
: Syntax highlighting for '*.gb.asm' files in vim.asm
: Examples and tests in assembly.gen
: Code generation for the lexer.gen/instructions
: Generates the instructions list.gen/lex
: Generates syntax rules.gen/image
: Image conversion tool.
sh
Scripts and toolssrc
Source code and tests for the assembler.
Build the docs with:
cargo doc --open
Or run in debug mode, it will show the result of every step in the process:
cargo r ./asm/shork/shork.gb.asm -o ./build/shork.gb
cargo r ./asm/hello/hello.gb.asm -o ./build/hello.gb
- Assembly tutorials:
- Instruction set:
- Cpu manual:
- BGB (emulator):
- ROM analyzer:
- Xxd (hex viewer):
- Hello World:
- Snake: