SA-1 Hardware Behavior
1) Banks $50-$5F and $70-$7F are mapped on SA-1 CPU side.
$50-$5F is BW-RAM mirror. That means everything between banks $40 and $5F is BW-RAM. Does that mean SA-1 could map up to 2 *MEGABYTES* of RAM?
There is no such answer for that. There are only enough pins for 256 *KILOBYTES* of RAM.
There is no info about how to activate 256KB of BW-RAM, but please make $00:FFD8 = #$08 give 256 KB for SA-1 and not 0 KB currently.
Only banks $40-$4F and $60-$6F are mapped on SNES side.
$70-$7F is the virtual memory mapping as well (so it continues the data though $60-$6F).
Virtual memory allows reading only two or four bits of the BW-RAM, useful for storing packed 4bpp or 2bpp pixels.
You can also **read** the virtual memory region just fine. The official SNES doc only stated about **writing** to said region.
- SA-1 VARIABLE LENGTH BIT PROCESSING**
The circuit responsible for the SA-1 bit stream feature has a few oddities.
1) It only accepts even addresses. The least significant bit is completely ignored.
That means ROM addresses like $00:8001 will be read as $00:8000 instead.
2) The address expects the actual memory map. However regions that does not map to ROM will just mirror to bank 0 instead
For example, $00:0000-$00:7FFF is the same as $00:8000-$00:FFFF.
Even worse, for banks $40-$7F, *everything* is bank 0 mirror (LoROM!)
$41:8000 will actually mirror to $00:8000 (LoROM) and NOT $01:8000 like expected.
Banks $C0-$FF works as expected (HiROM).
In other words, divide the memory map in 32 KB blocks.
$00-$3F; $80-$BF: LoROM ($8000) $C0-$FF: HiROM Everything else: Mirror to bank 0.
Everything else includes banks $00-$3F; $80-$BF 32KB blocks of $0000-$7FFF and all 32KB blocks of banks $40-$7F.
Why are the odd addresses completely ignored? This is simple to explain: because the SA-1 ROM has a 16-bit bus, so the address is halved when tossed to the ROM circuit, discarding the low byte. It does not add any special treatment for reading the high byte first or something.
Variable Length Bit reading automatic mode DOES NOT WORK on my cart. It always automatically shifts 16-bit words regardless of the setting you select, when picking auto mode. This may need more studies. Fixed mode works fine.
- IMPORTANT**
You can enable FastROM on a SA-1 ROM.
What happens? The SA-1 chip is paused whenever SNES attempts a fast ROM reading, however it does not crash. The system is smart enough to allocate all of its I/O resources and hand to the SNES system.
However, that behavior only exists on the actual FastROM accesses. Accessing though DMA or banks $00-$7F, the SA-1 CPU speed is not affected.
This is extremely clever and even more if you consider that's only possible with the chip monitoring changes to the $420D register.
I have accidentally made HDMA access not use FastROM access and I ran out of erased ROM chips. But I need to make sure the speed is not affected by HDMA as well to confirm this. DMA reads from bank $C0 which is FastROM.
But is there any point in using FastROM on a SA-1 ROM if the chip will end up getting paused? Yes!
You can always trigger an IRQ when calling SA-1 on WRAM. That means if you only use SA-1 only or S-CPU only per time, you can get the best speed of both with 10.73 and 3.58 MHz, with one paused while the other one is running.