Jump to content
We owe you an explanation.
July 9: An important update for readers in Japan.

You deserve an explanation, so please don't skip this 1-minute read. It's Thursday, July 9. Our fundraiser won't last long, but fewer people are seeing our message this month and we might not hit our goal. If you've lost count of how many times you've visited Wikipedia this year, we hope that means it's given you at least ¥300 of knowledge. If everyone who finds Wikipedia useful gave ¥300, we'd hit our goal in a few hours.

It's been 25 years and Wikipedia is still free. It's still created by people, not machines, and we don't run ads or put up paywalls because we're not here to make a profit off your attention. In other words, it's still the internet we were promised.

Less than 2% of our readers donate, so if you've never given and Wikipedia has provided you with at least ¥300 worth of knowledge, donate today. If you are undecided, remember any contribution helps.

Proud host of Wikipedia and other free knowledge projects
How often would you like to donate?
Support Wikipedia year-round
Thanks for your generous support
Please select an amount (JPY)
The average donation in Japan is around ¥800.
  • Preferred Amount
Please select a payment method
Please select an amount (minimum ¥154)
We cannot accept donations greater than 3850000 JPY through our website. Please contact our major gifts staff at benefactors@wikimedia.org.
Please select a payment method
Can we follow up and let you know if we need your help again? The support and advice we get from donors in Japan is priceless, but many donors don't let us stay in touch. Will you commit today, this Thursday, to staying in touch with the Wikimedia Foundation?
Sorry to hear that. We don't email often; would you consider changing your mind?
Thanks for changing your mind! We’ll respect your inbox.
Your information is handled in accordance with our donor privacy policy, and each email you receive will include easy unsubscribe options.
Please select an email option
Almost done: Please, make it  monthly.
Monthly support is the best way to ensure that Wikipedia keeps thriving.
How would you like to be reminded?
Whether you give now or later, any contribution helps. We can send you an email or text message reminder to join the 2% of readers who donate.
🎉 Thank you for donating recently! 🎉
Your support means the world to us. We'll hide banners in this browser for the rest of our campaign.
Where your donation goes
Accountability and transparency are core values at the Wikimedia Foundation. We manage funds and resources to ensure that every contribution supports our mission. We have earned the Platinum Seal of Transparency from Candid (formerly GuideStar), and Charity Navigator awarded us its highest rating. You can read our most recent annual report for more information about our financial health.
45% $85.4M Technology 32% $60.7M Support 12% $22.8M Fundraising 11% $20.9M General $189.7M Total Funding
45% Investment in Technology

Nearly half of our budget goes toward supporting the technology that powers Wikipedia and other Wikimedia projects. We are constantly working to enhance the user experience for both contributors and readers, improve site security, and ensure reliable access to our websites globally. This infrastructure and product support sustain one of the top ten most visited websites in the world, all at a fraction of the cost of popular for-profit websites.

32% Support for Volunteers

The global reach of Wikimedia projects is made possible by the hard work of volunteers from across the globe. We provide grants, legal support, and other resources to help build vibrant volunteer communities. Additionally, we promote community engagement through outreach initiatives and advocate for the growth and protection of free knowledge.

12% Allocation to Fundraising Efforts

Donor support is crucial to sustaining Wikipedia and our other free knowledge endeavors. Our team is committed to efficient and effective fundraising throughout the year, ensuring that every contribution helps advance our mission.

11% General and Administrative Expenses

Operational costs are essential for the smooth management and governance of the Wikimedia Foundation. These expenses help us recruit top talent and support staff around the world, empowering them to carry out the mission of the Wikimedia Foundation.

Amiga Hunk

From Wikipedia, the free encyclopedia
Hunk
Developed byCommodore International MetaComCo plc.
Initial releaseMay 5, 1986; 40 years ago (1986-05-05)
Type of formatAmiga executable

Hunk is the executable file format of tools and programs of the Amiga Operating System based on Motorola 68000 CPU and other processors of the same family. The file format was originally defined by MetaComCo. as part of TRIPOS, which formed the basis for AmigaDOS.[1] This kind of executable got its name from the fact that the software programmed on Amiga is divided in its internal structure into many pieces called hunks, in which every portion could contain either code or data.

