Falcon030 Blitter emulation in Hatari [SOLVED!]

A forum about the Hatari ST/STE/Falcon emulator - the current version is v2.1.0

Moderators: simonsunnyboy, thothy, Moderator Team

User avatar
dhedberg
Atari Super Hero
Atari Super Hero
Posts: 831
Joined: Mon Aug 30, 2010 8:36 am
Contact:

Falcon030 Blitter emulation in Hatari [SOLVED!]

Postby dhedberg » Tue Oct 16, 2018 3:04 pm

Hi,

I'm working on a project at the moment where I use the Blitter in the Falcon030. The code works perfectly well on a real Falcon030 at 50fps, but in Hatari the Blitter seems to use more cycles than on the real machine. How exact are the Falcon030 blitter emulation in Hatari? I'm using the blitter in HOG mode. I suspect it's the Blitter as I've never experienced the emulation to be slower than the real computer when only the CPU is used. It's usually the opposite then. It's a bit sad because I guess this means it'll be hard to produce a nice looking video (using Hatari) of this thing I'm working on.
Last edited by dhedberg on Wed Dec 05, 2018 8:54 pm, edited 1 time in total.
Daniel, New Beat - http://newbeat.atari.org. Like demos? Have a look at our new Falcon030 demo MORE.

User avatar
troed
Atari God
Atari God
Posts: 1436
Joined: Mon Apr 30, 2012 6:20 pm
Location: Sweden

Re: Falcon030 Blitter emulation in Hatari

Postby troed » Tue Oct 16, 2018 6:10 pm

I think you'll get better answers on the Hatari dev mailinglist, but, in general the 68030 emulation is not cycle exact and especially not when interfacing with other components of the system.

User avatar
dhedberg
Atari Super Hero
Atari Super Hero
Posts: 831
Joined: Mon Aug 30, 2010 8:36 am
Contact:

Re: Falcon030 Blitter emulation in Hatari

Postby dhedberg » Wed Oct 17, 2018 11:44 am

Thanks for the reply. I'll have tun run some more tests to try and figure out what's going on. In some cases I rely on the fact that the blitter and CPU can run in paralell on the F030 as long as the instructions and data accessed after starting the blitter are precached (no bus activity by CPU). Perhaps Hatari doesn't emulate this fully.
Daniel, New Beat - http://newbeat.atari.org. Like demos? Have a look at our new Falcon030 demo MORE.

User avatar
npomarede
Atari God
Atari God
Posts: 1258
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Falcon030 Blitter emulation in Hatari

Postby npomarede » Wed Oct 17, 2018 1:33 pm

dhedberg wrote:Thanks for the reply. I'll have tun run some more tests to try and figure out what's going on. In some cases I rely on the fact that the blitter and CPU can run in paralell on the F030 as long as the instructions and data accessed after starting the blitter are precached (no bus activity by CPU). Perhaps Hatari doesn't emulate this fully.

Hi
this behaviour is fully emulated for STE, any prefetched opcode will run in parallel if the blitter is started with an instruction which does the write to control register at the end.
As for falcon blitter, I never tested it :)
Theoretically, I guess it could even run several instructions if they were all cached and if none of those instruction require some memory access (for example several MUL / DIV using only Dx registers)
But as said above, even in cycle exact mode, 68030 is not always cycle exact for now, several internal 68030 behaviours are still not known and they affect the way opcodes are prefetched and the way instructions tail/head can sometimes run in parallel.

