Actual ROM address vs. SNES ROM Address

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
User avatar
bazz
Posts: 476
Joined: Fri Sep 02, 2011 8:34 pm
Contact:

Actual ROM address vs. SNES ROM Address

Post by bazz »

I am asking a quick question ( i believe )

What is the correlation between actual address in ROM chip in comparison to SNES Mapped ROM address, and what is the explanation behind this correlation???

I am not sure if / how / why in a LoRom model, the rOM at $8000 in SNES map is from actual ROM $0000. I am guessing this because the SNES ROM header docs say that in a headerless ROM the header info is just below $8000 (meaning SNES maps the ROM from $0000).. How and why is this so>
User avatar
bazz
Posts: 476
Joined: Fri Sep 02, 2011 8:34 pm
Contact:

Post by bazz »

and as far as Lorom, what further confuses me is that A15 is NC (which is kept permanent high?) So how is it so that the ROM address $0000 is used? wouldn't it always be $8000+?? or is it the other way around and ROM xx:$8000-$ffff can never be accessed??
User avatar
infiniteneslives
Posts: 2102
Joined: Mon Apr 04, 2011 11:49 am
Location: WhereverIparkIt, USA
Contact:

Re: Actual ROM address vs. SNES ROM Address

Post by infiniteneslives »

bazz wrote:I am asking a quick question ( i believe )

What is the correlation between actual address in ROM chip in comparison to SNES Mapped ROM address, and what is the explanation behind this correlation???

I am not sure if / how / why in a LoRom model, the rOM at $8000 in SNES map is from actual ROM $0000. I am guessing this because the SNES ROM header docs say that in a headerless ROM the header info is just below $8000 (meaning SNES maps the ROM from $0000).. How and why is this so>
Not sure if I'm helping or stating the obvious, but I'm not sure what you're confused about.

http://en.wikibooks.org/wiki/Super_NES_ ... memory_map

You do realize SNES $0000 - $7fff Are addressable locations or peices of hardware on the SNES that isn't the Cartridge. You don't want two separate pieces of hardware having the same address. So while $8000 on the SNES is the first byte of the Cartridge's ROM it's $0000 on the physical chip if that's how you want to think about it.

Since the ROM is asynchronous it needs a /CE signal that's properly clocked. That's why the SNES uses /CE to address cartridge ROM instead of raw A15.

Hope that helps.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Are you familiar with mapper 7 or 34 on the NES? LoROM on the Super NES ends up being laid out much the same way, except the bank number is held in registers on the S-CPU instead of registers on the cartridge.
User avatar
bazz
Posts: 476
Joined: Fri Sep 02, 2011 8:34 pm
Contact:

Post by bazz »

infinitesneslives - i follow except on the part that explains CE vs. A15. Maybe explaining why A15 is used in HiRom would help???

tepples - sorry, not familiar

The thing is that I have never actually learned about memory mapping address decoding etc etc. till the past couple weeks working on this electronics project. All of this info and learning has really helped to bridge the gap between programming software and now understanding how things physically are working as well, everything is really beginning to come together...

Also, my problem is that I do not know how SNES uses Address Bus A when making its memory map. I was under that impression that whatever Address Bus A was set to was the SNES memory map address, lol. but maybe not? maybe the SNES can set an address on the map to say $8000, then set address bus A to 0000 and call /CART for ROM at $0000??
User avatar
infiniteneslives
Posts: 2102
Joined: Mon Apr 04, 2011 11:49 am
Location: WhereverIparkIt, USA
Contact:

Post by infiniteneslives »

bazz wrote:infinitesneslives - i follow except on the part that explains CE vs. A15. Maybe explaining why A15 is used in HiRom would help???
Yeah sorry, I don't really have enough SNES knowledge to speak intelligently on the matter. I was many applying my NES and generic memory mapping knowledge with my first post to see if it helped.

But perhaps this article helps:
http://www.romhacking.net/forum/index.php?topic=10194.0
User avatar
MottZilla
Posts: 2835
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

The memory map is determined by the hardware that decodes signals to know what hardware needs to respond to an address.

LoROM maps 32K banks in each bank. HiROM maps 64K in each bank. However in certain banks (banks under $80?) I think only the last 32K of each bank is available. Meaning if you accessed bank $00, reads to under $8000 won't have the ROM respond. But if you read from $80 (I think) then it would.

It's kind of odd and I'm sure someone with hardware knowledge could explain what exactly is going on to result in that decoding. But as far as programming goes that is the basics, 32K banks versus 64K banks, with some special issues for 64K banks.

But you'll notice that it also means that the CPU Vectors always appear in the correct spot this way.
User avatar
bazz
Posts: 476
Joined: Fri Sep 02, 2011 8:34 pm
Contact:

Post by bazz »

MottZilla wrote:The memory map is determined by the hardware that decodes signals to know what hardware needs to respond to an address.

LoROM maps 32K banks in each bank. HiROM maps 64K in each bank. However in certain banks (banks under $80?) I think only the last 32K of each bank is available. Meaning if you accessed bank $00, reads to under $8000 won't have the ROM respond. But if you read from $80 (I think) then it would.