Hunk structure

[edit]

The hunks in an Amiga executable file could exist in various types. There are 32-bit hunks, 16-bit hunks, and even some 8-bit hunks.

Types of hunks were standardized in AmigaOS, and well documented in The AmigaDOS Manual edited by Commodore to explain to programmers how to code on the Amiga, during the years in which Commodore manufactured Amiga computers. Their structure was officially codified and could be changed only by a Commodore committee, which then communicated the modifications to the developers for new releases of the Amiga operating system.

The structure of an Amiga hunk is very simple: There is a header at the beginning of the hunk indicating that that kind of "portion of code" is a known and valid Amiga hunk type, then follows an ID which indicates the length of the hunk itself, and at the bottom is the segment of the hunk which contains the real code or data.

Features of Amiga executable files

[edit]

Amiga executable files can be launched either from the graphical shell of the Amiga, the Workbench or from the Amiga's command line interpreter (called CLI, later AmigaShell).

No particular filename extension is required for Amiga executable files. For example, the calculator applet "Calculator" can be renamed to "Calculator.com", "Calculator.exe", "Calculator.bin", or even "Calculator.jpeg". These are all valid names for programs or tools, because AmigaOS does not differentiate between filename extensions.

AmigaOS adopted another method to recognize it is dealing with a valid executable. There is a particular sequence of bytes in the file header, yielding the hexadecimal value $000003f3. This sequence, which signifies an executable file and lets it be self-running, is called a magic cookie (from the magic cookies in Alice's Adventures in Wonderland by Lewis Carroll).[citation needed]

This kind of solution to identify executables on the Amiga was taken from similar solutions which were adopted by UNIX/Unix-like operating systems, where magic cookies are called magic numbers.

Structure of an Amiga executable file

[edit]

The internal structure of an Amiga executable file is very simple. In the beginning of the file there is the magic cookie, then is declared the total number of hunks in the executable, and just after this is the progressive numbers of hunks starting from "0" (zero).

The first hunk is always numbered zero, so if the executable is (for example) subdivided into three hunks, they will be numbered "0" for the first one, "1" the second and "2" the third hunk, and so on.

Just before the real hunks start is a table containing information about the length of any hunks present in the executable, and in the last part of the file are positioned the real hunks, each one described by its type name: HUNK_CODE, HUNK_DATA, et cetera.

Representation of the structure:

Magic Cookie Total number of hunks Progressive number of hunks Table of length Various Hunks (Hunk_Code, Hunk_Data, etc.)

Hunk Types

[edit]

Known hunk types for the Amiga are:

Name Value (decimal) Value (hex)
HUNK_UNIT9993E7
HUNK_NAME10003E8
HUNK_CODE10013E9
HUNK_DATA10023EA
HUNK_BSS10033EB
HUNK_RELOC3210043EC
HUNK_RELOC1610053ED
HUNK_RELOC810063EE
HUNK_EXT10073EF
HUNK_SYMBOL10083F0
HUNK_DEBUG10093F1
HUNK_END10103F2
HUNK_HEADER10113F3
HUNK_OVERLAY10133F5
HUNK_BREAK10143F6
HUNK_DREL3210153F7
HUNK_DREL1610163F8
HUNK_DREL810173F9
HUNK_LIB10183FA
HUNK_INDEX10193FB
HUNK_RELOC32SHORT10203FC
HUNK_RELRELOC3210213FD
HUNK_ABSRELOC1610223FE
HUNK_PPC_CODE *12574E9
HUNK_RELRELOC26 *12604EC

* Extended Hunk Format

Metadata

[edit]

The Amiga could save metadata into hunks, as the hunk structure could be easily adapted to support this feature, but the hunk format of executables was abandoned in favour of ELF and there is no central authority (as the dismissed Commodore) which could implement this feature as one of the Amiga standards.

The Amiga saves some metadata into sidecar files known as ".info" (so called from the name of their extension suffix).

".info" files may be created any time a project (datafile) is saved on disk. Example: When user saves a file called "MyProject" two files may be created on disk called "MyProject" and MyProject.info".

The "MyProject" file contains the real data of the project file, while the "MyProject.info" file contains the icon, and the information regarding the software which originated the file, so any time the project icon is invoked by clicking on it with mouse, the parent software will be opened (users can change this information at any time, allowing other programs to believe they created the project file rather than the original software which physically created it).

Application Binding does not exist in AmigaOS as in other systems like MacOS.

The ".info" file also contains some particular characteristics of the project file and the user comments.

".info" files do not appear on the Workbench Screen (Workbench is the default Amiga Desktop GUI). On the desktop screen only the icon of the project file taken out of the "info" file appears. In fact the icon is the virtual medium that connects the project itself and the metadata stored into ".info".

When the user clicks on the icon with left mouse button, the project ".info" calls the program which originated it. When the user clicks on the icon and chooses the appropriate menu item, then a dialog box will appear, allowing the user to interact with metadata contained in the ".info" file.

The ".info" files are copied or moved together with their associated project file, by moving the icon with the mouse, and can be viewed as a standalone file through the command line interfaces of Amiga such as AmigaShell, or using third party filemanagers or directory listers like Directory Opus or DiskMaster.

If the ".info" file represents an executable program, then the ".info" file contains information about the stack of RAM buffers that could be reserved to the executable file (e.g. 4096, 8192 or 16384 or more bytes of RAM) and even the arguments that could be invoked by using a command line interface. For example, an Amiga program could open its own graphic user interface screen independent from the desktop screen. By invoking arguments such as "Screen=800x600" and "Depth=8" into the info file dialog box, the user can save this information into the associated ".info" file and then program would open the productivity software into its own screen sized 800×600 with 8 bits of colour depth (equal to 256 colors).

The user can also delete ".info" files, but then they will renounce the benefits of having an icon representing the project file on the desktop, and will also lose all the metadata contained in it.

Icons

[edit]

A brief view of the bitmap icons contained into ".info" metadata files:

The icons are RAW bitmap data contained in ".info" files and are not standard Amiga IFF/LBM files. The users can deal with icons by using the AmigaOS standard program "IconEdit", present in the operating system since its early versions. Starting from AmigaOS version 2.0, IconEdit could import and save normal IFF/LBM files used as standard graphics files in AmigaOS.[2]

Some Amiga programs like Personal Paint from Cloanto are able to view, load and save bitmap data as normal Amiga Icons or as Amiga ".info" files already existing.

Legacy Amiga Icons can have two-state icons, using two different bitmap images. The first bitmap contains the data of the "quiet" icon, also known as the "quiet state" of the icon. The second bitmap image contains data of the "selected" state of the icon. When the user clicks on an icon and activates it, then the quiet icon bitmap data is suddenly replaced by the selected icon bitmap data. Such behaviour gives the Amiga icons the effect of moving cartoons. In case this second bitmap does not exist in the ".info" file (it is not mandatory to create both bitmaps), then an inverse color effect is used when the icon is selected.

Third-party icon "engines" exist, which try to keep the look of AmigaOS up to date with modern standards of other Operating Systems. These programs patch the OS routines dedicated to icon handling, replacing them with custom ones. One of such attempts, NewIcons, has become almost the new de facto standard for AmigaOS 3.x. It was so popular that the new icon system used in AmigaOS 3.5 and above, GlowIcons, is based on its icon file format.

All modern Amiga-like operating systems (AmigaOS 4, MorphOS and AROS) could associate either RAW bitmap data, IFF/LBM files or also PNG files as standard internal bitmap image of any icon.

Overlaid executables

[edit]

The HUNK_OVERLAY type was intended to reduce the amount of RAM needed to run a program. Executables with an overlay structure have a root node which is in memory at all times, and the rest of the program is split into smaller modules which are loaded and unloaded automatically when needed.[3]

The Overlay format works by adding little stubs to code so that when they branch into a sub-module, it calls an overlay manager, which loads the requisite module. Commodore defined a standard overlay manager so that C code could automatically have these stubs inserted, and also generate an overlay table, which the standard overlay manager knew how to read.

However, the Overlay format was rarely used, especially in the way it was intended. It was more commonly used with a custom overlay manager. A popular use of overlay format was with the Titanics Cruncher,[4] which compressed executables. Instead of loading the entire compressed executable into memory before unpacking, the Titanics Cruncher used an overlay, so only a tiny decruncher was loaded into memory, then it read and decompressed data as it went.

Other executable file formats used on Amiga

[edit]

With third party add-ons AmigaOS up to 3.9 recognizes various kinds of executable files other than Hunk format created for Motorola 68000.

ELF

[edit]

Phase5 implemented ELF executables for its PowerUP accelerator boards. It was found cumbersome due to its dynamic linking. This format was then adopted as standard by AmigaOS 4.0, MorphOS and AROS. ELF support was added to WarpUp by 3rd party developers and Hyperion Entertainment released number of WarpUp games in ELF format only.[5]

Extended Hunk format

[edit]

In 1997 Haage & Partner developer WarpUp PowerPC kernel for PowerUP accelerator boards. Instead of ELF binary format they had chosen to expand existing hunk format. The problem with ELF binary format was that users had to patch their system to load ELF executables and mixing PPC/68k code was not possible. Extended Hunk Format (EHF), developed by Haage & Partner, allowed mixing PPC and 68k code to single executable without modifying the existing system if PowerPC accelerator was not installed. [1][2].

AmigaOS 4 and MorphOS

[edit]

AmigaOS 4.0 and MorphOS can run ELF natively, but as these systems were designed to run on PowerPC processor-based machines, the developers added also compatibility for WarpUP software, used in AmigaOS 3.9. In addition MorphOS implements PowerUp software compatibility as implemented by Phase5 for PowerUP accelerator cards.

Both new operating systems can also run Amiga Hunk format because they implement the old Amiga API environment based on AmigaOS 3.1, and can run 68000 code through emulation.

  • Notes:
  1. ^ See also pages regarding history of the PPC processor on Amiga at Amiga.History site.
  2. ^ EHF specifications Archived 2007-11-16 at the Wayback Machine (also in English) on Haage&Partners site.

See also

[edit]

References

[edit]
  • The AmigaDOS Manual Third Edition (Bantam Books), Commodore Business Machines, July 1991. ISBN 0-553-35403-5
  • Amiga ROM Kernel Reference Manual, Includes and Autodocs (3rd edition; dark gray cover) Addison-Wesley, 1991. ISBN 0-201-56773-3
  • Commodore Business Machines: 1989 Amiga Developers Conference Notes, Commodore, 1989. CATS part numbers: NOTES89 and NOTES89D
  • Commodore Business Machines: V3.1 Amiga Developer Update Disk Set, Commodore, 1994. CATS part number: AMDEV3.1

(information from this set of floppies distributed by Commodore to Amiga developers are obsolete and updated and replaced into "The Developer CD")

  • Commodore Business Machines: 1988 Amiga Developers Conference Notes Commodore, 1988. CATS part numbers: NOTES88 and NOTES88D
  • Stephen Levy: Amiga Programmer's Guide, Compute! Publications, 1986. ISBN 0-87455-028-9
  • Eugene P. Mortimore: Amiga Programmer's Handbook, Sybex, 1985. ISBN 0-89588-343-0

Notes

[edit]
  1. METACOMCO plc. (1986). Introduction to Tripos.
  2. http://krashan.ppa.pl//articles/amigaicons/ Archived 2017-04-25 at the Wayback Machine some details
  3. http://aminet.net/package/docs/misc/Overlay Doc about binary overlay files
  4. Titanics Cruncher 1.2 (Tool/Exec/Data Cruncher) by Titanics
  5. Steffen Haeuser (18 December 2002). "blast from the past". Archived from the original on 2012-04-23. Retrieved 2011-08-01.
[edit]