English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. Tutorials (http://eab.abime.net/forumdisplay.php?f=73)
-   -   Small IRA Tutorial (http://eab.abime.net/showthread.php?t=101408)

kamelito 28 March 2020 21:26

Thanks I’ll test it. Does is also work if the base library pointer is known in the source file prior to the OS call?

jotd 28 March 2020 22:42

?? I don't understand, sorry :)

kamelito 28 March 2020 22:58

If I have move.l execbase, a6 then later jsr -30(a6) same with other base lib etc will it work,

For cheapres.py is the usage is python cheapres.py sourcefile? Any dependencies?

jotd 28 March 2020 23:33

it will if the base lib is set before -30(a6) is called. I thought I protected the scan when RTS is encountered but it doesn't seem to be the case (working on the script right now so it might be done tonight)

usage is: cheapres.py -i input_file.asm -o output_file.asm.

Omitting the output overwrites the input (which can be regenerated at will probably)

Dependencies are kept to their minimum (no other python modules than already existing builtins, maybe it would even run on amiga in python 2.4 with minimum adaptations). Maybe time not to divert this thread any further. You can PM me if you have issues, or open a separate thread.

zenox98 29 March 2020 11:14

Many thanks, Jotd - very useful.

BTW I think this is relevant to this thread as it is enhancing IRA output.

#my2cents

jotd 29 March 2020 12:18

thanks :) if someone has issues with the scripts please yell. I have updated them several times since yesterday on my github page. Now cheapres.py is able to insert named offsets from $DFF000 base too as someone suggested.

phx 29 March 2020 12:44

Quote:

Originally Posted by kamelito (Post 1387818)
One feature could be to be able to set the value of the indentation when using the -a so all offsets could be aligned and so have a more readable output.

Hm... but all offset-comments are aligned at position 40! Maybe you have an editor or viewer which is not set to the standard tab-width of 8?

Quote:

Is there a way to change data size of dc.x ? .b .w .l
Not yet. But I already have that on my ToDo-list for future additions. I mentioned the new directives DATAB, DATAW and DATAL for this purpose. Also on this list: a directive to insert user comments, an option to output mnemonics in lower-case.

Quote:

Is it also possible to change to binary, hex and decimal the values?
No. A global option would be easy, but I guess you would like to see it as a directive for certain regions?

Quote:

Say A5 point to $DFF000, then something like move.w D6,98(A5) is there a way for IRA to put the Amiga chipset EQU instead?
Like library LVOs, this should be done by a post-processor. Jotd has currently the best options for it! :)

Quote:

VASM seems to do not like label with a ., like jmp .label
Labels starting with a dot are local labels in many 68k assemblers. So this would be a bad choice.

Quote:

Originally Posted by redblade (Post 1387861)
Were you the person who did Syndicate? I remember ending up on a Syndicate source code on some site.

What do you mean with "did"? But anyway, the answer is no! ;)

kamelito 29 March 2020 23:08

@PHX
>Maybe you have an editor or viewer which is not set to the standard tab-width of 8?
Right thanks notepad++ default is 4 with 8 it is perfect!

>Not yet. But I already have that on my ToDo-list for future additions. I mentioned the new directives DATAB, DATAW and DATAL for this purpose. Also on this list: a directive to insert user comments, an option to output mnemonics in lower-case.
>No. A global option would be easy, but I guess you would like to see it as a directive for certain regions?

I think your directives DATAB DATAW DATAL are the way to go but you could add a char like DATAW_B for word as binary or DATAB_D for decimal, DATAW_H for hex something like that. (Not sure if ascii is needed)


>Like library LVOs, this should be done by a post-processor. Jotd has currently >the best options for it! :)
I’ve seen he made updates, I’ll test tomorrow.

>Labels starting with a dot are local labels in many 68k assemblers. So this >would be a bad choice.
Not my choice it is IRA who did this I guess it choosed this because of symbols present in the exe.

@jotd
> dated them several times since yesterday on my github page. Now cheapres.py is able to insert named offsets from $DFF000 base too as someone suggested.

Thanks! Does your repo contains minimal info about how to use your tools?

redblade 30 March 2020 02:37

Quote:

Originally Posted by phx (Post 1388142)
What do you mean with "did"? But anyway, the answer is no! ;)

Someone did an amiga disassembly of Syndicate and they used IRA to do it. Must of been someone from the WHDLoad team.

jotd 02 April 2020 17:47

tried this basereg stuff, can't seem to make it work

