Also improving a lot of stuff code-wise - slowly getting the hang of how to deal with IRQs in general, using macros and etc.
Also trying to assume as little as possible about the FDS' behavior in each test - e.g the last test you ran implies that writing $02 to $4022 when the reload value is set to 0 actually triggers an IRQ. If true, this invalidates some of the other tests.
I'll probably be done with that at some point tonight, so you might as well ignore the old code for now.
Completely re-written from scratch based on your test (thanks for that, btw!), with an output that's actually readable.
I've tried this on virtually all the emulators I had (FCEUX, Mesen, Nestopia, Nintendulator, RockNES, Nintaco, puNES, VirtuaNES) and it displays the result screen properly in all cases - so at least that's a start.
First column is test #, 2nd is pass/fail (X or O), 3rd is the number of irqs triggered during the test, the rest is a short description of what the test is trying to validate. The code is included along with the FDS file.
Edit: Pass/Fail column is obviously not really relevant until the test is validated on an FDS and updated to match.
- (8.34 KiB) Downloaded 200 times
Test 3 failing in this case is fine, since it was just me assuming the FDS' behavior.
Apparently writing $02 to $4022 will trigger an IRQ immediately if the reload value is $00 - so I guess the IRQ triggers whenever the timer is at 0, rather than when it reaches 0. One thing left to test might be checking if turning on the irq repeat flag when the reload is 0 makes the irq fire in an infinite loop (I'm assuming it would)
@Zepper I could be wrong, but I'm under the impression the FDSStick(?) is probably emulation the disk drive and its IRQs? (i.e the disk irqs probably can't be properly validated without actually writing the test rom to a FDS disk and loading that?)
I only have a vague understanding of how the disk loading & its irqs work, to be honest, so I probably couldn't write a test for it even if I wanted to.
I don't know much about the hardware, though. Does the disk drive itself generate IRQs or is that done internally? Is there actually any feasible way to differentiate FDSstick from a real disk?
I'll leave this here, it seems relevant.
I forgot about that thing with $4023, so my "spurious IRQ" test wouldn't have picked up on that since it doesn't mess with $4023. I should try again with it intentionally cleared...
1. Loads and runs normally.
2. Loads and runs, but disk activity never seems to stop. No IRQ, but the FDSstick keeps turning on the green light over and over. (Or in the plugged into USB mode, the progress bar keeps repeating from 0 to 100%.)
3. Hangs on black screen, disk activity never stops.
One time I even caught one IRQ in the log but I accidentally reset and I haven't been able to reproduce it. Not sure if I caused it accidentally by pressing buttons or moving my Famicom around too much etc.
So, at least one write to $4023 after the license bypass NMI seems to be needed to reliably stop the disk access, but sometimes it stopped normally anyway? I didn't managed to get any good leads on whether this can make an IRQ...
Anyhow, sorry this post isn't very good information but it feels like the function of $4023 is more complicated than just disable/enable? Does the BIOS really only write it twice on reset? And even then it makes a point of writing $00 before $83... is that more like a reset sequence?
- (6.76 KiB) Downloaded 203 times
I should mention that I also haven't updated my FDSStick so it's also not using the bootloader. Good to know that you can get around the bootloader by only writing one disk image though, I guess it's time for me to update it.
Yeah sorry about that, I failed to produce monospaced hearts somehow, lacking love I guess.rainwarrior wrote:(The alignment of those diagrams is off, for me, I think that heart isn't properly monospaced, but it should be clear from context where the columns lie.)
I made one final version to fix the expected result for the failed test, and add 2 more tests related to the behavior when the reload value is 0. I'm expecting these to pass on the FDS - if they do, this will probably be the last version of this for now. Disk IRQs can be in their own separate test, if I ever get around to looking at those.
I'll try to update the FDS page on the wiki with the information that was confirmed by these tests once I get a chance.
- (8.54 KiB) Downloaded 611 times
Code: Select all
01 O 00 02 O 01 03 O 01 04 O 02 05 O 00 06 O 00 07 O 20 08 O 20 09 O 01 0A O 20 0B O 01 0C O 20 0D O 01 0E O 00 0F O 01 10 O 00 11 O 01 12 O 04 13 O 04 14 O 04 15 O 40
That sounds oddly similar to what Pokun mentioned, too. But I can't really see how the test could be causing it - it does absolutely nothing after displaying the results. Maybe a bug with the FDSStick itself?rainwarrior wrote:I did a few power tests to see if there were variations (didn't see any) but a strange thing, though: after running sometimes a red light comes on for the FDSStick and never shuts off. If I power cycle while this is happening I think I end up corrupting the disk sometimes, and get an "err 32" trying to load after that.
All 3 should be caused by essentially the same thing: unlike what the wiki implies, the FDS's irq triggers whenever the counter is at 0 - not just when it reaches 0. So setting reload value to 0 and writing to $4022 to start the IRQ will trigger one immediately. If the repeat flag is enabled, this will cause a never-ending loop of IRQs.Zepper wrote:Care to explain each test with a "X", please?