// SNES PPU BG 8x8 8BPP 32x32 Demo by krom (Peter Lemon): arch snes.cpu output "8x8BGMap8BPP32x32.sfc", create macro seek(variable offset) { origin ((offset & $7F0000) >> 1) | (offset & $7FFF) base offset } seek($8000); fill $18000 // Fill Upto $1FFFF (Bank 2) With Zero Bytes include "LIB/SNES.INC" // Include SNES Definitions include "LIB/SNES_HEADER.ASM" // Include Header & Vector Table include "LIB/SNES_GFX.INC" // Include Graphics Macros seek($8000); Start: SNES_INIT(SLOWROM) // Run SNES Initialisation Routine LoadPAL(BGPal, $00, BGPal.size, 0) // Load Background Palette (BG Palette Uses 256 Colors) LoadVRAM(BGMap, $0000, BGMap.size, 0) // Load Background Tile Map To VRAM LoadVRAM(BGTiles, $2000, BGTiles.size, 0) // Load VRAM SRCDATA, DEST, SIZE, CHAN // Setup Video lda.b #%00001011 // DCBAPMMM: M = Mode, P = Priority, ABCD = BG1,2,3,4 Tile Size sta.w REG_BGMODE // $2105: BG Mode 3, Priority 1, BG1 8x8 Tiles // Setup BG1 256 Color Background lda.b #%00000000 // AAAAAASS: S = BG Map Size, A = BG Map Address sta.w REG_BG1SC // $2107: BG1 32x32, BG1 Map Address = $0000 (VRAM Address / $400) lda.b #%00000001 // BBBBAAAA: A = BG1 Tile Address, B = BG2 Tile Address sta.w REG_BG12NBA // $210B: BG1 Tile Address = $2000 (VRAM Address / $1000) lda.b #%00000001 // Enable BG1 sta.w REG_TM // $212C: BG1 To Main Screen Designation stz.w REG_BG1HOFS // Store Zero To BG1 Horizontal Scroll Pos Low Byte stz.w REG_BG1HOFS // Store Zero To BG1 Horizontal Scroll Pos High Byte stz.w REG_BG1VOFS // Store Zero To BG1 Vertical Scroll Pos Low Byte stz.w REG_BG1VOFS // Store Zero To BG1 Vertical Pos High Byte FadeIN() // Screen Fade In lda.b #0 // A = X/Y Scroll Loop: WaitNMI() // Wait VBlank sta.w REG_BG1HOFS // Store Zero To BG1 Horizontal Scroll Pos Low Byte stz.w REG_BG1HOFS // Store Zero To BG1 Horizontal Scroll Pos High Byte sta.w REG_BG1VOFS // Store Zero To BG1 Vertical Scroll Pos Low Byte stz.w REG_BG1VOFS // Store Zero To BG1 Vertical Pos High Byte inc // A++ jmp Loop // Character Data // BANK 0 insert BGPal, "GFX/BG.pal" // Include BG Palette Data (512 Bytes) insert BGMap, "GFX/BG.map" // Include BG Map Data (2048 Bytes) // BANK 1 & 2 seek($18000) insert BGTiles, "GFX/BG.pic" // Include BG Tile Data (32384 Bytes)