rolsen74 / resrc4

Amiga 68k Hunk File Disassembler
GNU General Public License v3.0
8 stars 1 forks source link

Fails on helloworld from first Fred Fish disk #2

Closed hippietrail closed 1 month ago

hippietrail commented 1 month ago

I don't have any of my Amiga stuff anymore so looked on the web for some early Amiga executables. I took this helloworld from the first Fish Disk as a small and trivial example: https://ftp.funet.fi/pub/amiga/fish/001-100/ff001/hello.lha

But it fails with this error

% ./ReSrc4 -i ../../SpaceJunk/amiga/hello -o hello.asm
11 - Load and Parse Hunk File
Loaded ../../SpaceJunk/amiga/hello (10172 Bytes)

Hunk structure sanity check failure
Unexpected HUNK_END
Load error

I don't have a working emulator to test the file on either unfortunately.

rolsen74 commented 1 month ago

I just ran "hello" in WinUAE and it worked.

However, it looks like my Hunk structure parser is either broken or just not as good at handling semi-broken files as the OS.

I will need to look into this at some point. For now, I guess you are out of luck with this file. Sorry.

But thanks for the feedback and test file.

hippietrail commented 1 month ago

No problem. For what it's worth I tried a different program of the same Fred Fish disk and it had the same problem but then I tried one off Fred Fish disk 999 and it worked great.

I'm working on parsing various old and new executable formats myself and can't align those early programs with the poorly written docs I'm using. I was thinking older compilers or linkers just output weird hunks but now I'm thinking they actually corrupt the executables but in ways that LoadSeg() doesn't care about.

rolsen74 commented 1 month ago

I was working on something else, but how could I turn down an excuse to work on something Amiga-related? :)

This 'hello' file turned out to be rather special... it contains a huge number of hunks. What broke my parser was that there were two HUNK_END markers in a row in several places in the file. It should be fixed now.

You can grab an updated version from GitHub.

-- File info Loaded hello.exe (10172 Bytes)

File 1 ## Address | Type | Data | Mem | Relocs | MemType

-----------.-----------+------------+--------+--------+--------+--------< 0 : 00010000 : Code [3E9] : 412 : 412 : 23 : Public 1 : 00020000 : Data [3EA] : 80 : 80 : 0 : Public 2 : 00030000 : Code [3E9] : 364 : 364 : 21 : Public 3 : 00040000 : Data [3EA] : 132 : 132 : 3 : Public 4 : 00050000 : Bss [3EB] : 0 : 8 : 0 : Public 5 : 00060000 : Code [3E9] : 0 : 0 : 0 : Public 6 : 00070000 : Data [3EA] : 4 : 4 : 0 : Public 7 : 00080000 : Bss [3EB] : 0 : 0 : 0 : Public 8 : 00090000 : Code [3E9] : 0 : 0 : 0 : Public 9 : 000a0000 : Data [3EA] : 260 : 260 : 0 : Public 10 : 000b0000 : Bss [3EB] : 0 : 0 : 0 : Public 11 : 000c0000 : Code [3E9] : 0 : 0 : 0 : Public 12 : 000d0000 : Data [3EA] : 4 : 4 : 0 : Public 13 : 000e0000 : Bss [3EB] : 0 : 0 : 0 : Public 14 : 000f0000 : Code [3E9] : 104 : 104 : 6 : Public 15 : 00100000 : Data [3EA] : 0 : 0 : 0 : Public 16 : 00110000 : Bss [3EB] : 0 : 0 : 0 : Public 17 : 00120000 : Code [3E9] : 0 : 0 : 0 : Public 18 : 00130000 : Data [3EA] : 4 : 4 : 0 : Public 19 : 00140000 : Bss [3EB] : 0 : 0 : 0 : Public 20 : 00150000 : Code [3E9] : 712 : 712 : 13 : Public 21 : 00160000 : Data [3EA] : 0 : 0 : 0 : Public 22 : 00170000 : Bss [3EB] : 0 : 0 : 0 : Public 23 : 00180000 : Code [3E9] : 0 : 0 : 0 : Public 24 : 00190000 : Data [3EA] : 4 : 4 : 0 : Public 25 : 001a0000 : Bss [3EB] : 0 : 0 : 0 : Public 26 : 001b0000 : Code [3E9] : 1536 : 1536 : 78 : Public 27 : 001c0000 : Data [3EA] : 16 : 16 : 0 : Public 28 : 001d0000 : Bss [3EB] : 0 : 0 : 0 : Public 29 : 001e0000 : Code [3E9] : 1008 : 1008 : 7 : Public 30 : 001f0000 : Data [3EA] : 0 : 0 : 0 : Public 31 : 00200000 : Bss [3EB] : 0 : 0 : 0 : Public 32 : 00210000 : Code [3E9] : 364 : 364 : 11 : Public 33 : 00220000 : Data [3EA] : 0 : 0 : 0 : Public 34 : 00230000 : Bss [3EB] : 0 : 12 : 0 : Public 35 : 00240000 : Code [3E9] : 644 : 644 : 14 : Public 36 : 00250000 : Data [3EA] : 0 : 0 : 0 : Public 37 : 00260000 : Bss [3EB] : 0 : 0 : 0 : Public 38 : 00270000 : Code [3E9] : 36 : 36 : 0 : Public 39 : 00280000 : Data [3EA] : 0 : 0 : 0 : Public 40 : 00290000 : Bss [3EB] : 0 : 0 : 0 : Public 41 : 002a0000 : Code [3E9] : 0 : 0 : 0 : Public 42 : 002b0000 : Data [3EA] : 4 : 4 : 0 : Public 43 : 002c0000 : Bss [3EB] : 0 : 120 : 0 : Public 44 : 002d0000 : Code [3E9] : 24 : 24 : 1 : Public 45 : 002e0000 : Data [3EA] : 0 : 0 : 0 : Public 46 : 002f0000 : Bss [3EB] : 0 : 0 : 0 : Public 47 : 00300000 : Code [3E9] : 0 : 0 : 0 : Public 48 : 00310000 : Data [3EA] : 0 : 0 : 0 : Public 49 : 00320000 : Bss [3EB] : 0 : 480 : 0 : Public 50 : 00330000 : Code [3E9] : 348 : 348 : 28 : Public 51 : 00340000 : Data [3EA] : 0 : 0 : 0 : Public 52 : 00350000 : Bss [3EB] : 0 : 132 : 0 : Public 53 : 00360000 : Code [3E9] : 0 : 0 : 0 : Public 54 : 00370000 : Data [3EA] : 16 : 16 : 0 : Public 55 : 00380000 : Bss [3EB] : 0 : 0 : 0 : Public 56 : 00390000 : Code [3E9] : 68 : 68 : 0 : Public 57 : 003a0000 : Code [3E9] : 68 : 68 : 0 : Public 58 : 003b0000 : Code [3E9] : 160 : 160 : 8 : Public 59 : 003c0000 : Data [3EA] : 4 : 4 : 0 : Public 60 : 003d0000 : Bss [3EB] : 0 : 0 : 0 : Public 61 : 003e0000 : Code [3E9] : 0 : 0 : 0 : Public 62 : 003f0000 : Code [3E9] : 228 : 228 : 10 : Public 63 : 00400000 : Code [3E9] : 136 : 136 : 6 : Public 64 : 00410000 : Code [3E9] : 56 : 56 : 2 : Public 65 : 00420000 : Data [3EA] : 0 : 0 : 0 : Public 66 : 00430000 : Code [3E9] : 80 : 80 : 4 : Public ^ ^ ^ ^ ^ ^