English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 20 May 2014, 22:54   #1
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
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.
Mrs Beanbag is offline  
Old 20 May 2014, 23:30   #2
a4k-oerx
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
a4k-oerx is offline  
Old 23 May 2014, 11:09   #3
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
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.
Mrs Beanbag is offline  
Old 23 May 2014, 11:52   #4
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
http://eab.abime.net/showthread.php?t=59407
Toni Wilen is online now  
Old 25 May 2014, 22:21   #5
Leffmann
 
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.
Leffmann is offline  
Old 03 June 2014, 06:18   #6
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
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?
Samurai_Crow is offline  
Old 03 June 2014, 09:53   #7
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
Quote:
Originally Posted by Samurai_Crow View Post
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?
unless there is a generic 50 hunk limit in amigados, this has to be in sas' overlay manager..
hooverphonique is offline  
Old 03 June 2014, 13:12   #8
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
AmigaDOS does not have any hunk amount limits. (Except available memory)
Toni Wilen is online now  
Old 03 June 2014, 15:03   #9
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
Thanks, guys, I've found another way to do what I wanted without using overlays. And thanks Mrs. Beanbag for bringing up the subject.
Samurai_Crow is offline  
Old 25 November 2023, 03:39   #10
Minuous
Coder/webmaster/gamer
 
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,629
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.
Minuous is offline  
Old 25 November 2023, 09:48   #11
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,214
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.
Thomas Richter is offline  
Old 25 November 2023, 20:06   #12
Minuous
Coder/webmaster/gamer
 
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,629
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.
Attached Files
File Type: lha test.lha (387 Bytes, 18 views)

Last edited by Minuous; 25 November 2023 at 21:15.
Minuous is offline  
Old 27 November 2023, 05:15   #13
Minuous
Coder/webmaster/gamer
 
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,629
Does anyone know of an alternative compiler that does have working overlay support?
Minuous is offline  
Old 27 November 2023, 08:19   #14
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,214
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.
Thomas Richter is offline  
Old 01 December 2023, 05:06   #15
Minuous
Coder/webmaster/gamer
 
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,629
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.
Minuous is offline  
Old 01 December 2023, 07:55   #16
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,214
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.
Thomas Richter is offline  
Old 01 December 2023, 11:43   #17
A10001986
Registered User
 
A10001986's Avatar
 
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
A10001986 is offline  
Old 01 December 2023, 17:07   #18
Minuous
Coder/webmaster/gamer
 
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,629
Thanks, I have it working now. I thought there was some difference between FROM and ROOT so had both :-(
Minuous is offline  
Old 22 January 2024, 07:28   #19
oRBIT
Zone Friend
 
Join Date: Apr 2006
Location: Gothenburg/Sweden
Age: 48
Posts: 339
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.
oRBIT is offline  
Old 22 January 2024, 11:45   #20
Olaf Barthel
Registered User
 
Join Date: Aug 2010
Location: Germany
Posts: 532
Quote:
Originally Posted by oRBIT View Post
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.
The overlay feature fell out of favour when Amigas either shipped with more than 512 KBytes of memory, or could be expanded by adding memory plug-in cards (or something like the A590 for the Amiga 500). That was around 1988/1989, if memory (ha!) serves.

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.
Olaf Barthel is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:24.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.25028 seconds with 16 queries