movem bug in 68020+ modes?

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

Moderators: simonsunnyboy, npomarede, thothy, Moderator Team

Post Reply
agranlund
Captain Atari
Captain Atari
Posts: 151
Joined: Sun Aug 04, 2019 1:49 pm

movem bug in 68020+ modes?

Post by agranlund »

Admittedly a very rare case but it appears Hatari is not emulating a specific use of movem correctly in 68020+ modes
Caught me a bit off-guard when trying to get some code going on real hardware after working in Hatari.
movem.x rl,-(an)
There is a difference if the register used in predecrement mode is also contained in the register list.
For the 68020, 68030 and 68040 the value written to memory is the initial register value decemented by the size of the operation.
The 68000 and 68010 write the initial register value (not decremented).
--Cheers,
Anders
User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 3258
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: movem bug in 68020+ modes?

Post by Cyprian »

do you mean "movem.l A0,-(A0)"?

Attached you can find my test program and TT shows me:
20230914_232211.jpg
and Hatari:
grab0002.png

I've just sent that report to the Hatari team.
You do not have the required permissions to view the files attached to this post.
Lynx I / Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
DDD HDD / AT Speed C16 / TF536 / SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.atari.org
User avatar
mrbombermillzy
Atari Super Hero
Atari Super Hero
Posts: 624
Joined: Tue Sep 13, 2016 9:24 am

Re: movem bug in 68020+ modes?

Post by mrbombermillzy »

Good spot.
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3329
Joined: Sun Aug 03, 2014 5:54 pm

Re: movem bug in 68020+ modes?

Post by ThorstenOtto »

Interesting. But what exactly is the ´size of the operation´? Ie when you do a

Code: Select all

movem.l a0-a3,-(a3)
Then a3 will be saved first. Will the saved value be original value -4, or original value - 16?
agranlund
Captain Atari
Captain Atari
Posts: 151
Joined: Sun Aug 04, 2019 1:49 pm

Re: movem bug in 68020+ modes?

Post by agranlund »

ThorstenOtto wrote: Fri Sep 15, 2023 12:54 pm Interesting. But what exactly is the ´size of the operation´? Ie when you do a

Code: Select all

movem.l a0-a3,-(a3)
Then a3 will be saved first. Will the saved value be original value -4, or original value - 16?
It's the .l or .w so should be -4 for movem.l (regardless where the register appears in the register list)
User avatar
npomarede
Atari God
Atari God
Posts: 1556
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: movem bug in 68020+ modes?

Post by npomarede »

Hi
what Hatari version are you using for your test ? When using Hatari devel version, this case is correctly suported :

STF :
A0 before: 0000F55E
Saved value: 0000F55E

TT :
A0 before: 000167E8
Saved value: 000167E4

Nicolas
User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 3258
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: movem bug in 68020+ modes?

Post by Cyprian »

npomarede wrote: Fri Sep 15, 2023 3:21 pm Hi
what Hatari version are you using for your test ? When using Hatari devel version, this case is correctly suported :

STF :
A0 before: 0000F55E
Saved value: 0000F55E

TT :
A0 before: 000167E8
Saved value: 000167E4

Nicolas
the issue was reported based on yesterdays build from there: http://antarctica.no/~hatari/latest/windows/

Today's build shows me:
Hatari_TT_Issue.png
You do not have the required permissions to view the files attached to this post.
Lynx I / Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
DDD HDD / AT Speed C16 / TF536 / SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.atari.org
User avatar
npomarede
Atari God
Atari God
Posts: 1556
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: movem bug in 68020+ modes?

Post by npomarede »

I see you're using "MMU", which I don't by default.
If I use MMU too, then the movem bug is reproducable.
I will have a look at the CPU tables used in MMU mode, maybe sthg is not correctly setup in Hatari for this mode.

Nicolas
User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 3258
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: movem bug in 68020+ modes?

Post by Cyprian »

ok, I've unchecked the MMU and the result was ok
Lynx I / Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
DDD HDD / AT Speed C16 / TF536 / SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.atari.org
User avatar
Eero Tamminen
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3899
Joined: Sun Jul 31, 2011 1:11 pm

Re: movem bug in 68020+ modes?

Post by Eero Tamminen »

Cyprian wrote: Fri Sep 15, 2023 4:15 pm ok, I've unchecked the MMU and the result was ok
What if you keep MMU enabled, but disable cycle exact "(CE)" and prefetch "(PF)"?

(MMU emu works OK with Linux without them, but breaks when either cache or prefetch emulation is enabled.)
User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 3258
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: movem bug in 68020+ modes?

Post by Cyprian »

Eero Tamminen wrote: Fri Sep 15, 2023 10:21 pm
Cyprian wrote: Fri Sep 15, 2023 4:15 pm ok, I've unchecked the MMU and the result was ok
What if you keep MMU enabled, but disable cycle exact "(CE)" and prefetch "(PF)"?

(MMU emu works OK with Linux without them, but breaks when either cache or prefetch emulation is enabled.)
no change, the same issue.

I'll wait for antarctica build with Andreas' todays patch
Lynx I / Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
DDD HDD / AT Speed C16 / TF536 / SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.atari.org
User avatar
npomarede
Atari God
Atari God
Posts: 1556
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: movem bug in 68020+ modes?

Post by npomarede »

Hatari's source have been updated with patch from WinUAE.
Results are now correct when using MMU.

Nicolas
Post Reply

Return to “Hatari”