defender of the crown:

Code:

        MOVEA.L        (A7)+,A1                ;0FE4A: 225F
        SUBA        #$000A,A1                ;0FE4C: 92FC000A
        MOVE.L        (A1),D1                        ;0FE50: 2211
        ADD.L        D1,D1                        ;0FE52: D281
        ADD.L        D1,D1                        ;0FE54: D281
        MOVEA.L        D1,A4                        ;0FE56: 2841
        ADDA.L        #$00008002,A4                ;0FE58: D9FC00008002

...

        SECTION S_1,DATA,CHIP

        DC.W        $4EF9                        ;11618
...
LAB_0C50:
        DS.L        132                        ;13B30
        END

A4 (before add) matches first section. Adding $8002 is as Frank said to benefit from full 64k range. But I can't seem to put the proper values

Code:

BASEADR  $11618
BASEOFF $8002

this fails (mapping like section 1 minus 55000 values or something). Note that section isn't that big. All offsets are negative. I've tried just BASEADDR $1961A but in that case I get "out of range". I think this is the proper value, but IRA doesn't allow it.

kamelito 02 April 2020 18:34

@jotd
I guess it’s 32766, have you seen my PMs?

phx 02 April 2020 21:37

Quote:

Originally Posted by jotd (Post 1389163)
Code:

    MOVE.L    (A1),D1            ;0FE50: 2211
    ADD.L    D1,D1            ;0FE52: D281
    ADD.L    D1,D1            ;0FE54: D281
    MOVEA.L    D1,A4            ;0FE56: 2841
    ADDA.L    #$00008002,A4        ;0FE58: D9FC00008002


This looks like reading the BPTR which links the next section. I guess that the $8002 skips the first four bytes which would be the BPTR to the next section. So the real offset is $7ffe, as Kamelito mentioned.

Also a base offset >$8000 makes no sense. :)

jotd 04 April 2020 16:42

BTW I found a very annoying bug in last version of IRA (2.09). I tried to disassemble a binary file (start $80000) like this:

Code:

>ira -a -offset=$80000 -binary heimsp.bin

IRA V2.09 (Apr  1 2020)
(c)1993-1995 Tim Ruehsen (SiliconSurfer/PHANTASM)
(c)2009-2015 Frank Wille
(c)2014-2017 Nicolas Bastien

Atari's executable files not yet supported.

WTF Atari???
And second IRA HAS DELETED THE FILE! I tried several times, same thing. Version 2.00 works well on that file. I have zoned it if you want to check.

kamelito 05 April 2020 17:10

@jotd how cheapres recognize the different libraries bases? Do you look for specific text like ExecBase, IntuitionBase is their a list? Or is it done differently?

jotd 05 April 2020 17:31

yeah, good question. ExecBase, IntuitionBase, GraphicsBase... basically name of the lib with first letter uppercased. Ex: lowlevel.library => LowlevelBase.

You can manually set them if the program uses a proxy routine to open the libraries (often happens in C programs)

kamelito 05 April 2020 19:24

@jotd
Thanks is PotgoBase handled?

jotd 05 April 2020 19:37

devices aren't supported ATM.

phx 07 April 2020 01:23

Quote:

Originally Posted by jotd (Post 1389561)
Code:

>ira -a -offset=$80000 -binary heimsp.bin
...
Atari's executable files not yet supported.


That's a bug. There should be no automatic file format detection when you clearly specified it as raw binary. Fixed.

Quote:

WTF Atari???
Yes. Seems that Nicolas prepared IRA for some more formats like Atari, Megadrive and ELF executables. Your binary definitely has an Atari header.

Quote:

And second IRA HAS DELETED THE FILE!
Might be a second bug, but as Atari is not yet implemented I would ignore it for now.

jotd 07 April 2020 10:54

another strange thing when processing Oscar (ECS) executable.

shitload of messages like this:

Watch out: prgcounter(0000d0a0) > nextreloc(000088bc)
then
P1 Missed bad reloc addr $000088bc!

Output is okay, though.

phx 07 April 2020 20:40

Quote:

Originally Posted by jotd (Post 1390158)
P1 Missed bad reloc addr $000088bc!

Output is okay, though.

I cannot remember the details, but probably there was a relocation in the executable's reloc-hunk which the reassembler now skipped in the output, because the code was not detected correctly?

Check offset $88bc. Does it look correct? Is there a label in this location?


All times are GMT +2. The time now is 16:21.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.

Page generated in 0.08724 seconds with 11 queries