Skip to content

Instantly share code, notes, and snippets.

View ISSOtm's full-sized avatar
🦀
Rewriting RGBDS... In Rust!

Eldred Habert ISSOtm

🦀
Rewriting RGBDS... In Rust!
View GitHub Profile
@ISSOtm
ISSOtm / conventions.md
Last active April 11, 2021 17:06
My conventions when writing Game Boy ASM (naming / casing, best practices)

Casing

  • Labels use PascalCase. DrawNPCs, GetOffsetFromCamera.
  • Labels in RAM (VRAM, SRAM, WRAM, HRAM; you shouldn't be using Echo RAM or OAM) use the same convention but are prefixed with the initial of the RAM they're in, in lowercase. wCameraOffsetBuffer, hVBlankFlag, vTilesetTiles, sSaveFileChecksum. Rationale: to know in which memory type the label is; this is important because VRAM and SRAM have special access precautions and HRAM can (should (must)) be accessed using the ldh instruction.
  • Local labels use camelCase, regardless of memory type. (.waitVRAM, wPlayer.xCoord)
  • Macro names use snake_case. wait_vram, rst wait_vblank, end_struct.
  • Constants use CAPS_SNAKE. NB_NPCS, OVERWORLD_STAT_LOAD_MAP.
  • Constants posing as labels use the appropriate label convention.

Best practices

@ISSOtm
ISSOtm / vwf.asm
Last active October 9, 2018 20:23
A variable-width font engine for the Game Boy
SECTION "VWF engine",ROM0
; Prints text pointed to by DE
; Text is null-terminated
PrintVWFText::
ld a, 3
jr .startupColorID
@ISSOtm
ISSOtm / to_c_or_not_to_c.md
Last active June 22, 2021 12:02
Writeup discussing programming toolchains, coding practices, and languages, for GB and GBC dev.

This document is now at https://gbdev.io/guides/tools.html, please go there instead. It's kept here to avoid breaking links and to preserve history.

Previous versions can be checked out by selecting the "Revisions" tab, and selecting "View file" in the three-dot drop-down menu.

@ISSOtm
ISSOtm / cartswap.md
Last active November 25, 2023 12:57
Swapping GB carts from the Game Boy to our advantage

The beauties (and crashes) of CartSwap

CartSwap (Cartridge Swapping) is a technique that allows ACE in any Game Boy game, even before the game has actually booted up! Example applications include :

  • Spoofing consoles (Pokémon Crystal can run on the Gray Brick!)
  • Speedrunning games quicker than a TAS
  • Gaining ACE on games that are otherwise ACE-less