So for now, I'm afraid you won't get similar results under Hatari as under real HW :(

Nicolas

Edit : it's possible the number of cycles per word access is also wrong in Falcon mode, if you see a x2 difference it could be the case. If you have a simple example (that don't spoil your demo :) ) in hog mode with a screenshot of a real falcon, I could have a look (I guess you're trying to change colors with blitter ?)

User avatar
dhedberg
Atari Super Hero
Atari Super Hero
Posts: 831
Joined: Mon Aug 30, 2010 8:36 am
Contact:

Re: Falcon030 Blitter emulation in Hatari

Postby dhedberg » Wed Oct 17, 2018 11:43 pm

Hi Nicolas,

It doesn't seem to be a x2 difference in cycles. I was on the very edge of using 100% CPU time on real hardware so not a big deal. A bit of optimizing and the problem was gone.

However, I discovered a much more serious problem today when I put on the headphones for the first time since I started playing around with the blitter. It seems like Hatari doesn't like semi-heavy use of the blitter while replaying a MP2 using the NoCrow MP2 player (which is pretty heavy on the DSP). Clearing 1 bitplane each frame in HOG mode (which doesn't require very many scanlines on a Falcon) is enough for Hatari to mess up the sound. Sounds like the replay of the MP2 slows down quite a bit. The frame-rate isn't affected, only the sound/replay speed. This doesn't happen on real hardware. I tried removing everything else, and was only playing back the MP2 and clearing 1 bitplane each frame, and the result was the same. If you'd be willing to look into it I'd be most thankful. If I can provide anything to assist you please let me know. I'll be pretty busy the coming 3-4 weeks but after that I'll have more time again.
Daniel, New Beat - http://newbeat.atari.org. Like demos? Have a look at our new Falcon030 demo MORE.

User avatar
npomarede
Atari God
Atari God
Posts: 1258
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Falcon030 Blitter emulation in Hatari

Postby npomarede » Thu Oct 18, 2018 8:11 am

Hi
yes at the moment, blitter was really oriented toward STE mode, not falcon. And while the blitter is in hog mode, the dsp part is also suspended (instead of running it in parallel).
This should be an easy fix in the blitter code, but if you could provide me one simple program that just play an MP2 and a 2nd version that play the same MP2 while running blitter in hog mode , it would allow me to check the fix is correct.

Also, you might subscribe to the hatari-devel mailing list if you have pending issues with falcon emulation, this is is often faster to interact (and not all hatari developpers are reading atari-forum)

Nicolas

User avatar
dhedberg
Atari Super Hero
Atari Super Hero
Posts: 831
Joined: Mon Aug 30, 2010 8:36 am
Contact:

Re: Falcon030 Blitter emulation in Hatari

Postby dhedberg » Thu Oct 18, 2018 1:10 pm

Hi,

Sounds great! I'll gladly provide you with some programs, but It'll be a few weeks before I have the time. I'll reach out to you once I have something ready! Thanks a lot! Appreciate it!
Daniel, New Beat - http://newbeat.atari.org. Like demos? Have a look at our new Falcon030 demo MORE.

User avatar
npomarede
Atari God
Atari God
Posts: 1258
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Falcon030 Blitter emulation in Hatari

Postby npomarede » Thu Oct 18, 2018 1:18 pm

No problem, take your time ; I'm also rather limited on spare time at the moment, so as long as problems are fixed in the end, there's no rush.

EDIT : just to know how you could test this later with the devel version, which OS do you use ? Do you compile Hatari yourself ?

User avatar
dhedberg
Atari Super Hero
Atari Super Hero
Posts: 831
Joined: Mon Aug 30, 2010 8:36 am
Contact:

Re: Falcon030 Blitter emulation in Hatari

Postby dhedberg » Wed Dec 05, 2018 4:41 pm

Hi,
npomarede wrote:No problem, take your time ; I'm also rather limited on spare time at the moment, so as long as problems are fixed in the end, there's no rush.

Sorry for taking so long, but I've now sent you a PM with test programs. Please let me know if you need anything else. Thank you for taking your time to look into this! Hopefully the fix won't be too hard and make it into the next release of Hatari.

npomarede wrote:EDIT : just to know how you could test this later with the devel version, which OS do you use ? Do you compile Hatari yourself ?

I use Windows 10. I have never compiled Hatari myself, but if I remember correctly there was some kind person that setup a build server with nightly Windows builds a while ago. Hopefully it's still available.

Thanks,
Daniel
Daniel, New Beat - http://newbeat.atari.org. Like demos? Have a look at our new Falcon030 demo MORE.

User avatar
npomarede
Atari God
Atari God
Posts: 1258
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Falcon030 Blitter emulation in Hatari

Postby npomarede » Wed Dec 05, 2018 4:44 pm

Hi
no problem for the long time :)
In the meantime, I updated Hatari anyway to run DSP too while biltter is working, hopefully it should fix the issue ; you can get the devel version here : http://antarctica.no/~hatari/latest/
I will also try later the test program you sent me.

