SNES Burn-In Test Failure

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
SNES Burn-In Test Failure
by on (#184154)
I just ran the burn-in test on my FPGA SNES and there were 6 failing tests. 5 out of those 6 tests are features that I haven't implemented yet and so the failures make perfect sense. However, the H/V timer test also failed, and I have already (or at least I thought I did) implemented the logic for the H/V timers. So I'm bummed that it failed.

Does anyone have any details on what specifically this H/V timer test is doing or looking for? I can throw it in the BSNES debugger but just figuring out where/when the test is happening and what it's doing is going to take some effort. I thought I'd try and ping the forums and see if I get lucky first.
Attachment:
burn-in test result.png
burn-in test result.png [ 338.76 KiB | Viewed 2509 times ]
Re: SNES Burn-In Test Failure
by on (#184166)
It sets up various H/V IRQs using $4207-$420a and $4200. The IRQ ISR only reads $2137 once to have the PPU's H/V registers load the count values. It then disables H/V IRQ and waits for VBlank (via NMI ISR setting a flag that is polled in the main loop) to actually do the comparison.

The routine to read the previously-latched PPU counters resets the odd/even byte count of the PPU H/V counters by reading $213f, then reads $213c and $213d twice each.

Comparison is successful if 'carry set' for H count and 'equal' for V count.
H/V target values are:
$80/$01
$40/$02
$20/$04
$10/$08
$08/$10
$04/$20
$02/$40
$01/$80
Re: SNES Burn-In Test Failure
by on (#184167)
That is immensely helpful - thank you so much!
ikari_01 wrote:
Comparison is successful if 'carry set' for H count and 'equal' for V count.
I'm not entirely clear on what you mean here. Do you mean the C and Z flags of the CPU PS register? So it's comparing the values it read from the $213C/D registers against each of the 8 pairs of values that you listed right?
Re: SNES Burn-In Test Failure
by on (#184168)
Yes. Basically it stores its wanted and "measured" values in RAM, then does

Code:
(m=0)
  lda v_measured
  cmp v_reference
  beq ok
  bra error
ok:
  lda h_measured
  cmp h_reference
  bcc error
[...]
Re: SNES Burn-In Test Failure
by on (#184174)
Might want to be careful with testing against benchmarks or diagnostic tools, because you might "fix" the reporting only but not the actual problem. This is how hardware vendors end up shipping products that catch fire when actually used even though it passed tests :)

My only worry here (other than trying to be funny) is that if you're using a flash cart, you may actually induce bugs in the cart and fix those that only affect the diagnostic tool running on that cart.
Re: SNES Burn-In Test Failure
by on (#184175)
Oh, good point. I assume you disabled the in-game hooks on the sd2snes for running the tests. ;) Otherwise the hook routine will postpone latching of the PPU H/V counters by about half a scanline (because it hijacks the ISR), enough to make the test fail.