I stared at the reset/init code for a while and couldn't really see anything that would be different between power on/reset (but I'm definitely not qualified for this).
I added some tests, removed some leftover unused code from the template (that should have no impact) and modified it to use the copyright screen skip technique.
#1 - Validate that IRQ doesn't repeat when $4022.0 is cleared
#2 - Validate that IRQ repeats when $4022.0 is set
#3 - Validate that IRQ reload value is kept even when $4022.0 is cleared
#4 - Validate that writing $00 to $4023 clears IRQ enabled flag
#5 - Validate that writing to $02 to $4023 does not acknowledge the IRQ
#6 - Validate that writing to $4020 does NOT acknowledge the IRQ
#7 - Validate that writing to $4021 acknowledges the IRQ
#8 - Validate that writing to $4022 acknowledges the IRQ when bit 1 is cleared
#9 - Validate that writing to $4022 acknowledges the IRQ when bit 1 is set
#10 - Validate that IRQ reload value is not cleared when $4022 is set to $00
#11 - (Copy of test 3) Validate that IRQ reload value is kept even when $4022.0 is cleared
#12 - Validate that writing $02 to $4022 while counter is running will reset counter
#13 - Validate that writing $02 to $4022 when irq reload value is $00 does not trigger an irq
#14 - Validate that no IRQ occurred before the tests started
Note: I deleted the old #10 test since it failed on the FDS (and it was essentially the opposite of another test).
Test #14 is the first one to run, I just didn't want to change the order of all the previous tests visually. It does:
Code:
lda #$C0
sta $101
cli
to enable IRQs, and then waits for ~400k cpu cycles - during which no IRQ should occur.
Test #11 is an exact copy of #3 - so they *should* get the same result (unless the state is inconsistent between both tests)