View Single Post
Old 01 October 2022, 09:16   #45
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by Bruce Abbott View Post
Except in cases like this, which are not exactly rare here. As for in general, I'm just saying what I do - not suggesting it's the 'best' way for everyone.
True. We have different use cases.


Quote:
Originally Posted by Bruce Abbott View Post
So Barfly assembler is broken. And VASM too, because it trims zeros off the end of your code without being told to (and sometimes gets it wrong). Actually most assemblers are broken in one way or another. I use ProAsm, which has several bugs that I had to patch to get correct code generation (worst one was setting the wrong data register in certain 68020 instructions).
I think VASM has an option to turn that "trim zeroes" off. Something to build kick 1.x compatible exes.


Quote:
Originally Posted by Bruce Abbott View Post
I don't worry about reloc tables because the order doesn't matter. To compare reassembled code to the original I wrote a program that relocates them before comparison. When my disassembler is working properly the results are identical, which is how I check it for accuracy.
Great idea. Too bad it would be more complicated for me due i'm by far not always disassembling Amiga code.


Quote:
Originally Posted by Bruce Abbott View Post
You are right. Actually asm is a pain in general. But I like to know what size my branches are, as trying to keep them short makes my code tighter. Also the assembler takes longer when it has to modify branch sizes, and sometimes you need code to be a certain size (eg. branch tables).
I can not always know what size my branches are, as i'm often using macros and conditional assembly (a likely story in an include file with features that only get assembled if they are used).
For branch tables you can turn optimizations off and on in the source itself, local to some code part (at least PhxAss can).
I see turning opts off useful only for initial comparison when resourcing and faster assembly of large programs, the latter being much less important with uae-jit.


Quote:
Originally Posted by Bruce Abbott View Post
Of course I always have the option of getting the assembler to do optimization if I am too lazy (rarely) or to make the final release code tighter.
It depends on the size. I don't think you'll like to hand-optimize all branches in a 1M resourced executable...


Quote:
Originally Posted by Bruce Abbott View Post
Resourcing code accurately enough to handle different instruction sizes is not that easy. It's not unusual to find PC relative offsets in data words, which are not detectable without a close examination of the code that uses them. If the code size changes they may point to the wrong place.
Right, but i've never seen the code size change with PhxAss opt 0.


Quote:
Originally Posted by Bruce Abbott View Post
This also isn't that easy if the code size changes. Everything after the change is offset by some amount and a straight binary comparison fails from there on.
I know, but it never happened to me with optimizations turned off (or it's the sign i've missed something important).


Quote:
Originally Posted by Bruce Abbott View Post
True provided that the disassembly correctly identified code and data. If it didn't you could end up with 'code' that assembles into incorrect data. While you shouldn't let that happen, carefully inspecting every line for accuracy can be quite time-consuming. Often I just want a 'quick and dirty' disassembly so I can generate labels for debugging.
That depends on what you want to do with the reassembled code.
Usually it's for making big alterations so you will have to check the code line by line. Actually i do all the code/data separation by hand.
If it's just to generate labels, i fail to see the usefulness - these labels are for the most part number-based and are meaningless.


Quote:
Originally Posted by Bruce Abbott View Post
True, though my code doesn't generally have many branches that can be optimized. I find the best optimization is to review the code and ask "is this really the best way to do it?".
Well, not only the branches are optimized. If, say, you use a structure and access the first member : by using name(An) (which is supposed to be recommended) the assembler will use 0(An) instead of (An) with optimizations off. Other zero constants may appear as well.
meynaf is offline  
 
Page generated in 0.04457 seconds with 11 queries