Light gun detection, calibration via PPU H/V counters, and fire tracking with an impact marker sprite — at the calibration target of the city's security range.
| Input | Action |
|---|---|
| Fire (trigger) | Calibrate aim / mark hit position |
| Pause | Return to calibration screen |
| Cursor | Advance to ready state |
Then open superscope.sfc in an emulator with a Super Scope on port 2 (luna drives one from a test manifest).
Mode 0 gives four 2bpp BG layers. We use BG1 for text and BG2 for the calibration target image.
The built-in 2bpp font is loaded to VRAM $0000. BG1's tilemap sits at $3800 to avoid conflicts with BG2 graphics.
The crosshair target image is a 256x224 background. Tiles at $1000, tilemap at $2000.
The OBJSEL() macro replaces the cryptic 0x62 with a readable size + base address. OBJ_SIZE16_L32 means small=16x16, large=32x32. The sprite sheet is the impact marker alone, a 16x16 sprite: tile 0.
Writing directly to oamMemory[] avoids the call and argument pushes of oamSet(). For a single sprite updated occasionally, this is clean and fast.
The example uses three states:
The fire_armed flag prevents the calibration fire from immediately re-triggering in the next state (debouncing).
| Module | Why it's here |
|---|---|
| console | VBlank/NMI handling |
| input | Super Scope detection and reading |
| sprite | oamInit(), oamClear() |
| dma | DMA transfers for tiles, maps, palettes |
| text | Font loading and text rendering |
| background | bgSetGfxPtr(), bgSetMapPtr(), bgSetScroll() |
console, input, sprite, dma, text, background (LIB_MODULES in the Makefile).
| Register | Address | Role in this example |
|---|---|---|
| OBJSEL | $2101 | Sprite size + tile base address |
| CGADD | $2121 | Palette write address |
| CGDATA | $2122 | Palette color data (RGB555 LE) |
| TM | $212C | Main screen layer enable |
| OPHCT | $213C | PPU horizontal counter (Super Scope X) |
| OPVCT | $213D | PPU vertical counter (Super Scope Y) |
| File | What's in it |
|---|---|
| main.c | State machine, sprite control, text display |
| res/*.png.toml | the import settings of the target picture (opensnes-tileset, 2bpp, 4 colours) and of the marker (opensnes-sprite, 16-pixel blocks, 16 colours); the build converts and links them |
| res/aim_adjust_target.png | the calibration target, drawn by devtools/art_assets/build.py (scope_target): the rings and the cross must be exact, the aim adjustment reads them |
| res/marker.png | the impact marker, a white ring round a magenta core: assets/neo-lumen/ui/marker.png (PixelLab, CC0), indexed |
| Makefile | LIB_MODULES := console input sprite dma text background |