OpenSNES
Modern Open-Source SNES Development SDK
Loading...
Searching...
No Matches
main.c File Reference

Hi-res text — BG Mode 5 + interlace (512 horizontal pixels). More...

#include <snes.h>

Macros

#define VRAM_GFX   0x8000
#define VRAM_MAP   0x4000
 krom's VRAM layout: map at word $4000, tiles at word $8000

Functions

int main (void)

Variables

u8 text_map []
 32x32 tilemap of 16x8 entries — 32 entries x 16px = the full 512
u8 text_map_end []
u8 text_pal []
 4 colors: black, white, cyan, gold
u8 text_pal_end []
u8 text_pic []
 410 deduplicated 8x8 subtiles (Mode 5 pairs, original art)
u8 text_pic_end []

Detailed Description

Hi-res text — BG Mode 5 + interlace (512 horizontal pixels).

Port of krom (Peter Lemon)'s InterlaceFont demo (PeterLemon/SNES, PPU/Interlace/InterlaceFont). BG Mode 5 renders 512 horizontal pixels with 16x8 tiles; SETINI bit 0 adds interlace for 448 vertical lines. The text page is original art (a procedurally rendered 512x256 text image with 1-pixel-column test bands), converted to Mode 5's paired 8x8 tile layout.

SNES Concepts
  • BG Mode 5: 512px horizontal, 16x8 tiles (stored as 8x8 pairs)
  • SETINI screen interlace via videoSetInterlace() (write-only shadow)
  • The Mode 5 trap: content displays through MAIN AND SUB screen — both setMainScreen() and setSubScreen() are required
What to Observe
Crisp 8px-wide glyphs and 1px vertical stripe bands that a 256-wide mode cannot represent (they'd alias to solid gray).
Modules Used
console, dma, background
See also
https://github.com/PeterLemon/SNES — original demo
video.h (videoSetInterlace and the SETINI shadow)

Macro Definition Documentation

◆ VRAM_GFX

#define VRAM_GFX   0x8000

◆ VRAM_MAP

#define VRAM_MAP   0x4000

krom's VRAM layout: map at word $4000, tiles at word $8000

Function Documentation

◆ main()

int main ( void )

Variable Documentation

◆ text_map

u8 text_map[]
extern

32x32 tilemap of 16x8 entries — 32 entries x 16px = the full 512

◆ text_map_end

u8 text_map_end[]

◆ text_pal

u8 text_pal[]
extern

4 colors: black, white, cyan, gold

◆ text_pal_end

u8 text_pal_end[]

◆ text_pic

u8 text_pic[]
extern

410 deduplicated 8x8 subtiles (Mode 5 pairs, original art)

◆ text_pic_end

u8 text_pic_end[]