IRA the dissembler again
Wow, it has started to piss me off, well not rally, what i considered as relative easy thing to do is not as easy as first thought.
The dissembler does good job at generating Assembly code, but does poor job as knowing the different between strings and assembly code, the challenge was not Assembly but cleaning up after a tornado.
What the dissembler generated:
This should be:
You can see that some thing went wrong when you see DC.w and DC.b mixed whit assembly its not common, maybe if it was a undocumented machine code instruction.
Just to repeat my self, I know some you who read this might not have written assembly so explain it again, DC.b is for arrays of byte and string (array of bytes that has ascii values), DC.w is for 16bit Integer (WORD) of arrays.
“DS” is for size of data and reserves chunk inside your code.
What you really need to use to clean it up a good hex editor, so you can look inside the exe file, and see what text strings should be.
I write a few commands to help me find hex values.
hex_to_string and string_to_hex, it's nice to have if you wonder if some thing really is ASCII and not numbers.
When debugging code one of my favorite tools is PrintF, simply because debuggers don't work so well under AmigaOS, we have grim repaper that displays power pc registers and 680x0 emulated registers, and where it crashed, but 680x0 code its translated as program runs so its hard to know where it crashed, and also grim only displays crash location as powerpc assembly.
Under UAE there are probably better tools, but I need to find the crashes under AmigaOS4, not under UAE, so not that useful,
C vs Assembly language
Sorry I just don't get it, way are people (Franko) telling me that Assembly is easy language?
This window display C code that does the Dos.library / PrintF command just as Assembly code above.
Well the code lies, I should have opened the DOS.library but its no longer necessary under AmigaOS4, whit -lauto option, so not a big lie, it works as its written.
but as you can see Assembly version of printf takes up to 7 lines to do the same as C does in just ONE single line, and it does the same thing.
And also you can see that strings has to be put some where else, and then you need to move the values in to ARGS array (D2), before command is executed, it just allot of more work.
Well maybe Assembly is not that complicated, but does require a lot more work, in the old days it made sense to do it in Assembly because you needed to optimize for speed as CPU's back then was slow, and you need to optimize for size as storage space was critical, but today it makes no sense to do it unless your optimizing something critical.