Using SGB as a makeshift SNES flashcart

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
User avatar
ISSOtm
Posts: 58
Joined: Fri Jan 04, 2019 5:31 pm
Location: France, right of a pile of consoles
Contact:

Re: Using SGB as a makeshift SNES flashcart

Post by ISSOtm »

My GB code is uttely bad, for a fairly unique but stupid reason: at some point the SD card I was using to feed my flashcart GB ROMs ceased working, so I kept running the same (at the time broken) ROM. SO I ended up fixing problems and things that weren't (to my great confusion). Since I wasn't planning to use a VCS by the time I realized this, I was left with very very botched code.
As for the memory map, I thus fell back to areas I knew were correct, ie. the small regions used by games to hot-patch the SGB firmware.

That said, I have identified other buffers that are most certainly free, though I am unsure whether their location is preserved across firmware revisions.

Code: Select all

7E:2800-2FFF BG1Tilemap
7E:3000-3FFF SystemPalettes
7E:4000-4FFF ATFBuffer          ; Buffer for the "attribute files" sent by ATR_TRN
7E:5000-67FF Framebuffer1
7E:6800-7FFF Framebuffer2       ; There's double-buffering, apparently
7E:8000-8FFF BorderTilesBuffer1
7E:9000-9FFF BorderTilesBuffer2 ; There are two buffers, one per "half" of the possible BG1 tiles. This appears to store the "user-specified" tiles, not the currently-used ones
7E:A000-A7FF BorderTilemapBuffer
7E:A800-AFFF GBTilemapBuffer ; I'm unsure why this is there, but I don't remember if this gets copied to the BG3 tilemap more than once
7E:C000-C1FF MainShadowOAM
7E:C200-C21F SecondaryShadowOAM
7F:0000-0FFF VRAMBuffer0
7F:1000-1FFF VRAMBuffer1
7F:2000-2FFF VRAMBuffer2
7F:3000-3FFF VRAMBuffer3
7F:4000-4FFF VRAMBuffer4
7F:5000-5FFF VRAMBuffer5
7F:C000-C7FF OAM2TileBuf0
7F:C800-CFFF OAM2TileBuf1
7F:D000-D7FF OAM2TileBuf2
7F:D800-DFFF OAM2TileBuf3
7F:E000-E7FF OAM2TileBuf4
7F:E800-EFFF OAM2TileBuf5
7F:F000-F7FF OAM2TileBuf6
7F:F800-FFFF OAM2TileBuf7

Things of interest:

Unsurprisingly, the SGB runs in Mode 1. BG1 is used for the menus and custom drawings, BG2 for the border, and BG3 for the GB screen.
Attachments
sgb-testing.zip
Source code + binary of the SGB ROM I used. Entry point in src/home/header.asm, SNES program (inexplicably cut off) in src/res/sgb/
(73.13 KiB) Downloaded 258 times
The French Lord of Laziness (and a huge Legend of Zelda fan)
https://github.com/ISSOtm
ASMu is laifu <3
Post Reply