Skip to content

Instantly share code, notes, and snippets.

@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

@chriskrycho
chriskrycho / awesome-thing.ts
Created August 29, 2018 16:27
Our current mirage types at work
import Mirage, { faker } from 'ember-cli-mirage';
export default class AwesomeThingFactory extends Mirage.Factory.extend({
id(i: number) {
return i;
},
name: faker.hacker.noun,
city: 'Buffalo',
state: 'NY',
}) {}