Nicolas

User avatar
dhedberg
Atari Super Hero
Atari Super Hero
Posts: 831
Joined: Mon Aug 30, 2010 8:36 am
Contact:

Re: Falcon030 Blitter emulation in Hatari

Postby dhedberg » Wed Dec 05, 2018 5:15 pm

Cool! Thanks! Tried the devel version but unfortunately there was no improvement.
Daniel, New Beat - http://newbeat.atari.org. Like demos? Have a look at our new Falcon030 demo MORE.

User avatar
npomarede
Atari God
Atari God
Posts: 1258
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Falcon030 Blitter emulation in Hatari

Postby npomarede » Wed Dec 05, 2018 5:44 pm

I can hear the difference in your test programs ; there was a copy/paste error in the code for my previous fix, from what I hear, sound is now correct when DSP runs at the same time as DSP.
The devel version at antartica.no should be updated in a few minutes I think.
Thanks for the report

Nicolas

EDIT : by the way, sound quality of this MP2 replayer is really good, I can't really hear the difference between the emulated Falcon playing it and playing the MP2 file directly on my PC :)

User avatar
dhedberg
Atari Super Hero
Atari Super Hero
Posts: 831
Joined: Mon Aug 30, 2010 8:36 am
Contact:

Re: Falcon030 Blitter emulation in Hatari

Postby dhedberg » Wed Dec 05, 2018 8:50 pm

Wow! THANK YOU!

It works like a charm and I'm most grateful for your work! I usually develop on real hardware but sometimes I don't have access to it and then I rely 100% on Hatari, and with my latest project it's been hard since I started using the Blitter, but now everything works again!

I'd really like to contribute to the Hatari project but with the little time I have over in the evenings, I haven't really gotten into it. Instead I've spent the time on programming demos, which is something I truly love. The Hatari team received a special thank you in my last demo (More, http://www.pouet.net/prod.php?which=76786), and you'll receive another one in the coming demo. With that said, if you're open for donations I'll gladly donate some money to the team as Hatari has been extremely valuable to me!

PS. I loved your Hatari 2.1 intro! Hope to see something more from you soon! :-) DS.
Daniel, New Beat - http://newbeat.atari.org. Like demos? Have a look at our new Falcon030 demo MORE.

User avatar
npomarede
Atari God
Atari God
Posts: 1258
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Falcon030 Blitter emulation in Hatari

Postby npomarede » Wed Dec 05, 2018 9:06 pm

dhedberg wrote:Wow! THANK YOU!

It works like a charm and I'm most grateful for your work! I usually develop on real hardware but sometimes I don't have access to it and then I rely 100% on Hatari, and with my latest project it's been hard since I started using the Blitter, but now everything works again!

I'd really like to contribute to the Hatari project but with the little time I have over in the evenings, I haven't really gotten into it. Instead I've spent the time on programming demos, which is something I truly love. The Hatari team received a special thank you in my last demo (More, http://www.pouet.net/prod.php?which=76786), and you'll receive another one in the coming demo. With that said, if you're open for donations I'll gladly donate some money to the team as Hatari has been extremely valuable to me!

Thanks for your words, that's what keeps the Atari scene alive :)
Some are working on emulators or fpga clones, some are still coding demos or games, it's often on our spare time, but in the end it's always with the pleasure of keeping the spirit intact.
And even coding demo can be an indirect contribution to Hatari, because it sometimes show what needs to be improved in the emulator (your "More" demo was really nice and polished, lots of work involved)
As for donations, some people already offered to donate, but we don't have a proper structure to collect money. So in my case I would accept you buy a beer with this money instead and drink it to the good health of Hatari :cheers:

PS. I loved your Hatari 2.1 intro! Hope to see something more from you soon! :-) DS.

Opposite problem from you, I'd like to spend more time on coding demos, but working on the emulator itself takes a lot of time :)
A small intro is already on its way for next release, nothing groundbreaking, just a small thing to celebrate a new release.

Nicolas


Social Media

     

Return to “Hatari”

Who is online

Users browsing this forum: No registered users and 6 guests