Falcon030 Blitter emulation in Hatari

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: 820
Joined: Mon Aug 30, 2010 8:36 am
Contact:

Falcon030 Blitter emulation in Hatari

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.
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: 1432
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: 820
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: 1252
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: 820
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: 1252
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: 820
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: 1252
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 ?


Social Media

     

Return to “Hatari”

Who is online

Users browsing this forum: No registered users and 1 guest