Permalink
Browse files

Extend mode 20 ("LoROM") SRAM mapping

Banks fe-ff were incorrectly omitted
  • Loading branch information...
mrehkopf committed Apr 30, 2017
1 parent fe47ec2 commit eda39099e4b0c0770284d22aa8dd3d7b24ba8c8c
Showing with 7 additions and 6 deletions.
  1. +2 −2 verilog/sd2snes/address.v
  2. +2 −2 verilog/sd2snes_cx4/address.v
  3. +3 −2 verilog/sd2snes_obc1/address.v
@@ -89,11 +89,11 @@ assign IS_SAVERAM = SAVERAM_MASK[0]
& &SNES_ADDR[14:13]
& !SNES_ADDR[15]
)
-/* LoROM: SRAM @ Bank 0x70-0x7d, 0xf0-0xfd
+/* LoROM: SRAM @ Bank 0x70-0x7d, 0xf0-0xff
* Offset 0000-7fff for ROM >= 32 MBit, otherwise 0000-ffff */
:(MAPPER == 3'b001)
? (&SNES_ADDR[22:20]
- & (SNES_ADDR[19:16] < 4'b1110)
+ & (~SNES_ROMSEL)
& (~SNES_ADDR[15] | ~ROM_MASK[21])
)
/* BS-X: SRAM @ Bank 0x10-0x17 Offset 5000-5fff */
@@ -51,13 +51,13 @@ wire [23:0] SRAM_SNES_ADDR;
/* Cx4 mapper:
- LoROM (extended to 00-7d, 80-ff)
- MMIO @ 6000-7fff
- - SRAM @ 70-7d/80-ff:0000-7fff
+ - SRAM @ 70-77:0000-7fff
*/
assign IS_ROM = ((!SNES_ADDR[22] & SNES_ADDR[15])
|(SNES_ADDR[22]));
-assign IS_SAVERAM = |SAVERAM_MASK & (&SNES_ADDR[22:20] & ~SNES_ADDR[15] & (SNES_ADDR[19:16] < 4'b1110));
+assign IS_SAVERAM = |SAVERAM_MASK & (~SNES_ADDR[23] & &SNES_ADDR[22:20] & ~SNES_ADDR[19] & ~SNES_ADDR[15]);
assign SRAM_SNES_ADDR = IS_SAVERAM
? (24'hE00000 | ({SNES_ADDR[19:16], SNES_ADDR[14:0]}
@@ -23,6 +23,7 @@ module address(
input [2:0] MAPPER, // MCU detected mapper
input [23:0] SNES_ADDR, // requested address from SNES
input [7:0] SNES_PA, // peripheral address from SNES
+ input SNES_ROMSEL, // SNES ROM access
output [23:0] ROM_ADDR, // Address to request from SRAM0
output ROM_HIT, // enable SRAM0
output IS_SAVERAM, // address/CS mapped as SRAM?
@@ -68,11 +69,11 @@ assign IS_SAVERAM = SAVERAM_MASK[0]
& &SNES_ADDR[14:13]
& !SNES_ADDR[15]
)
-/* LoROM: SRAM @ Bank 0x70-0x7d, 0xf0-0xfd
+/* LoROM: SRAM @ Bank 0x70-0x7d, 0xf0-0xff
* Offset 0000-7fff for ROM >= 32 MBit, otherwise 0000-ffff */
:(MAPPER == 3'b001)
? (&SNES_ADDR[22:20]
- & (SNES_ADDR[19:16] < 4'b1110)
+ & (~SNES_ROMSEL)
& (~SNES_ADDR[15] | ~ROM_MASK[21])
)
: 1'b0));

0 comments on commit eda3909

Please sign in to comment.