English Amiga Board


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

 
 
Thread Tools
Old 27 April 2019, 02:35   #161
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,179
Quote:
Originally Posted by PeterJ View Post
and it uses a lot of lsr #8 and Lsl #8 so the about is just perfect
For
lsr #8
the trick is similar:

Code:
    d0.w=xx00
    moveq   #0,d1
    ....

    move.w  d0,-(sp)
    move.b  (sp)+,d1
    ....
    
    d1.w=00xx
In this case you can use stack (so no spare A register and mem) but you need a D register and you must never touch his upper bits.
ross is offline  
Old 27 April 2019, 06:51   #162
NorthWay
Registered User
 
Join Date: May 2013
Location: Grimstad / Norway
Posts: 613
[lsl #8]
My personal preference is to start the program with "clr.l -(sp)" and match it before end with "move.l (sp)+,d0", and then use pairs of
move.b dX,(sp)
move.w (sp),dX
NorthWay is offline  
Old 27 April 2019, 10:15   #163
PeterJ
Registered User

 
Join Date: Feb 2015
Location: Copehagen
Posts: 35
Quote:
Originally Posted by ross View Post
For
lsr #8
the trick is similar:

Code:
    d0.w=xx00
    moveq   #0,d1
    ....

    move.w  d0,-(sp)
    move.b  (sp)+,d1
    ....
    
    d1.w=00xx
In this case you can use stack (so no spare A register and mem) but you need a D register and you must never touch his upper bits.

i just tried with $ff56 and the result was $ff

is it not only if you use movem.w that it clear or set the upper word depending of bit15?

Last edited by PeterJ; 27 April 2019 at 10:30. Reason: edit just add some stuf
PeterJ is offline  
Old 27 April 2019, 11:21   #164
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,179
Quote:
Originally Posted by NorthWay View Post
[lsl #8]
My personal preference is to start the program with "clr.l -(sp)" and match it before end with "move.l (sp)+,d0", and then use pairs of
move.b dX,(sp)
move.w (sp),dX

You just have to be careful not to use it in a nested routine so your sentence should be written "to start the subroutine with".


Quote:
Originally Posted by PeterJ View Post
i just tried with $ff56 and the result was $ff
As is should (i've simply written d0=$xx00 because low bits are anyway lost so can be anything).
But from your next phrase is it not that you meant the
asr
instruction?
Quote:
is it not only if you use movem.w that it clear or set the upper word depending of bit15?
Regardless,
movem
deals with words (or longs) and never with bytes.
ross is offline  
Old 29 April 2019, 13:36   #165
hooverphonique
ex. demoscener "Bigmama"

 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 988
Quote:
Originally Posted by PeterJ View Post
and it uses a lot of lsr #8 and Lsl #8 so the about is just perfect
If they are used in hot code, maybe the solution is to refactor the necessity for these shifts away completely
hooverphonique is offline  
Old 14 August 2019, 21:51   #166
NorthWay
Registered User
 
Join Date: May 2013
Location: Grimstad / Norway
Posts: 613
Quote:
Originally Posted by NorthWay View Post
once upon a time there was a thing called the GNU(gcc?) super-optimizer
I found this reference to it: https://courses.cs.washington.edu/co...s/massalin.pdf
NorthWay is offline  
Old 17 August 2019, 01:08   #167
Photon
Moderator

Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 4,772
Quote:
Originally Posted by NorthWay View Post
A factor from my experience is that optimized C runs 10x slower than optimized Assembly, and that C++ cannot be fully reduced to C for an application. (This is up to about 68020/80386, where actually Pascal in some cases had a lower factor than C. Since the popularity of C, this may have changed, but not measured by me.)

Later, on-chip caches affected performance more than the number and time length of instructions, and this allowed utility applications to not be bogged down and reduce this factor.

But even after this hardware acceleration (circa 1990), applications such as games and demos would never use C (or C++) in time-critical sections for another half a decade, as we know.

It's true to this day that any high-level language (or one posing as such!) will always be beaten by a great margin by "simply" writing the program in Assembly. (The advantage of truly portable languages is of course the portability and less code to write, if you're not using macros.)

All this to make clear that there is no language level higher than Assembly that will ever generate as efficient (or small) code as writing it in Assembly

It's self-evident. But just to give factors for the performance loss paid. The compiler doesn't know what you're trying to do, so it can't deliver the perfect translation.
Photon 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
68000 boot code billt Coders. General 15 05 May 2012 21:13
Wasted Dreams on 68000 sanjyuubi support.Games 5 27 May 2011 18:11
680x0 to 68000 Counia Hardware mods 1 01 March 2011 11:18
quitting on 68000? Hungry Horace project.WHDLoad 60 19 December 2006 21:17
3D code and/or internet code for Blitz Basic 2.1 EdzUp Retrogaming General Discussion 0 10 February 2002 12:40

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 05:39.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.07232 seconds with 16 queries