Jump to content
IGNORED

Maria DMA Cycles


wavemotion

Recommended Posts

So I'm working hard to clean up all of the cycle inaccuracies in my A7800DS emulator. It's based on ProSystem and so it's inherited some cycle problems. It looks like a lot of solid confirmed information has surfaced since the initial ProSystem emulation was developed - and I've been reading as much of it as I can to try and understand things.

 

I've got 90% of the timing stuff cleaned up - and just about everything is running pretty damn close to perfect but there is something I'd like to check:

 

image.thumb.png.0849b31a24c9a97376d1dec58f7cd75d.png

 

Does the highlighted statement of "no DMA penalty" mean that we don't incur the 3/6/9 cycle penalty if that fetch results in a DMA hole?  Right now A7800DS (and just about every ProSystem-based emulator) doesn't care if it's a DMA hole or a real data fetch... so the cycle cost is always counted.

 

  • Like 3
Link to comment
Share on other sites

19 minutes ago, llabnip said:

Does the highlighted statement of "no DMA penalty" mean that we don't incur the 3/6/9 cycle penalty if that fetch results in a DMA hole?  Right now A7800DS (and just about every ProSystem-based emulator) doesn't care if it's a DMA hole or a real data fetch... so the cycle cost is always counted.

Correct, and this is how I've implemented it in A7800.

 

The author of the 7800 core in the BizHawk emulator had some conflicting advice. I haven't been able to make that work with accuracy, so I'm not entirely sure there.

  • Like 1
Link to comment
Share on other sites

Super interesting read in your referenced thread. Man... this thing is like peeling an onion. Unfortunately, I'm really up against my CPU limit. Having a 67MHz ARM target is rather limiting (which is a challenge I've enjoyed!) but the nuances of the timing are starting to have an appreciable cost and I may back off to something a bit more 'simple' while maintaining 'reasonable' accuracy.  In the end, users want to blast rocks and destroy robots - and it won't do me any good to say "yeah, it's a little slow but it's cycle accurate!" :) 

  • Like 1
Link to comment
Share on other sites

You've done a fantastic job of optimising! Reading through your source recently, I was struck a few times about how clever you were about minimising conditional logic. :thumbsup:

 

Even PC based emulation does that same trade-off. We could be much more accurate if everything was emulated gates, but then everybody would have to play a very boring slideshow.

  • Like 4
Link to comment
Share on other sites

Thanks again @RevEng

 

So far in my early tests, things are working well with the streamlined and hopefully more accurate timing. One notable issues is Xevious.  I have to add an extra 16 Maria cycles to prevent the horizontal line from appearing.  It's easy enough to have a fudge factor for some games... but it's perplexing that I need more Maria cycle compensation to make that one run right. 

 

The other game is b*nQ which needs 3 fewer Maria cycles added (subtracted) to prevent small glitches on the title screen.

 

Which makes me think I'm still not quite there. But busy hands are happy hands :) 

 

Edit: in jettisoning some old ProSystem stuff to clean it up, I removed the compensation for a DLI. That compensation fixes Xevious.  So now it's just the odd game here or there that requires a couple of cycle tweak.  Better.

Edited by llabnip
  • Like 3
Link to comment
Share on other sites

Hi @llabnip,

I did some timing tests few months ago (for wsync and vblank timing)

I'm planning to do some Maria test as well (dma, holey, dli)

If you are interested I can attach later.

 

Below timing for this short code.

I'm also attaching DSLogic file (you can view under DsView, it's free)

 

Edit: Ignore spikes 10-30ns

 

loop_konsol
	jsr WaitVBLANK
	inx
	jmp loop_konsol

WaitVBLANK:	
WaitVBoff:
		stx 		$40
		bit		MSTAT
		bmi		WaitVBoff
WaitVBon:
		stx		$41
		bit		MSTAT
		bpl		WaitVBon
		sta 		$42
		sta 		Wsync
		stx 		BACKGRND
		rts

 

image.thumb.png.769d7353ffa26143a0d1acb63e79f825.png

DSLogic-la-220831-071756.dsl

Edited by Eagle
  • Like 4
Link to comment
Share on other sites

On 11/8/2022 at 11:08 AM, RevEng said:

You've done a fantastic job of optimising! Reading through your source recently, I was struck a few times about how clever you were about minimising conditional logic. :thumbsup:

 

Even PC based emulation does that same trade-off. We could be much more accurate if everything was emulated gates, but then everybody would have to play a very boring slideshow.

I agree!!

 

For the DS, it’s impressive!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...