VitorVilela is doing amazing things with hardware SA1 bus conflict timing:
https://github.com/VitorVilela7/SnesSpeedTest
Some fascinating findings ...
$230e, the version control register, doesn't exist. It's open bus on both the SNES CPU and on the SA1. We should test with many more SA1 carts to be 100% sure, but so far it's looking like this doesn't exist. Overload reported getting $10 once, and we see pure open bus. It's possible Overload had $10 on the data bus when he read the SA1 CPU register, and possible his cart actually DID have this register.
The SA1 memory conflict occurs even on idle cycles of the SNES CPU.
The +1 cycle penalty for JMP/JML/JSR/JSL/RTS/RTL/RTI instructions only applies when the SA1 is running off of the ROM. It's actually a 2-clock (@ 21MHz) penalty, or a 4-clock penalty if the CPU is also accessing ROM during this time.
The SA1 executing out of ROM takes 2 cycles, or 4 cycles if the CPU is executing there too.
The SA1 executing out of BWRAM takes 4 cycles, or 8 cycles if the CPU is executing there too.
The SA1 executing out of IRAM takes 2 cycles, or 6 cycles if the CPU is executing there too.
I'm missing something when both the SA1 and CPU execute out of IRAM ... my timings are very very slightly slower than real hardware ...
The SA1 ROM itself is 16-bit (as is the SD Gundam G Next - Unit & Map Collection BS Memory Cassette ... and any BS Memory Cassettes on SA1 cartridges are treated as though they're in 16-bit configuration mode. You can't dump a 16-bit BS cart through a non-SA1 base cart, nor an 8-bit BS cart through an SA1 base cart.)
BWRAM is 8-bit. I have no idea what IRAM is internally.
There's apparently another penalty when you branch to an odd address, due to the 16-bit reads.
Only $2300 can be read by the SNES CPU, the rest of the I/O registers are for the SA1 only.
Writes are a whole lot more complicated.
The CPU can write to:
2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208
2220, 2221, 2222, 2223, 2224, 2226, 2228, 2229
The SA1 can write to:
2209, 220a, 220b, 220c, 220d, 220e, 220f
2210, 2211, 2212, 2213, 2214, 2215
2225, 2227, 222a
2230, 2238, 2239, 223f
2240 - 224f
2250, 2251, 2252, 2253, 2254, 2258, 2259, 225a, 225b
Both the CPU and SA1 can write to:
2231, 2232, 2233, 2234, 2235, 2236, 2237
Absolutely bizarre ... I really would have thought the CPU would be unable to write the DMA registers, if it can't write the actual DMA control register.
Now for the really wild stuff ... SNES CPU DMA timing.
His DMA ROM <> ROM test clocks at either ~5.07MHz or ~5.19MHz, and tends to flicker between the two.
His DMA ROM <> IRAM test clocks at ~10.63MHz, and is stable at that speed on real 2/1/3 hardware.
Here's a hardware recording of it in action:
https://cdn.discordapp.com/attachments/ ... -31-54.mkv
Many things seem to influence this in higan: whether the DMA/HDMA idle cycles happen before or after transfers, whether I try and emulate the branch to odd addresses penalty, etc.
So far at least, I can't quite match hardware no matter what combination I try.
...
This should be a fascinating area of research for nocash and Overload, should they be interested.
The SA1 is revealing internal CPU state (the address bus values) that's not readily observable under normal circumstances.
I believe that trying to read $2137 from CPU DMA and HDMA could help to validate this. I've not tried that before, surprisingly.
https://github.com/VitorVilela7/SnesSpeedTest
Some fascinating findings ...
$230e, the version control register, doesn't exist. It's open bus on both the SNES CPU and on the SA1. We should test with many more SA1 carts to be 100% sure, but so far it's looking like this doesn't exist. Overload reported getting $10 once, and we see pure open bus. It's possible Overload had $10 on the data bus when he read the SA1 CPU register, and possible his cart actually DID have this register.
The SA1 memory conflict occurs even on idle cycles of the SNES CPU.
The +1 cycle penalty for JMP/JML/JSR/JSL/RTS/RTL/RTI instructions only applies when the SA1 is running off of the ROM. It's actually a 2-clock (@ 21MHz) penalty, or a 4-clock penalty if the CPU is also accessing ROM during this time.
The SA1 executing out of ROM takes 2 cycles, or 4 cycles if the CPU is executing there too.
The SA1 executing out of BWRAM takes 4 cycles, or 8 cycles if the CPU is executing there too.
The SA1 executing out of IRAM takes 2 cycles, or 6 cycles if the CPU is executing there too.
I'm missing something when both the SA1 and CPU execute out of IRAM ... my timings are very very slightly slower than real hardware ...
The SA1 ROM itself is 16-bit (as is the SD Gundam G Next - Unit & Map Collection BS Memory Cassette ... and any BS Memory Cassettes on SA1 cartridges are treated as though they're in 16-bit configuration mode. You can't dump a 16-bit BS cart through a non-SA1 base cart, nor an 8-bit BS cart through an SA1 base cart.)
BWRAM is 8-bit. I have no idea what IRAM is internally.
There's apparently another penalty when you branch to an odd address, due to the 16-bit reads.
Only $2300 can be read by the SNES CPU, the rest of the I/O registers are for the SA1 only.
Writes are a whole lot more complicated.
The CPU can write to:
2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208
2220, 2221, 2222, 2223, 2224, 2226, 2228, 2229
The SA1 can write to:
2209, 220a, 220b, 220c, 220d, 220e, 220f
2210, 2211, 2212, 2213, 2214, 2215
2225, 2227, 222a
2230, 2238, 2239, 223f
2240 - 224f
2250, 2251, 2252, 2253, 2254, 2258, 2259, 225a, 225b
Both the CPU and SA1 can write to:
2231, 2232, 2233, 2234, 2235, 2236, 2237
Absolutely bizarre ... I really would have thought the CPU would be unable to write the DMA registers, if it can't write the actual DMA control register.
Now for the really wild stuff ... SNES CPU DMA timing.
His DMA ROM <> ROM test clocks at either ~5.07MHz or ~5.19MHz, and tends to flicker between the two.
His DMA ROM <> IRAM test clocks at ~10.63MHz, and is stable at that speed on real 2/1/3 hardware.
Here's a hardware recording of it in action:
https://cdn.discordapp.com/attachments/ ... -31-54.mkv
Many things seem to influence this in higan: whether the DMA/HDMA idle cycles happen before or after transfers, whether I try and emulate the branch to odd addresses penalty, etc.
So far at least, I can't quite match hardware no matter what combination I try.
...
This should be a fascinating area of research for nocash and Overload, should they be interested.
The SA1 is revealing internal CPU state (the address bus values) that's not readily observable under normal circumstances.
I believe that trying to read $2137 from CPU DMA and HDMA could help to validate this. I've not tried that before, surprisingly.