It is currently Mon Oct 23, 2017 1:54 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
PostPosted: Thu Sep 21, 2017 5:32 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 285
I'm actually in the process of rewriting the whole thing using the test you made instead, much easier to understand with actual numbers on the screen.

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.


Top
 Profile  
 
PostPosted: Thu Sep 21, 2017 8:01 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 285
Ok, here we go again.
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.
Attachment:
output.png
output.png [ 22.85 KiB | Viewed 318 times ]

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.


Attachments:
FdsIrqTestsV6.zip [8.34 KiB]
Downloaded 12 times


Last edited by Sour on Thu Sep 21, 2017 8:06 pm, edited 1 time in total.
Top
 Profile  
 
PostPosted: Thu Sep 21, 2017 8:04 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
Any chance of testing Disk IRQs?


Top
 Profile  
 
PostPosted: Thu Sep 21, 2017 8:50 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5736
Location: Canada
V6 result::

Code:
01 O 00
02 O 01
03 X 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


Did not see any power-on variations over ~15 tests.


Top
 Profile  
 
PostPosted: Thu Sep 21, 2017 9:03 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 285
Awesome - finally some conclusive results! Thanks for taking the time to do all these tests!

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.


Top
 Profile  
 
PostPosted: Thu Sep 21, 2017 9:14 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5736
Location: Canada
I don't have a disk drive. (I used to, but I couldn't get it to work, so I gave it to someone else.)

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?


Top
 Profile  
 
PostPosted: Thu Sep 21, 2017 9:52 pm 
Online

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6301
Location: Seattle
The Disk Drive cable itself is just three digital signals from the base station (written to via $4025), three signals from the base station (read via $4032), the battery voltage (read via $4033), the serial transmit and receive streams, ground, +5V, and the twelfth pin is unused.


Top
 Profile  
 
PostPosted: Thu Sep 21, 2017 9:54 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:52 pm
Posts: 361
Location: UT
No, the drive itself doesn't generate IRQs. There should be no difference between using a FDSStick and a real drive for IRQ testing. You MIGHT want to load only your test rom onto fdsstick, removing any other games. This will bypass the boot menu and load your rom directly.

I'll leave this here, it seems relevant.


Top
 Profile  
 
PostPosted: Thu Sep 21, 2017 10:23 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5736
Location: Canada
I didn't realize there was a bootloader now! I was still using the original release. :) I'll have to try that out.

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...


Top
 Profile  
 
PostPosted: Fri Sep 22, 2017 12:35 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5736
Location: Canada
Hm! Very curious. I tried modifying my IRQ logging program, in particular to skip calling the BIOS reset to start the program (which normally writes to $4023). I found if I wrote $00 or $83 to $4023 once, nothing unusual happened, but if I skipped writing to it altogether, I got a variety of things happening (sirq2_no_reset.fds):

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?


Attachments:
sirq2.zip [6.76 KiB]
Downloaded 12 times
Top
 Profile  
 
PostPosted: Fri Sep 22, 2017 2:21 pm 
Offline

Joined: Tue May 28, 2013 5:49 am
Posts: 809
Location: Sweden
I got identical results with FdsIrqTestsV6 as Rainwarrior as usual. But I only tested once, power cycling made the disk image corrupt somehow and it wouldn't start anymore (error 22).

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. :)

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.)
Yeah sorry about that, I failed to produce monospaced hearts somehow, lacking love I guess.


Top
 Profile  
 
PostPosted: Fri Sep 22, 2017 2:33 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 285
That could actually explain the difference with the old version of the test - each test writes $83 to $4023 before starting to reset any changes I make to the disk enabled register in some of the tests. Maybe that's why this one doesn't freeze up - the I flag doesn't get cleared until after that $83 write, so any disk irqs would essentially be ignored.

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.


Attachments:
FdsIrqTestsV7.zip [8.54 KiB]
Downloaded 21 times
Top
 Profile  
 
PostPosted: Fri Sep 22, 2017 6:22 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
Care to explain each test with a "X", please?


Attachments:
fdsirqtestsv7 000.png
fdsirqtestsv7 000.png [ 28.52 KiB | Viewed 190 times ]
Top
 Profile  
 
PostPosted: Fri Sep 22, 2017 6:47 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5736
Location: Canada
Code:
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


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.


Top
 Profile  
 
PostPosted: Fri Sep 22, 2017 7:07 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 285
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.
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?

Zepper wrote:
Care to explain each test with a "X", please?
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: Bing [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group