It is currently Sat Sep 21, 2019 2:15 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Halt check during halt
PostPosted: Sun Dec 16, 2018 11:58 am 
Offline

Joined: Wed Jun 15, 2016 11:49 am
Posts: 98
I've been working through Wilbert Pol's tests (which are variants of gekkio's with more variations) and so far for regular gameboy I am able to pass them all.

But once I started working on GBC variants things started to not add up. The tests that didn't require a halt seem to work ok (except for edge case LY ones) but basically all the ones using halt were failing.

For GB, when I do halt, I do the check for IRQs on the first cycle of each 4 cycle HALT loop. This works for GB and seems to be correct.

But for GBC, it seems like I need to do the check on the third cycle. Then all the tests magically pass for it too. Also doing this doesn't seem to negatively effect anything that I can measure.

For reference, all normal instructions check on the third cycle. I'm pretty sure this was mentioned by Gekkio somewhere.

Does anyone have any insight into this? It certainly seems correct, but I don't have any other point of reference besides these tests.


Top
 Profile  
 
PostPosted: Fri Jan 04, 2019 6:18 pm 
Offline
User avatar

Joined: Fri Jan 04, 2019 5:31 pm
Posts: 41
Location: France, right of a pile of consoles
I have asked Liji, developer of SameBoy (possibly the most accurate GB emulator as of now), about STAT interrupt timings. (Basically by how much I can expect the ISR to be delayed from HBlank due to for example multi-cycle instructions)

He mentioned that on DMG exclusively, the interrupt might be serviced one M-cycle earlier if HALT was being executed at the time the interrupt is asserted.
That probably means that what you're doing is correct, but in the worst case, maybe you could check against SameBoy's code (which afaik passes these tests.)

_________________
The French Lord of Laziness (and a huge Legend of Zelda fan)
https://github.com/ISSOtm
ASMu is laifu <3


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: Google Adsense [Bot] and 2 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