Previous  1, 2, 3  Next
Mid-frame HDMA related issue? 
Author Message
User avatar

Joined: 2015-01-17 08:36
Posts: 14
 Re: Mid-frame HDMA related issue?
byuu wrote:
My best advice: start your HDMA process one scanline later, and skip the first line counter at the start of the table. Instead, put the values you want written there. Make sure $43xA (line counter) is $01, so that it gets reloaded after the first line. Now make the rest of your table as normal, but with the first table line counter decremented by one. Very hacky, but ... it may work.

so this would have to be done only if HDMA channels are/were active during the frame? which i guess is simply checking if the $420C mirror (or a mirror of that, since it'll be written to during the frame) is nonzero

edit: preliminary rushed testing shows that it can work (though there's obviously borked results on existing emulators)

CaptainJistuce wrote:
Regardless of the outcome, Ladida, we applaud your dedication in testing this on real hardware and then helping byuu find the error.

np ;)


and thanks for looking into this


2017-08-09 06:01
User avatar

Joined: 2014-09-25 13:52
Posts: 8294
 Re: Mid-frame HDMA related issue?
> so this would have to be done only if HDMA channels are/were active during the frame?

Specifically, at the very start of the frame.

In my code, hdmaInitReset() is called around V=0,Hcycle=12 (Hdot=3). If even one single HDMA channel is enabled at this point, then the full hdmaInit() runs. The full hdmaInit() is much more intensive, has to synchronize the CPU to the DMA clock, transfer data around, and synchronize back to the CPU clock.

I think it's reasonably safe to say that in stock Super Mario World, HDMA init always runs. Unless you hacked that out, you shouldn't need to test and can just assume this is how things work.

Even if the specifics of how I emulated this behavior are wrong, it's clear what's going on is the HDMA is doing a transfer early without fetching the line counter. So my fix will work for you on hardware even if I still have more research to do.

> edit: preliminary rushed testing shows that it can work (though there's obviously borked results on existing emulators)

Yes, that was the "not really an easy workaround" part :|

Even when I fix this, people aren't going to be very happy to have to use either real hardware or the next release of higan. The few people even willing to use my emulator mostly stick to v073 over gamepaks, and now the lack of the balanced/performance profiles.

I presume a couple of my emulator forks will update, since I'm good about sharing my findings with others. Many of the popular forks won't update it though.

Snes9X ... I don't know. Maybe one of the active devs would be interested in fixing for v1.55, but look how long it took v1.54 to come out (about 4-5 years ...) so uhm ... yeah.

My personal feeling is, you should only concern yourself with real hardware. Break all the emulators. If you're really generous, offer a "flawed emulator" mode patch. Even if it's a bug I haven't fix yet. A bug is a bug.

_________________
What the hell's going on? Can someone tell me please?
Why I'm switching faster than the channels on TV.
I'm black, then I'm white. No, something isn't right.
My enemy's invisible, I don't know how to fight.


2017-08-09 06:27
User avatar

Joined: 2014-09-27 09:56
Posts: 1688
 Re: Mid-frame HDMA related issue?
Do you think this is something that can be implemented in Snes9x or does it heavily rely on cycle-accurate timing?

_________________
byuu wrote:
Surely I can unite the vi vs emacs crowd like I have the ZSNES vs Snes9X crowd :)



higan WIP builds available here


2017-08-09 06:59
User avatar

Joined: 2014-09-25 13:52
Posts: 8294
 Re: Mid-frame HDMA related issue?
qwertymodo wrote:
Do you think this is something that can be implemented in Snes9x or does it heavily rely on cycle-accurate timing?


Yes, this can be added to Snes9X.

But we should wait a while to make sure my fix is correct. I'm going to break with norms and add this fix to the next higan WIP. If we can get people to stress test a bunch of games with the change, then we can either prove it's wrong, or greatly increase our confidence that it's correct.

It's actually a pretty major deal if my fix is correct: it basically means you can't start an HDMA channel in the middle of a frame reliably. That's ... a really big change. And yet, I'm not seeing any breakage so far, so I'm guessing SNES developers had some idea there was issues with doing so and actively avoided it.

_________________
What the hell's going on? Can someone tell me please?
Why I'm switching faster than the channels on TV.
I'm black, then I'm white. No, something isn't right.
My enemy's invisible, I don't know how to fight.


2017-08-09 07:30
User avatar

Joined: 2014-09-27 09:23
Posts: 2201
Location: Germany
 Re: Mid-frame HDMA related issue?
byuu wrote:> Yeah, happens on my SNES.Sorry, but can you (and anyone else who tests on hardware) please be more specific@Do you see the gradient or do you not@ What revision of SNES do you have@ (eg 1/1/1, 2/1/3, 1CHIP, etc.) What are you using to run the game on hardware with@ (eg sd2snes, etc.)Sorry, didn't check the board until now. Output is the same as delinom's video. Hardware is listed here.

_________________
My setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → Multi Out to SCART cable → EuroSCART to Mini cable → Framemeister (with Firebrandx' profiles) → AVerMedia Live Gamer Extreme capture unit → RECentral 4 viewing/recording software


2017-08-09 08:06
User avatar

Joined: 2014-09-27 09:56
Posts: 1688
 Re: Mid-frame HDMA related issue?
I'm having a bit of trouble understanding the issue and the fix in terms that are codebase-agnostic. Can you describe the behavior in question here? You say that you can't start an HDMA channel in the middle of a frame reliably, but what does that mean in terms of what the system is actually doing (at least assuming that this fix is correct)?

_________________
byuu wrote:
Surely I can unite the vi vs emacs crowd like I have the ZSNES vs Snes9X crowd :)



higan WIP builds available here


2017-08-09 21:05
User avatar

Joined: 2014-09-27 09:27
Posts: 1222
 Re: Mid-frame HDMA related issue?
byuu wrote:
But we should wait a while to make sure my fix is correct. I'm going to break with norms and add this fix to the next higan WIP. If we can get people to stress test a bunch of games with the change, then we can either prove it's wrong, or greatly increase our confidence that it's correct.


I've tested maybe 30 games and haven't noticed anything. Going to hold off on a full test until more fixes are made, including the ones jwdonal is withholding.

_________________
GB/GBA Buglist for Higan 103r26


2017-08-10 02:14
User avatar

Joined: 2014-09-25 13:52
Posts: 8294
 Re: Mid-frame HDMA related issue?
FitzRoy wrote:
Going to hold off on a full test until more fixes are made, including the ones jwdonal is withholding.


This may well have been it. Or his fix could even be a bad test ROM that fails on some hardware, and he doesn't actually have anything new. I'm not saying he doesn't have a fix, but without any evidence I'm not going to obsess over it, nor should anyone else. Either he discloses the issue and I fix it, or it's irrelevent since nobody can even confirm what he's saying actually exists.

He's not giving it up unless we give him $400,000 first; which ... isn't going to happen. There isn't that kind of demand for an SNES FPGA core, or it would have been done already (by me even.) And a selling point of, "VeriSNES may break a future Super Mario World ROM hack that incorrectly runs okay on emulators one day" is not a very strong one.

_________________
What the hell's going on? Can someone tell me please?
Why I'm switching faster than the channels on TV.
I'm black, then I'm white. No, something isn't right.
My enemy's invisible, I don't know how to fight.


2017-08-10 03:47
User avatar

Joined: 2014-09-27 09:56
Posts: 1688
 Re: Mid-frame HDMA related issue?
The REAL money would be in an FPGA ZSNES clone ;)

_________________
byuu wrote:
Surely I can unite the vi vs emacs crowd like I have the ZSNES vs Snes9X crowd :)



higan WIP builds available here


2017-08-10 06:53

Joined: 2014-09-27 09:44
Posts: 966
 Re: Mid-frame HDMA related issue?
byuu wrote:
FitzRoy wrote:
He's not giving it up unless we give him $400,000 first; which ... isn't going to happen. There isn't that kind of demand for an SNES FPGA core, or it would have been done already (by me even.)


Kevtris is working on one, AFAIK.

_________________
"Even if b became the most amazing programming language the world has ever seen, I would not rewrite higan/icarus in it. I can 100% guarantee you of that." — byuu


2017-08-10 07:55
Previous  1, 2, 3  Next