English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 24 October 2017, 09:31   #21
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by PeterK View Post
But without this MOVEQ #-1,D0 the following resident structure gets a better longword alignment. That's why I remove this useless instruction.
I will leave the "only for idiots" part uncommented but this one I have to comment. I pretty much doubt that removing the moveq #-1,d0 instruction will lead to a better longword alignment! rts = 2 bytes, moveq #-1,d0 = 2 bytes. Assuming Amiga OS has loaded your library to an address that is longword aligned removing the moveq instruction actually destroys the longword alignment of the resident structure!

Besides, most assemblers have options (CNOP f.e.) to take care of alignment issues which should be used instead of removing "useless" instructions.
StingRay is offline  
Old 24 October 2017, 15:36   #22
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
I know that the start of the resident structure itself won't be longword aligned, but the pointers in this structure, the inittable and the functiontable are better aligned. On the other side, the alignment is not so important, since you will never notice a few microseconds difference of access time during InitResident().

I'm a bit surprised that this missing return code leads to such a long discussion. And I can not imagine any Amiga user to be so stupid to execute a library directly from a shell, thus there really should be no idiots, I guess.
PeterK is offline  
Old 24 October 2017, 16:01   #23
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
You used alignment as "excuse" for removing the moveq instruction and now you say alignment isn't that important (which I completely agree with in this case!). You're contradicting yourself.

Also, it's not about Amiga users being stupid or not, it simply is bad coding style. In my opinion at least.
StingRay is offline  
Old 24 October 2017, 16:08   #24
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
Quote:
Originally Posted by Wepl View Post
There should be a 'moveq #-1,d0' before the rts at the start.
With that AmigaDOS will tell 'not excutable' when started from the CLI.
The result "Not Executable" is caused when the protection flag "E" is not set. It will also be displayed when my test.library is executed from a shell.

If you set the protection flag "E" then executing a library with the return code -1 will fail as "Unknown Instruction" and the shell returns RC=10. My test.library does not produce any error messages and the RC might be a random value.

@StingRay
Ok, in your eyes it's bad coding style, but I left this instruction out by design. That's my style, basta.

Last edited by PeterK; 24 October 2017 at 16:15.
PeterK 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
Anyone up for an ASM coding competition? DanScott Coders. Asm / Hardware 526 22 September 2018 21:38
asm coding compo meynaf Coders. Asm / Hardware 66 01 July 2017 22:59
3rd tutorial on ASM- and HW-coding Vikke Coders. Asm / Hardware 6 26 March 2013 15:57
First tutorial on ASM- and HW-coding Vikke Coders. Asm / Hardware 46 18 March 2013 12:33
2nd tutorial on ASM- and HW-coding Vikke Coders. Asm / Hardware 10 17 March 2013 11:49

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 00:58.

Top

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