Files
disasm/_wip/Hogan's Alley (JU)/GeminiNotes.md
T
2026-10-18 16:47:03 -04:00

31 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
To make disassembling the 1984 NES classic Hogan's Alley significantly easier, you should focus on its straightforward architecture, unique input handling, and standard sprite structures.
Here is a breakdown of the vital structural details that will save you time when writing a disassembly or configuration file:
1. The Memory Mapper (NROM)
• No Bank Switching: Hogan's Alley uses the NROM-128 (iNES Mapper 0) board. It has exactly 16 KB of PRG ROM (mapped to $C000–$FFFF) and 8 KB of CHR ROM.
• Mirrored Vector Table: Because it is a 16 KB game mirrored into a 32 KB CPU space, the 6502 vectors at $FFFA–$FFFF are identical to the data at $BFFA–$BFFF in the raw PRG data.
2. Zapper Light Gun Mechanics
Since Hogan's Alley is a light gun game, your disassembly will heavily feature input reading from controller port 2 ($4017). Look out for these code patterns:
• The Trigger Pull: Bit 4 of $4017 checks if the Zapper trigger is pulled.
• The Light Sensor: Bit 3 of $4017 checks if the photodiode detects light (0 = light detected, 1 = darkness).
• The Flash Hack: To see which criminal or innocent citizen was shot, the game blanks the screen for one frame, then draws white boxes over the target hitboxes one by one on subsequent frames while checking Bit 3 of $4017. Identifying this routine early will unlock the core game loop logic.
3. CHR Layout and Sprite Construction
• Sprite Mapping: Sprite data is pushed via Sprite DMA ($4014) to Object Attribute Memory (OAM). The targets (gangsters, police, civilians) are large metasprites composed of individual 8x8 tiles.
• The "Flips": Look closely at the sprite attribute byte in OAM. Hogan's Alley flips tiles horizontally (Bit 6) and vertically (Bit 7) to reuse a single side of an arm, leg, or face for the opposite side, minimizing the 8 KB CHR space.
4. Audio Architecture (RP2A03)
The game uses a very early, standard Nintendo audio driver.
• Audio registers reside between $4000 and $4015.
• Sound effects (like the gunshot or the "miss" buzzer) are prioritized over the simple background jingles. Isolating the audio update routine (usually triggered inside the NMI) will let you separate the SFX data tables cleanly from the game logic.
5. Common Pitfalls to Automate
• Indirect Jumps: Watch out for JMP ($xxxx). Early NES games occasionally use jump tables for game states (Title Screen, Game A, Game B, Trick Shot). Ensure your disassembler treats these destination tables as 16-bit pointers rather than raw code instructions.
• Data Arrays: Score counter graphics, timer lookups, and hit detection window delays are stored as raw data arrays embedded right next to the subroutines that use them.