English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 30 October 2020, 16:08   #1
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
68020+ scale factor behaviour?

This is an offshoot of the setting a pixel thread. There was a tiny bit of discussion about compilers and how they selected words vs longwords for operations and chb correctly pointed out that the compiler can't always know whether a result will fit in a word or not and thus could in some circumstances decide to use longwords even if the variable was set to being a word to make sure the result was correct.

This all had to do with using a register as an index (something like move.w d0,0(a0,d1.l)). Made me wonder how the 68020 deals with this if you use the built-in scaling facility.

In other words, I wonder what would happen if I do this:
Code:
move.w #32767,d0
move.w 0(a0,d0.w*2),d1
I guess that same would apply to d0 being 2^31, but that is a bit more of an edge case, IMHO.
roondar is offline  
Old 30 October 2020, 16:55   #2
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
d0.w is sign-extended to d0.l (000+ behavior), then scaled.
a/b is offline  
Old 30 October 2020, 17:05   #3
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
Thanks!
I had just finished writing a tiny test program to see for myself and that is indeed what it does
roondar is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Relations between Factor 5 and Graftgold? mc68060 Retrogaming General Discussion 43 19 September 2018 19:25
68030 vs 68020 line-f behaviour jotd Coders. Asm / Hardware 7 16 July 2017 20:29
Factor 5 hit News 40 19 March 2017 15:44
Factor 5 dates Predseda HOL data problems 2 12 January 2016 12:57
What Chips Are What Form Factor Loedown support.Hardware 1 17 November 2009 13:17

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:18.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07018 seconds with 15 queries