Dumb question about mapping ROM

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.
Post Reply
urbanspr1nter
Posts: 39
Joined: Thu Aug 16, 2012 7:55 pm

Dumb question about mapping ROM

Post by urbanspr1nter »

I am still trucking away in attempting to write an SNES emulator and have been using SMW as a test ROM. I have read this document here on LoROM.

http://www.cs.umb.edu/~bazz/snes/cartridges/lorom.html

Before, I was just straight reading bytes from the ROM into an array to test my instructions... But now I want to properly map the data into my array at the correct addresses to properly test branching and jumping.

This leads me to the following question...

When the document says that ROM is mapped from $00:8000-$00:FFFF -> $3F:8000-$3F:FFFF, then $40:8000-$40:FFFF -> $6F:8000-$6F:FFFF, and $70:8000-$7D:FFFF, etc... Does that mean we just load 32KB sequentially at those banks?

Like, the first 32KB goes into $00:8000->$00:FFFF then the next 32KB of the ROM goes into $01:8000->$01:FFFF and so on... Then once the $00-$3F banks are filled, we proceed to $40-$6F and so on...

Can anyone confirm this for me? THANKS!
creaothceann
Posts: 610
Joined: Mon Jan 23, 2006 7:47 am
Location: Germany
Contact:

Re: Dumb question about mapping ROM

Post by creaothceann »

You could take the SNES address, cut out bit 15 and use the result as the ROM file offset.

Should be like this

Code: Select all

// ...
const Bit15 = 1 SHL 15;  Bits15 = Bit15 - 1;
// ...

Offset := (SNES_Address.Bank SHL 15) OR (SNES_Address.Offset AND Bits15);

EDIT: I should note that byuu has a database of SNES games and game cartridge boards. You can calculate the SHA256 of your ROM and look up its specifications. For example SMW has a board ID of "SHVC-1A1B-06", and looking that up in the board list shows where ROM and RAM are mapped and what address bits are masked (cut out) to get the file offset.
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
urbanspr1nter
Posts: 39
Joined: Thu Aug 16, 2012 7:55 pm

Re: Dumb question about mapping ROM

Post by urbanspr1nter »

Sweet! Thanks for the tip. It was initially hard to wrap my head around the address calculation but this got me started.
Post Reply