Data register sign extension

All 680x0 related coding posts in this section please.

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

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

Data register sign extension

Postby Cyprian » Wed Jan 22, 2020 9:44 pm

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: 313
Joined: Mon Mar 03, 2008 10:33 pm
Contact:

Re: Data register sign extension

Postby mlynn1974 » Wed Jan 22, 2020 10:05 pm

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

Postby TomH » Wed Jan 22, 2020 10:17 pm

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 Super Hero
Atari Super Hero
Posts: 969
Joined: Sun Aug 03, 2014 5:54 pm

Re: Data register sign extension

Postby ThorstenOtto » Wed Jan 22, 2020 10:36 pm

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: 295
Joined: Fri Mar 01, 2013 10:52 pm

Re: Data register sign extension

Postby wietze » Wed Jan 22, 2020 10:37 pm

I was about to say, movem.w sign extends by default.

ijor
Hardware Guru
Hardware Guru
Posts: 3957
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: Data register sign extension

Postby ijor » Thu Jan 23, 2020 2:08 am

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


Social Media

     

Return to “680x0”

Who is online

Users browsing this forum: No registered users and 3 guests