SNES-Memorymap.txt 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. SNES Memory Mapping
  2. by
  3. Duncanthrax of ShadowCraft
  4. Version: 1.0
  5. Date: August 28, 1997
  6. Introduction:
  7. This is a little document I'm throwing together as I go. It probably has a few innacuracies, but it's certainly better than nothing.
  8. I became frustrated with the lack of solid knowledge and documentation regarding memory in the SNES, all the other maps
  9. were very incomplete. So, since I'm building an emulator at the moment, I figured I'd write all this down for posterity.
  10. If you find anything in here that is wrong, or if you have an additions or questions, or suggestions... or if you want to help
  11. with the emulator, mail me at:
  12. odin@ccs.neu.edu
  13. Or check out ShadowCraft's web page at:
  14. http://shadowguild.home.ml.org
  15. Have fun, and I hope this is helpful.
  16. *---------------------------------------------------*
  17. SNES Memory Map in LoROM Mode (Mode 0x20):
  18. Bank: Address: Purpose:
  19. ----- -------- --------
  20. 00-3F 0000-1FFF Shadow RAM
  21. 2000-5FFF Hardware Registers
  22. 6000-7FFF Expansion RAM
  23. 8000-FFFF 32k ROM Chunk
  24. 40-7C 0000-7FFF 32k ROM Chunk
  25. 8000-FFFF 32k ROM Chunk
  26. 7D 0000-FFFF SRAM
  27. 7E 0000-1FFF Shadow RAM
  28. 2000-FFFF System RAM
  29. 7F 0000-FFFF System RAM
  30. 80-BF 0000-1FFF Shadow RAM
  31. 2000-5FFF Hardware Registers
  32. 6000-7FFF Expansion RAM
  33. 8000-FFFF 32k ROM Chunk
  34. C0-FC 0000-7FFF 32k ROM Chunk
  35. 8000-FFFF 32k ROM Chunk
  36. FD 0000-FFFF SRAM
  37. FE 0000-1FFF Shadow RAM
  38. 2000-FFFF System RAM
  39. FF 0000-FFxx System RAM
  40. FFxx-FFFF Reset and NMI Vectors
  41. SNES Memory Map in HiROM Mode (Mode 0x21):
  42. Bank: Address: Purpose:
  43. ----- -------- --------
  44. 00-3F 0000-1FFF Shadow RAM
  45. 2000-5FFF Hardware Registers
  46. 6000-7FFF SRAM
  47. 8000-FFFF 32k ROM Chunk
  48. 40-7D 0000-FFFF 64k ROM Chunk
  49. 7E 0000-1FFF Shadow RAM
  50. 2000-FFFF System RAM
  51. 7F 0000-FFFF System RAM
  52. 80-BF 0000-1FFF Shadow RAM
  53. 2000-5FFF Hardware Registers
  54. 6000-7FFF SRAM
  55. 8000-FFFF 32k ROM Chunk
  56. C0-FE 0000-FFFF 64k ROM Chunk
  57. FF 0000-FFxx 64k ROM Chunk
  58. FFxx-FFFF Reset and NMI Vectors
  59. *--------------------------------------------*
  60. Now that I've given you the overview of the memory layout, perhaps a little explanation would be in order.
  61. We'll start at 00.0000 and work our way up... in LoROM first, then HiROM - to avoid confusion.
  62. 00-3F 0000-1FFF Shadow RAM
  63. What's going on here? Well, this is RAM that is the same in every bank up to and including 7E. It's the first
  64. 8k of System RAM. So, if you write 0x42 to 00.1001, you'll read a 0x42 from 7E.1001. Simple, huh?
  65. 00-3F 2000-5FFF Hardware Registers
  66. This is where you do graphics hardware calls, BIOS calls, DMA calls, and all that stuff. There are lots and
  67. lots of documents on this, all of them confusing. I may write one later on that clarifies a bunch of stuff, but
  68. for now I won't go into greater detail, as this is pretty straightforward... read and write values that interact
  69. with hardware.
  70. 00-3F 6000-7FFF Expansion RAM
  71. This is one of those areas in which I draw a blank. I'm not certain where this RAM is supposed to map,
  72. whether it is part of system RAM or what. Anybody who wants to clarify the purpose of this area of RAM
  73. can feel free. I've seen at least two cartridges that access this area...
  74. 00-3F 8000-FFFF 32k ROM Chunk
  75. 40-7C 0000-7FFF 32k ROM Chunk
  76. 8000-FFFF 32k ROM Chunk
  77. This bears a little explanation. When the LoROM is loaded into memory, this is where it is mapped
  78. (in a real SNES it isn't "loaded" at all - just mapped). The first 64 32k chunks are loaded into the upper half
  79. of banks 00-3F. Then, you continue at 40, mapping two (2!) 32k chunks in each bank from 40-7C. This
  80. should take care of an entire LoROM. I know that theoretically a LoROM could be slightly bigger than this,
  81. but I've never seen one that is...
  82. 7D 0000-FFFF SRAM
  83. OK, this is pretty obvious. This is where the battery-backed SRAM on cartridges is mapped. Very simple.
  84. Most have 64kb. DOOM, I've heard, has 256kb. Copiers have 256kb. Simple.
  85. 7E 0000-1FFF Shadow RAM
  86. 2000-FFFF System RAM
  87. 7F 0000-FFFF System RAM
  88. Also very simple. This is the SNES's 128k of RAM. There, that was easy, right?
  89. 80-FF 0000-FFFF MIRROR!
  90. The upper area of the SNES's addressing space is for "Fast ROM". Games will use this area instead of
  91. the lower area (they're mapped exactly the same) when they want to run faster. The SNES gains 1Mhz
  92. of speed this way.
  93. The only thing that is different about the upper area is that the vectors for reset and NMI get stored in
  94. the FF.FFxx last 32 bytes...
  95. *-------------------------------------------*
  96. LoROM vs. HiROM!
  97. OK, this is the most interesting part of SNES mapping, and also the part where I'm most likely to get
  98. something wrong. As always, if this is incorrect or confusing, let me know!
  99. 00-3F 0000-5FFF Same as LoROM
  100. 00-3F 6000-7FFF 8k SRAM Chunk
  101. 00-3F 8000-FFFF 32k ROM Chunk
  102. 40-7D 0000-FFFF 64k ROM Chunk
  103. Ok, this is not too hard, with one caveat... the first 64 32k chunks of the HiROM cartridge get loaded
  104. into 00-3F, and then it REPEATS FROM THE BEGINNING starting at 40.0000, this time going in 64k
  105. chunks until the end of the file. Now, people are about to start yelling about how this doesn't leave
  106. room for the last 2 64k chunks of a 32mb ROM. Yes, I know... keep reading.
  107. 7E-7F 0000-FFFF Same as LoROM
  108. Note 7D is no longer the SRAM, which is now in the expansion ram area.
  109. 80-FD 0000-FFFF Same as LoROM
  110. FE-FF 0000-FFFF 64k ROM Chunk
  111. Aha! Here it is... the last two chunks of a 32mb ROM (i.e. Chrono Trigger, etc.) get loaded here.
  112. Remember as always that the last 16 bytes are for vectors, and you're all set!
  113. *--------------------------------------------*
  114. Ok kiddies! That was a quick tour through the SNES memory map. Tune in next time for
  115. "Dr. Duncanthrax teaches CPU!" - same Bat Time, same Bat Channel!