English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 30 January 2019, 23:55   #1
Keir
Registered User
 
Join Date: May 2011
Location: Cambridge
Posts: 682
HUNK_END optional in Amiga load files?

I'm picking apart Amiga load files and I noticed that some do not have a HUNK_END block between hunks. Instead it seems that the hunk number is implicitly incremented when the next CODE/DATA/BSS block is reached.

Question is: Is this legit? Will all Kickstart versions load such binaries okay?

I have always observed HUNK_END at the very end of a load file -- I assume that one is absolutely necessary?

I am generating packed executables so it would be nice to elide these HUNK_END blocks if they're not needed. Otoh it doesn't save much, so I won't bother if it's going to cause hassle.
Keir is offline  
Old 31 January 2019, 01:57   #2
Hedeon
Semi-Retired
 
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 2,002
I am not sure. Could you give an example of an offending binary?
Hedeon is offline  
Old 31 January 2019, 12:07   #3
Keir
Registered User
 
Join Date: May 2011
Location: Cambridge
Posts: 682
Quote:
Originally Posted by Hedeon View Post
I am not sure. Could you give an example of an offending binary?
Seems common in small demos. Possibly because this is a common packed-exe trick. eg, first two I looked at:

Strukton by Focus Design: https://files.scene.org/view/parties...d_strukton.zip

Imacennial by Dekadence: http://www.dekadence64.org/dkd-imac.lha
Keir is offline  
Old 31 January 2019, 15:10   #4
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
Quote:
Originally Posted by kaffer View Post
I'm picking apart Amiga load files and I noticed that some do not have a HUNK_END block between hunks. Instead it seems that the hunk number is implicitly incremented when the next CODE/DATA/BSS block is reached.

Question is: Is this legit? Will all Kickstart versions load such binaries okay?

I have always observed HUNK_END at the very end of a load file -- I assume that one is absolutely necessary?

I am generating packed executables so it would be nice to elide these HUNK_END blocks if they're not needed. Otoh it doesn't save much, so I won't bother if it's going to cause hassle.
Yes, common practice in different exe-packers and exe-tampered to save some bytes.
Works in every existing kickstart so far. So definitely a "feature" that will be maintained for compatibility in 'future'() kickstarts.

EDIT: long time ago I had also tested for the last HUNK_END and from what I remember was never excludable

Last edited by ross; 31 January 2019 at 15:26.
ross is offline  
Old 31 January 2019, 16:01   #5
Keir
Registered User
 
Join Date: May 2011
Location: Cambridge
Posts: 682
Quote:
Originally Posted by ross View Post
Yes, common practice in different exe-packers and exe-tampered to save some bytes.
Works in every existing kickstart so far. So definitely a "feature" that will be maintained for compatibility in 'future'() kickstarts.

EDIT: long time ago I had also tested for the last HUNK_END and from what I remember was never excludable
Excellent, thank you. I have literally just had the first successful test run of my exe packer, so this is a nice finishing touch.

I have another question, about extra space at the end of relocatable blocks: That is, when the longword count in HUNK_HEADER (3f3) is longer than the longword count in the CODE/DATA/BSS block itself. It looks like DOS will allocate this extra space, but may not initialise it to zeroes (like it does for the first N longwords declared within a BSS block). Can I rely on this as it may make my packs a bit smaller?

EDIT: KS2+ seem to zero the extra BSS space. Earlier KS seem not to. Perhaps it is best to zero it then.

Last edited by Keir; 31 January 2019 at 16:16.
Keir is offline  
Old 31 January 2019, 16:43   #6
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
Quote:
Originally Posted by kaffer View Post
I have another question, about extra space at the end of relocatable blocks: That is, when the longword count in HUNK_HEADER (3f3) is longer than the longword count in the CODE/DATA/BSS block itself. It looks like DOS will allocate this extra space, but may not initialise it to zeroes (like it does for the first N longwords declared within a BSS block). Can I rely on this as it may make my packs a bit smaller?

EDIT: KS2+ seem to zero the extra BSS space. Earlier KS seem not to. Perhaps it is best to zero it then.
Yes, zeroed only in KS2+.
ross 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
how much .abk files can I load simultaneously Blackgoat Coders. AMOS 9 22 March 2016 18:45
Worms DC and Gloom WHD load files zerohour1974 support.Games 4 18 March 2015 18:10
Cannot load files with unicode string from command line CiroConsentino support.FS-UAE 6 19 August 2014 13:58
Cannot load some dms files in WinUAE anthonyhead support.WinUAE 18 31 May 2010 05:40
Save/Load State with HDF-Files Frieshansen support.WinUAE 2 10 March 2007 18:09

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 04:02.

Top

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