Repository navigation
Commit 121f666
docs(accuracysnes): AccuracySNES found an ares bug — $F1's timer-2 reset is inverted (#308)
E3.06 and E8.02 were the two ares divergences not attributable to a known
snes9x failure, and both read 0 from every timer-2 slot they record. One
mechanism explains both, and it is visible in ares/sfc/smp/io.cpp's $F1
handler:
if(timer0.enable.raise(data.bit(0))) { timer0.stage2 = 0; ... }
if(timer1.enable.raise(data.bit(1))) { timer1.stage2 = 0; ... }
if(!timer2.enable.raise(data.bit(2))) { timer2.stage2 = 0; ... }
// ^ negated, and only here
raise() is true on a 0->1 transition, so timers 0 and 1 reset their counters
ON a raise -- the documented behaviour. Timer 2 resets on anything EXCEPT a
raise, so every later $F1 write clears it, including the write that stops the
timer. Both rows enable timer 2, run an interval, write $F1 again to stop it,
then read $FF; in ares that stopping write has already zeroed T2OUT.
ares is internally inconsistent here, which is the strongest evidence
available that this is a stray `!` rather than intent: its own timers 0 and 1
do the un-negated version, and RustySNES, snes9x and Mesen2 all treat the
three identically (rustysnes-apu/src/lib.rs's 0x01 arm resets stage2/stage3
only when `raised`).
This is the first bug in a reference emulator AccuracySNES has found, and it
took the third opinion to see: with only snes9x and Mesen2 both rows passed
everywhere and there was nothing to investigate.
E3.06's own weakness stands separately -- its 8..15 band still ends one tick
short of TnOUT's 4-bit wrap, which is why the previous change made it record
its counts.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 122ef84 commit 121f666
2 files changed
Lines changed: 59 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
14 | 40 | | |
15 | 41 | | |
16 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
| 42 | + | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
57 | 87 | | |
58 | 88 | | |
59 | 89 | | |
| |||
0 commit comments