Skip to content

Use hardware.inc 5.0 constants #125

@Rangi42

Description

@Rangi42

Right from the very beginning with Hello World, the tutorial uses constants from 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions