Assembler for Gameboy games. Currently missing a few instructions, and only supports Gameboy Color-exclusive games with no mapping hardware and no cartridge RAM.
because RGBDS is crappy especially for multi-platform use
that's not important
I don't like LDH/LDI/LDD instead of just LD/the usage of [] instead of ()/using 0x instead of $ for hexadecimal/something else
too bad
not really. you might be able to get it to work, but none of the Z80-only instructions are supported, and the LR35902-only instructions are, so you should probably use an actual Z80 assembler
- Make a folder
- Make a file called
info.toml
, put this in it: (name is limited to 15 characters, and this file will probably need more settings at some point)
Name = "COOL GAME"
- Make a file called
main.s
, put assembly code in there. - Run
gbasm
in that folder. - Do stuff with the
out.gb
file it creates.
- the expression parser likes to assume parentheses and do weird things. for example,
2 - 3 + 4
gets interpreted as2 - (3 + 4)
, which is probably not what you want - no MBCs are supported, and rom sizes are assumed to be 32 KiB
- all numbers are assumed to be unsigned -- putting in
-1
will give you an error - you can cause weird unhelpful errors to occur with the dot instructions if you mess with their expected parameters
things that aren't actual LR35902 instructions but that do useful things
ascii "<string>"
inserts that string, encoded using ASCII, into the outputasciz "<string>"
same asascii
but terminates the string with a null bytedb <byte>
inserts that byte into the outputdw <word>
inserts that word into the output.def <something> <value>
defines<something>
as equal to<value>
. useful for registers and things like that.org <address>
sets the origin from that point on to the given address.incasm "<file>.s"
includes everything from that assembly file
- the checksums are automatically calculated, you don't need some other program to fix them for you
- the
0b
prefix can be used to make a binary number (for example,0b10101010
==170
) - the
0x
prefix can be used to make a hexadecimal number (for example,0x2A
==42
) - the
%
and$
for binary and hexadecimal numbers are not currently supported because I'm lazy