Read Me
gb-z80asm by dospro (dospro@gmail.com)
Web: http://biogb.sourceforge.net
What is gb-z80asm?
gb-z80asm is a Gameboy Original/Pocket/Color assembler.
How to use:
gb-z80asm recieves a source file which analizes it and creates a gameboy rom file.
Specifications:
The first argumnent must be the source file which containes the assembly code.
The second argument must be the the name of the assembled file.
All options are specified in the source file itself.
gb-z80asm treats lowcase and highcase separately. "ROUTINE" is not the same as "routine" for gb-z80asm.
ALL ASM OPCODES MUST BE WRITTEN IN LOWCASE.
Every instruction must be on a separate line.
gb-z80asm implements special instructions to specify options or special declarations.
Here is a list of them and how to use them.
::Program modifiers::
.main
This special keyword will tell gb-z80asm where the program starts.
Internally, it writes a jp instruction in address 0x100 pointing
to the address where .main was found. If there is no main statement,
the program will just jump to the first instruction is assembled.
.db 0xXX
Writes the specified byte at current address.
.address 0xXXXX
.block name
.end
Creates a block of bytes which can be referenced by name. The block end with
instruction .end
.define
Defines macros (i.e. .define LCD 0xFF40)
.rombank 0xFF
Specifies in which rom bank is the next code going to be written.
By default, it always writes in bank 0.
gb-z80asm will generate an error message if you overflow a rom bank.
::Header modifiers::
.title gametitle
Specifies the title of your program.(Default: GBZ80ASM)
You can only use 16 characters.
.color
Specifies thet the program will use GameBoy Color hardware.
If this is not used, then the program will run on any Gameboy.
.sgb
Specifies that the program has Super Gameboy features.
.type chipname <0xFF>
Specifies the chip used for memory banking.
The next names are supported:
-ROMONLY (default)
-MBC1
-MBC2
-MBC3
-MBC4
-CUSTOM
If you use a custom chip, then you must write the byte that identifies this in the header.
.battery
Specifies that the program needs a battery to save the Ram.
.rombanks n
Specifies the number of rom banks the program has.
Only this are possible:2, 4, 8, 16, 32, 64, 128, 72, 80, 96
Any other number will be replaced by the nearest one.
.rambanks
Specifies the number of ram banks the program uses.
Only this are possible: 0, 1, 4, 16
For simple numbers operations you can use decimal or hexadecimal numbers.
Hexadecimal numbers must have the prefix 0x or $.
If you are making a reference to an address (i.e. [0xFF40]) the address
MUST be a hexadecimal number.
Examples:
and 11 ; Will be and $B
or 0xFF;
ld bc, $4000
You may use any name you want for jumps, routines, etc.
Examples:(All of the are valid... believe or not)
2342dfgdfnnoi_sub:
call 2342dfgdfnnoi_sub