It's kind of odd and I'm sure someone with hardware knowledge could explain what exactly is going on to result in that decoding. But as far as programming goes that is the basics, 32K banks versus 64K banks, with some special issues for 64K banks.

But you'll notice that it also means that the CPU Vectors always appear in the correct spot this way.
but the way you say it.. sounds like the ROM header would never be at $7FC0, it would be at $FFC0, and this is apparently not the case going by the ROM header documentation I have found online for a headerless (TRUE and PURE) SNES ROM.
User avatar
MottZilla
Posts: 2835
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

Uh, you're right, it wouldn't be at $7FC0, it's at $FFC0 (relative to the CPU, not the File or ROM chip). That's because the CPU Vectors are up in the FFFA area. If the CPU vectors were not appearing here, the program wouldn't work. That's why a HiROM game's ROM file has the header and vectors at $FFC0 and LoROM has it at $7FC0 (32kb versus 64kb).
User avatar
bazz
Posts: 476
Joined: Fri Sep 02, 2011 8:34 pm
Contact:

Post by bazz »

you are talking as if we are programming from inside SNES.. No, I am using a device which I plug my SNES cart in to read the ROM.. So I am wondering what the ACTUAL rom address are..

if they are different, I want to know the process SNES uses to map memory, I want to know how Address Bus is used...
User avatar
kyuusaku
Posts: 1665
Joined: Mon Sep 27, 2004 2:13 pm

Post by kyuusaku »

If you are interfacing with a whole cartridge and not just the ROM, the address will be the same as when reading from the CPU. The bus signals are afterall exactly what the CPU uses to do anything.

LoROM is wired in a way where ROM A15 and up are transposed to CPU A16 and up. This has the effect of mapping 32k of ROM linearly across pages, but since CPU A15 has no effect on the ROM, technically the ROM decodes each 32k page to BOTH $0000-7FFF and $8000-FFFF of each bank so they're mirrored each page across entire address space. This is exactly how HiROM works too, except since A15 IS used, data is linear across each page and then across the address space.

Hopefully this will demonstrate:

Code: Select all

LoROM:
             $02:         $01:         $00:
             ------------------------------------
$FFFF-8000	ROM 32k #3	ROM 32k #2	ROM 32k #1
$7FFF-0000	ROM 32k #3	ROM 32k #2	ROM 32k #1


HiROM
             $02:         $01:         $00:
             ------------------------------------
$FFFF-8000	ROM 32k #6	ROM 32k #4	ROM 32k #2
$7FFF-0000	ROM 32k #5	ROM 32k #3	ROM 32k #1
Since the vectors always reside at the same CPU address, you can see why they're offset differently for either scheme in the ROM.

You can think of the ROM being mapped this way across the entire address space with some ranges disabled due to the SNES' complex /CE signal called /ROMSEL which takes many address lines into consideration including A15. In the disabled ranges the SNES maps WRAM, registers or nothing. Cartridges may decode things to empty space.
User avatar
bazz
Posts: 476
Joined: Fri Sep 02, 2011 8:34 pm
Contact:

Post by bazz »

kyuusaku, that is great thanks, I want you to hear about my project.

I have a Gameboy Cartridge Flasher that uses USB. and I am trying to forward thru an MBC5 cartridge to SNES connector so I can operate my own custom Flash cart. Before I do that I am trying to read the ROM header on my Super Mario World cartridge...

Now the way this works is that Gameboy only has Address lines A0-A15.. So for A16->A22 an MBC5 can get the job done. What I am trying to do is access SNES addresses thru the MBC5 -> SNES connector.

Now, in a Gameboy memory map, you would write MSb of rom bank to $3000-$3xxx and low byte of rom bank to $2000-2xxx. Now the Bank of $4000 bytes can be found at $4000-$8000

So.. What I was doing was Setting the bank to 1 (put 0 ->$3000, 1->$2000), and reading at $7FC0.. First I didn't even connect /CART to the gameboy cartridge, thinking that LOW = active.. maybe i should connect it to ground??? But then I ended up connecting /CART to /CS on gameboy thinking I could use it as /CART line and forget RAM operations for now.. Still, nothing seems to be working.. I am not sure what is wrong, maybe you can help???

Besides all this, I fear that I am 'combining' gameboy and SNES maps and EFFING it up somehow.. any insight??

pictures are at http://makeitbigyall.blogspot.com/

EDIT: also, i only have A0-A19 wired..
User avatar
bazz
Posts: 476
Joined: Fri Sep 02, 2011 8:34 pm
Contact:

Post by bazz »

NEVERMIND I GOT IT TO WORK :D

Image .. Image

The picture on the left is a little old... I added more (colorful :) wires for A16-A19, also I grounded the unused Address Lines as well as /CART, and this seemed to help.. =]

EDIT: and i forgot to get the 2nd byte on the checksum lol. in fact, the "checksum" byte is the 2nd byte for the checksum complement xD. oops, all fixed now

GBCF checksum is just the checksum for the packet that gets sent to the computer from my unit..
Post Reply