12 February 2021, 20:34 | #1 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,684
|
Correct executable hunk parser for 1.3/3.1?
I don't need the other OS versions, although 1.4 is necessary for A3000 and I want to support 3.1.4. Just too long for title field.
DOS LoadSeg works fine, but I'm looking out for pitfalls from experience. Some executable files have multiple hunks, decompression etc. The last hunk might have the last 0 longword (IIRC) removed to save 4 bytes, and they still work. In general: all the support needed as if typed from CLI. |
12 February 2021, 20:42 | #2 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,327
|
So, what's the question? Actually, most programs have more than one hunk. You find the hunk format defined in the Bantam book.
Things to look out for? Debug information? Overlays? |
12 February 2021, 21:04 | #3 | |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,684
|
Quote:
I don't like to do that though, and here, there are compatibility considerations normally not addressed at all in books. |
|
13 February 2021, 17:55 | #4 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,327
|
I'm sorry - what don't you want to do? Read a book? Why not? What is the problem you want to solve? The only thing the Bantam manual does not state is that the scatter loader supports both 1015 and 1020 for short relocs, due to a mistake in earlier releases. That is inofficial. If you want to look into the hunk structure, there is for example the Hunk processor in Aminet.
|
13 February 2021, 23:43 | #5 | |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,684
|
Quote:
Imagine if someone answered every hardware coding question with, "just read the Hardware Reference Manual/68000 Instruction Manual". |
|
20 February 2021, 05:38 | #6 | |
Registered User
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,759
|
Quote:
You say 'DOS LoadSeg works fine' and 'all the support needed as if typed from CLI' but don't explain why you need a 'correct' hunk parser. Exactly what are you trying to do? |
|
20 February 2021, 12:35 | #7 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,684
|
Trying to not reinvent the wheel, but apparently no-one has a hunk parser to share. It's fine, I'll set up a bunch of exes to test with and write my own.
|
20 February 2021, 13:00 | #8 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,327
|
Once again: What exactly are you trying to achieve? You may not know, but LoadSeg() has a customizable cousin, InternalLoadSeg(), so you can make it load from memory, or from an RDSK block, or whatever... It is in general not necessary to write a scatter loader yourself.
For a debugger, you may need to look for the debug hunks and their formats, but that is yet again another business. Nobody will be able to help you if you don't tell what your goal is. Just to say, I cannot educate you. If you are looking for a documentation of the hunk format, books are much better options than me typing in a book chapter. The best source is Ralph Babel's Guru book, with that not being available, the second best source is the Bantam manual. |
20 February 2021, 13:02 | #9 | |
Registered User
Join Date: Aug 2006
Location: Finland
Age: 52
Posts: 244
|
Quote:
|
|
20 February 2021, 13:30 | #10 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,327
|
Yes, or that: http://aminet.net/dev/misc/Hunk.lha
|
20 February 2021, 13:44 | #11 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,383
|
osemu has a good hunk parser. actually it emulates loadseg pretty well. including overlays. 100% assembly.
|
20 February 2021, 14:06 | #12 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,327
|
Guess what. The dos.library InternalLoadSeg() / LoadSeg() is also assembler (since v37, before it was BCPL), and it even uses buffering to limit the number of Read() calls. (-;
|
20 February 2021, 15:41 | #13 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,383
|
Thomas can you post something without being patronizing and selling the OS?
It's obvious that Photon doesn't want that solution. Besides do we have the source so we can hack that? yes and no. We have the source but it's not legal to use it. osemu dos.s source is a free and easy to build & hack into assembler source. |
20 February 2021, 17:01 | #14 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,327
|
I'm not selling anything, and I'm not developing anything of it. It seems you seem to advocate another source "because it's assembler". However, leaving language issues all aside, the more important reason for *not* using such a solution is that a) somebody else (not me) already did that, and b) this somebody else's solution is working and the standard and maintained solution for this problem; it defines how this problem is to be solved.
Now, it might well be that LoadSeg() and friends are not adequate, but then it would be necessary to know why not (and there is no information on this). If there is a slim chance that the Os function works for you, then that is the best possibility you have. Somebody else (not me) cares about it, it is always present, and it defines the standard for the problem of "loading hunks". Maybe the problem isn't "loading hunks", which is also certainly possible, but then it becomes necessary to state what the problem is to provide adequate help. |
20 February 2021, 18:57 | #15 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,684
|
Let's narrow it down. 1.3 is mentioned specifically because some resources (and much of Aminet) is only available from OS 2.0 and up, so what is best practice to handle 1.3-1.4?
The goal is to load an executable into memory and execute it correctly. There could be thoughts on whether to load certain types of hunks or not, as well as handling hunks seen as malformed by a certain OS version. In other words, each OS has code that only has to work for that OS version, but my execution command must have code that works on 1.3-3.1 and be self-contained. I will be writing it in Assembler, but pseudocode or a flow chart is fine too. This is only for executable object files, not scripts. |
20 February 2021, 19:51 | #16 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,383
|
i will dig osemu loadseg implementation. it cerainly works for 1.3
|
20 February 2021, 21:55 | #17 | ||||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,327
|
Quote:
Quote:
Quote:
Quote:
Code:
move.l DOSBase,a6 jsr _LVOLoadSeg(a6) |
||||
20 February 2021, 22:11 | #18 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,327
|
Just a quick look at it - I'm sorry, but no. No overlay support, and it does not accept both equivalent hunk types for RELOC32SHORT. Once again - if there is a system function which does what you need, use it. It makes no sense to roll it on your own, chances are better than even that you overlook something.
|
20 February 2021, 22:20 | #19 | |||||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,552
|
Quote:
Quote:
Quote:
Quote:
Quote:
What do you need? The documentation of all hunk structures? Last edited by phx; 20 February 2021 at 22:22. Reason: ABSRELOC16 probably in object only |
|||||
20 February 2021, 22:54 | #20 | ||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,327
|
Quote:
Quote:
Of course it does. It will load under 1.x any program that will work under 1.x. And it will fail under 1.x for some programs that are not designed to work under 1.x, which does not do any harm. |
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ELF Vs Hunk | bloodline | Coders. System | 11 | 23 March 2017 16:32 |
Resourcer supporting OVERLAY hunk???? | CFou! | Coders. General | 1 | 06 March 2017 23:06 |
Titanics - Unknown Hunk | carrion | Coders. General | 3 | 19 December 2016 22:01 |
Amiga Hunk HUNK_RELOC32 | jeremysmith | Coders. System | 6 | 26 February 2016 13:50 |
Bad LoadFile Hunk | amiga | support.Apps | 4 | 26 June 2008 02:31 |
|
|