gbdev / gbdev/gb-asm-tutorial

Use hardware.inc 5.0 constants

Open
#125 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Assembly
Stars
179
Forks
64
Avg merge
7d 22h
Merged PRs (30d)
1

Description

Right from the very beginning with Hello World, the tutorial uses constants from [hardware.inc](https://github.com/gbdev/hardware.inc). Version 5.0, released 2025-06-22, changed the naming convention for bit number and mask constants, and also added a number of new constants for more hardware-related quantities that are currently hard-coded in the tutorial.

A few of the examples in Hello World:

- `ld a, LCDCF_ON | LCDCF_BGON` would now be `ld a, LCDC_ON | LCDC_BG_ON` ... and could explicitly specify more of the flag bits, like `LCDC_BG_9800`
- `WaitVBlank: ld a, [rLY] :: cp 144 :: jp c, WaitVBlank` can use `LY_VBLANK` for `144`
- `ld hl, $9800` can be `ld hl, TILEMAP0`

And some of the ones in Unbricked:

- `ld b, 160 :: ld hl, _OAMRAM` would now be `ld b, OAM_SIZE :: ld hl, STARTOF(OAM)`
- `ld a, 128 + 16` and `ld a, 16 + 8` would now be `ld a, 128 + OAM_Y_OFS` and `ld a, 16 + OAM_X_OFS`
- `ld a, P1F_GET_BTN` would now be `ld a, JOYP_GET_BUTTONS` (and `[rP1]` would be `[rJOYP]`)
- `[_OAMRAM + 5]` could be `[STARTOF(OAM) + 1 * OBJ_SIZE + OAMA_X]` (i.e. the X coord of OBJ 1)
- etc

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.