News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

### Author Topic: SNES SRAM mapping question  (Read 2924 times)

• RHDN Patreon Supporter!
• Full Member
• Posts: 180
• FF6 hacker
##### SNES SRAM mapping question
« on: December 16, 2016, 02:04:25 am »
I'm having a hard time understanding a hack that deals with SRAM.

What exactly is the difference between STA \$306000,X and STA \$3F6000,X or \$3C6000,X?

According to the Hi-ROM memory map (and my understanding), there is one SRAM block at \$30-\$3F->\$6000-\$7FFF. This mean there is a SINGLE block of \$2000 bytes right, and not 16 blocks of \$2000 bytes scattered through 16 banks?

Does it mean each bank holds \$200 bytes and writing to \$3E6000,X write to SRAM \$7C00,X (given X  = 0)?

What role does the bank play when using a LDA or STA instruction when writing/reading to/from SRAM?

#### KingMike

• Forum Moderator
• Hero Member
• Posts: 7152
• *sigh* A changed avatar. Big deal.
##### Re: SNES SRAM mapping question
« Reply #1 on: December 16, 2016, 11:41:17 am »
Yes, it probably just one 8KB bank, repeated at those 16 locations.
"My watch says 30 chickens" Google, 2018

#### Revenant

• Full Member
• Posts: 206
##### Re: SNES SRAM mapping question
« Reply #2 on: December 16, 2016, 06:27:48 pm »
Most HiROM carts have SRAM mapped in banks 20 through 3F, but how they are mirrored depends on the actual amount of SRAM on the cartridge. If there's only 8kb of SRAM then it will appear in every bank; higher amounts will be split up into 8kb segments and repeated fewer times each. If 256kb is used, then each of the banks 20-3F will have a different 8kb segment mapped to them.