Data register sign extension

All 680x0 related coding posts in this section please.

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Post Reply
User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 1949
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Data register sign extension

Post by Cyprian »

just for the record

Code: Select all

movem.w (sp)+,d1


eab.abime.net/showthread.php?t=100546
Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
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.appspot.com/
mlynn1974
Captain Atari
Captain Atari
Posts: 362
Joined: Mon Mar 03, 2008 10:33 pm
Contact:

Re: Data register sign extension

Post by mlynn1974 »

Very nice. I think the PDP11, 6800 and certainly the Z80 also have automatic sign extension in some instructions under certain circumstances. Is this emulated correctly in Steem\SainT and Hatari?
Still got, still working: Atari 4Mb STe, 520STFM, 2.5Mb STF.
Hardware: Cumana CSA 354, Ultimate Ripper, Blitz Turbo, Synchro Express II (US and UK Versions).
TomH
Atari User
Atari User
Posts: 40
Joined: Fri Mar 08, 2019 3:47 pm

Re: Data register sign extension

Post by TomH »

It's likely, as the Programmer's Reference Manual is entirely explicit, directly in its description of MOVEM:

"In the case of a word transfer to either address or data registers, each word is sign-extended to 32 bits," (P4-128; P232 of the PDF)
ThorstenOtto
Atari God
Atari God
Posts: 1196
Joined: Sun Aug 03, 2014 5:54 pm

Re: Data register sign extension

Post by ThorstenOtto »

mlynn1974 wrote:Is this emulated correctly in Steem\SainT and Hatari?
Yes, this is nothing new, and emulated correctly in all emulators i know of, including Hatari and ARAnyM.
wietze
Captain Atari
Captain Atari
Posts: 329
Joined: Fri Mar 01, 2013 10:52 pm

Re: Data register sign extension

Post by wietze »

I was about to say, movem.w sign extends by default.
ijor
Hardware Guru
Hardware Guru
Posts: 4012
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: Data register sign extension

Post by ijor »

The 68000 never modifies just the low word of an address register. This is part of the 68K philosophy and probably well known. The MOVEM instruction is rather unique in that it doesn't distinguish between address or data register destinations. So the principle of sign extension is applied in either case. It would have complicated the microcode, probably significantly, otherwise.
Fx Cast: Atari St cycle accurate fpga core
Post Reply

Return to “680x0”