GB80 Programming

Introduction

When I started this project, I didn’t want to reinvent the wheel. So for the assembly part, I tried to do my best to have a software compatibility with WLA-DX.

WLA-DX Directives supported

DMGEditor only supports a sub-part of commands understood by WLA-DX.

Directive Description

.DB

Defines bytes.

.DW

Defines words (two bytes each). .DW takes only numbers and characters as input, not strings.

.INCBIN

Includes the specified data file into the source file.

.ORG

Defines the starting address. The value supplied here is relative to the ROM bank given with .BANK

.CARTRIDGETYPE

Indicates the type of the cartridge (mapper and so on). This is a standard Gameboy cartridge type indicator value found at $147 in a Gameboy ROM, and there this one is put to also.

.RAMSIZE

Indicates the size of the RAM. This is a standard Gameboy RAM size indicator value found at $149 in a Gameboy ROM, and there this one is put to also.

.ROMBANKS

Indicates the size of the ROM in rombanks. This value is converted to a standard Gameboy ROM size indicator value found at $148 in a Gameboy ROM, and there this one is put into.

.NAME

If .NAME is used with WLA-GB then the 16 bytes ranging from $0134 to $0143 are filled with the provided string.

.LICENSEECODENEW

This is a standard new licensee code found at $144 and $145 in a Gameboy ROM, and there this one is put to also. .LICENSEECODENEW cannot be defined with .LICENSEECODEOLD. $33 is inserted into $14B, as well.

.ROMGBC

Inserts data into the specific ROM location to mark the ROM as a dual-mode ROM ($80 → $0143, so ROM name is max. 15 characters long). It will run in either DMG or GBC mode.

.ROMDMG

Inserts data into the specific ROM location to mark the ROM as a DMG (Gameboy) ROM ($00 → $0146). It will only run in DMG mode.

.ROMSGB

Inserts data into the specific ROM location to mark the ROM as a Super Gameboy enhanced ROM ($03 → $0146).

.EMPTYFILL $42

This byte is used in filling the unused areas of the ROM file. EMPTYFILL defaults to $00.

.NINTENDOLOGO

Places the required Nintendo logo into the Gameboy ROM at $104.

gb80 / z80 mnemonics supported

A B C D

E

H

L

(HL)

nn

Mnemonics

ADD A

ADD B

ADD C

ADD D

ADD E

ADD H

ADD L

ADD (HL)

ADD nn

Machine code

$87

$80

$81

$82

$83

$84

$85

$86

$c6