20 May 2014, 22:54 | #1 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
How to use overlay hunks?
I first heard of these when using Imploder to crunch some executable, I gather you can use them to load your executable one piece at a time in any order but how does it work? None of my books cover it.
|
20 May 2014, 23:30 | #2 |
Registered User
Join Date: Oct 2008
Location: EU
Posts: 163
|
Maybe this PDF "Amiga Binary File Structure" can help, it explains the format in detail:
http://amiga.rules.no/abfs/abfs.pdf |
23 May 2014, 11:09 | #3 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
thanks, but that's going to take me a while to get my head around... maybe a bit too much detail and not enough how to actually use it.
|
23 May 2014, 11:52 | #4 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,583
|
|
25 May 2014, 22:21 | #5 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
I know you have the Amiga Guru book, and if you look in the last chapter you'll find a few pages with some code examples.
|
03 June 2014, 06:18 | #6 |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,213
|
According to the documentation with SAS/C, there is a 50 overlay limit. Is that hard-coded into AmigaOS 3.x or is it local to the SAS/C overlay manager?
|
03 June 2014, 09:53 | #7 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,650
|
|
03 June 2014, 13:12 | #8 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,583
|
AmigaDOS does not have any hunk amount limits. (Except available memory)
|
03 June 2014, 15:03 | #9 |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,213
|
Thanks, guys, I've found another way to do what I wanted without using overlays. And thanks Mrs. Beanbag for bringing up the subject.
|
25 November 2023, 03:39 | #10 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,701
|
I have a program that compiles and links fine normally, but if I try to use overlays, it gives an error for every global function (except those in the root module) saying it is declared twice, both times in the same file with the same value and type. I have the SAS/C manual but it doesn't have much that is relevant to this error.
|
25 November 2023, 09:48 | #11 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,371
|
Not sufficient information. What are the compiler options? Care to share a minimum (non-working) example, including compiler and linker options?
Note that SAS/C offers two calling conventions (registerized parameters and stackbased) and the overlay manager needs to fit to this convention. You can also check with the OMD command which symbols a module exports and imports, and thus check whether there are any duplications. Also note how the linker option looks like, potentially you put the same node twice. The syntax for the WITH files requires some careful reading. |
25 November 2023, 20:06 | #12 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,701
|
OMD command shows there are no duplications.
Odd that they support two calling conventions but seemingly only provide an overlay manager for one of them :-/ Anyway, I have made and attached a very minimal example. This example is using all default options, therefore there is no SCOPTIONS file to attach. If lines 3..5 of WITHFILE (ie. the overlay part) are removed, it links successfully, otherwise SLink thinks that _hello is defined twice in second.o. Last edited by Minuous; 25 November 2023 at 21:15. |
27 November 2023, 05:15 | #13 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,701
|
Does anyone know of an alternative compiler that does have working overlay support?
|
27 November 2023, 08:19 | #14 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,371
|
SAS/C does have working overlay support, but you probably have to tune the compiler parameters a bit. Maybe ALVs conflict with the trampolines the linker has to generate for overlays, so maybe you should not use the small code model here.
|
01 December 2023, 05:06 | #15 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,701
|
Actually it does generate a working program despite the linker error messages, however the program is about twice the usual size, and appears to contain all code and data twice.
|
01 December 2023, 07:55 | #16 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,371
|
Then you did not use the linker properly. It seems you link all modules both in the root node and into overlay nodes. There is an example in the Bantam book how the "WITH" file should look like.
|
01 December 2023, 11:43 | #17 |
Registered User
Join Date: Jun 2017
Location: 1986
Posts: 79
|
Yes, indeed, second.o is linked twice.
I use this (with an assembler program, hence no LIB stuff) ROOT <all root files>.o ... OVERLAY <all overlays>.o # TO <bin> OVLRMGR <name of overlay manager>.o |
01 December 2023, 17:07 | #18 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,701
|
Thanks, I have it working now. I thought there was some difference between FROM and ROOT so had both :-(
|
22 January 2024, 07:28 | #19 |
Zone Friend
Join Date: Apr 2006
Location: Gothenburg/Sweden
Age: 48
Posts: 345
|
I was interested in this overlay-stuff awhile back, but was pretty terrified how complex it seems to be. Perhaps that's why it's very rarely used (as far as I know) on the Amiga.
|
22 January 2024, 11:45 | #20 | |
Registered User
Join Date: Aug 2010
Location: Germany
Posts: 537
|
Quote:
The feature itself required preplanning, if you followed the original overlay management design (e.g. Lattice 'C' versions 3 & 4 and SAS/C versions 5 & 6). The documentation which covered how you made it work was decent enough, especially for SAS/C. You had to know in advance which portions of your program could be in memory at a time. Not every program could be conveniently broken down into such units, though. Manx Aztec 'C' did away with the minute preparations for keeping an exact subset of a program in memory, by virtue of its custom overlay manager. You could break down the program into units at the linker stage and then later load/unload portions of it as required. This was the method preferred by the industry by 1989/1990. But, as I mentioned, the constraints which required overlay support eventually went away as RAM became cheaper and Amigas became faster with each new iteration of the platform. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hunks | BippyM | Coders. General | 42 | 27 May 2022 02:02 |
Purple Overlay to screen | SteveE | support.Hardware | 2 | 12 March 2011 23:48 |
Overlay effect | MrX_Cuci | request.UAE Wishlist | 15 | 30 June 2010 17:35 |
Amiga Exe Hunks | heavy | Coders. General | 4 | 16 August 2007 00:20 |
AmigaDOS hunks documentation & HUNK_OVERLAY | AmiGer | Coders. General | 2 | 06 February 2004 08:00 |
|
|