HOME

TheInfoList



OR:

Hunk is the
executable In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instructions", as opposed to a data fil ...
file format A file format is a standard way that information is encoded for storage in a computer file. It specifies how bits are used to encode information in a digital storage medium. File formats may be either proprietary or free. Some file format ...
of tools and programs of the Amiga Operating System based on
Motorola Motorola, Inc. () was an American multinational telecommunications company based in Schaumburg, Illinois, United States. After having lost $4.3 billion from 2007 to 2009, the company split into two independent public companies, Motorola ...
68000 The Motorola 68000 (sometimes shortened to Motorola 68k or m68k and usually pronounced "sixty-eight-thousand") is a 16/32-bit complex instruction set computer (CISC) microprocessor, introduced in 1979 by Motorola Semiconductor Products Secto ...
CPU A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, a ...
and other processors of the same family. 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

The hunks in an Amiga executable file could exist in various types. There are
32-bit In computer architecture, 32-bit computing refers to computer systems with a processor, memory, and other major system components that operate on data in 32- bit units. Compared to smaller bit widths, 32-bit computers can perform large calculati ...
hunks,
16-bit 16-bit microcomputers are microcomputers that use 16-bit microprocessors. A 16-bit register can store 216 different values. The range of integer values that can be stored in 16 bits depends on the integer representation used. With the two ...
hunks, and even some
8-bit In computer architecture, 8-bit integers or other data units are those that are 8 bits wide (1 octet). Also, 8-bit central processing unit (CPU) and arithmetic logic unit (ALU) architectures are those that are based on registers or data buses ...
hunks. Types of hunks were standardized in
AmigaOS AmigaOS is a family of proprietary native operating systems of the Amiga and AmigaOne personal computers. It was developed first by Commodore International and introduced with the launch of the first Amiga, the Amiga 1000, in 1985. Early versions ...
, and well documented in ''The AmigaDOS Manual'' edited by
Commodore Commodore may refer to: Ranks * Commodore (rank), a naval rank ** Commodore (Royal Navy), in the United Kingdom ** Commodore (United States) ** Commodore (Canada) ** Commodore (Finland) ** Commodore (Germany) or ''Kommodore'' * Air 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

Amiga executable files can be launched either from the graphical
shell Shell may refer to: Architecture and design * Shell (structure), a thin structure ** Concrete shell, a thin shell of concrete, usually with no interior columns or exterior buttresses ** Thin-shell structure Science Biology * Seashell, a hard o ...
of the Amiga, the
Workbench A workbench is a sturdy table at which manual work is done. They range from simple flat surfaces to very complex designs that may be considered tools in themselves. Workbenches vary in size from tiny jewellers benches to the huge benches used by ...
or from the Amiga's
command line interpreter A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
(called CLI, later AmigaShell). No particular
filename extension A filename extension, file name extension or file extension is a suffix to the name of a computer file (e.g., .txt, .docx, .md). The extension indicates a characteristic of the file contents or its intended use. A filename extension is typically ...
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 AmigaOS is a family of proprietary native operating systems of the Amiga and AmigaOne personal computers. It was developed first by Commodore International and introduced with the launch of the first Amiga, the Amiga 1000, in 1985. Early versions ...
does not differentiate between
filename extensions A filename extension, file name extension or file extension is a suffix to the name of a computer file (e.g., .txt, .docx, .md). The extension indicates a characteristic of the file contents or its intended use. A filename extension is typically d ...
.
AmigaOS AmigaOS is a family of proprietary native operating systems of the Amiga and AmigaOne personal computers. It was developed first by Commodore International and introduced with the launch of the first Amiga, the Amiga 1000, in 1985. Early versions ...
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 In mathematics and computing, the hexadecimal (also base-16 or simply hex) numeral system is a positional numeral system that represents numbers using a radix (base) of 16. Unlike the decimal system representing numbers using 10 symbols, he ...
value $000003f3. This sequence, which signifies an executable file and lets it be self-running, is called a
magic cookie In computing, a magic cookie, or just cookie for short, is a token or short packet of data passed between communicating programs. The cookie is often used to identify a particular event or as "handle, transaction ID, or other token of agreement be ...
(from the ''magic cookies'' in
Alice's Adventures in Wonderland ''Alice's Adventures in Wonderland'' (commonly ''Alice in Wonderland'') is an 1865 English novel by Lewis Carroll. It details the story of a young girl named Alice who falls through a rabbit hole into a fantasy world of anthropomorphic creature ...
by
Lewis Carroll Charles Lutwidge Dodgson (; 27 January 1832 – 14 January 1898), better known by his pen name Lewis Carroll, was an English author, poet and mathematician. His most notable works are '' Alice's Adventures in Wonderland'' (1865) and its sequ ...
). This kind of solution to identify executables on the Amiga was taken from similar solutions which were adopted by
UNIX Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, ...
/
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
operating systems, where ''magic cookies'' are called '' magic numbers''.


Structure of an Amiga executable file

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:


Hunk Types

Known hunk types for the Amiga are: ''* Extended Hunk Format''


Metadata

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 An elf () is a type of humanoid supernatural being in Germanic mythology and folklore. Elves appear especially in North Germanic mythology. They are subsequently mentioned in Snorri Sturluson's Icelandic Prose Edda. He distinguishes "ligh ...
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 file Sidecar files, also known as buddy files or connected files, are computer files that store data (often metadata) which is not supported by the format of a source file. There may be one or more sidecar files for each source file. There may also be ...
s known as ".info" (so called from the name of their extension suffix). ".info" files are created any time a project (datafile) is saved on disk. Example: When user saves a file called "MyProject" two files will 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 AmigaOS is a family of proprietary native operating systems of the Amiga and AmigaOne personal computers. It was developed first by Commodore International and introduced with the launch of the first Amiga, the Amiga 1000, in 1985. Early versions ...
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 with the right button, 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 Directory Opus (or "DOpus" as its users tend to call it) is a file manager program, originally written for the Amiga computer system in the early to mid-1990s. Commercial development on the version for the Amiga ceased in 1997. Directory Opus is s ...
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

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 AmigaOS is a family of proprietary native operating systems of the Amiga and AmigaOne personal computers. It was developed first by Commodore International and introduced with the launch of the first Amiga, the Amiga 1000, in 1985. Early versions ...
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. Some Amiga programs like
Personal Paint Personal may refer to: Aspects of persons' respective individualities * Privacy * Personality * Personal, personal advertisement, variety of classified advertisement used to find romance or friendship Companies * Personal, Inc., a Washington, ...
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 AmigaOS 4 (abbreviated as OS4 or AOS4) is a line of Amiga operating systems which runs on PowerPC microprocessors. It is mainly based on AmigaOS 3.1 source code developed by Commodore, and partially on version 3.9 developed by Haage & Partne ...
,
MorphOS MorphOS is an AmigaOS-like computer operating system (OS). It is a mixed proprietary and open source OS produced for the Pegasos PowerPC (PPC) processor based computer, PowerUP accelerator equipped Amiga computers, and a series of Freescale dev ...
and
AROS Aros may refer to: *Aros (Middle-earth), a river in J. R. R. Tolkien's Middle-earth legendarium * Aros, Mull, the location of Aros Castle, a ruined 13th-century castle on the Isle of Mull, Scotland *AROS Research Operating System, a free software i ...
) could associate either RAW bitmap data, IFF/LBM files or also PNG files as standard internal bitmap image of any icon.


Overlaid executables

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.http://aminet.net/package/docs/misc/Overlay Doc about binary overlay files 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, 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

With third party add-ons
AmigaOS AmigaOS is a family of proprietary native operating systems of the Amiga and AmigaOne personal computers. It was developed first by Commodore International and introduced with the launch of the first Amiga, the Amiga 1000, in 1985. Early versions ...
up to 3.9 recognizes various kinds of executable files other than Hunk format created for Motorola 68000.


ELF

Phase5 Phase5 Digital Products is a defunct German computer hardware manufacturer that developed third-party hardware primarily for the Amiga platform. Their most popular products included CPU upgrade boards, SCSI controllers and graphics cards. Notab ...
implemented
ELF An elf () is a type of humanoid supernatural being in Germanic mythology and folklore. Elves appear especially in North Germanic mythology. They are subsequently mentioned in Snorri Sturluson's Icelandic Prose Edda. He distinguishes "ligh ...
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 AmigaOS 4 (abbreviated as OS4 or AOS4) is a line of Amiga operating systems which runs on PowerPC microprocessors. It is mainly based on AmigaOS 3.1 source code developed by Commodore, and partially on version 3.9 developed by Haage & Partn ...
,
MorphOS MorphOS is an AmigaOS-like computer operating system (OS). It is a mixed proprietary and open source OS produced for the Pegasos PowerPC (PPC) processor based computer, PowerUP accelerator equipped Amiga computers, and a series of Freescale dev ...
and
AROS Aros may refer to: *Aros (Middle-earth), a river in J. R. R. Tolkien's Middle-earth legendarium * Aros, Mull, the location of Aros Castle, a ruined 13th-century castle on the Isle of Mull, Scotland *AROS Research Operating System, a free software i ...
. ELF support was added to WarpUp by 3rd party developers and Hyperion Entertainment released number of WarpUp games in ELF format only.


Extended Hunk format

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. 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. .


AmigaOS 4 and MorphOS

AmigaOS 4.0 AmigaOS 4 (abbreviated as OS4 or AOS4) is a line of Amiga operating systems which runs on PowerPC microprocessors. It is mainly based on AmigaOS 3.1 source code developed by Commodore, and partially on version 3.9 developed by Haage & Partn ...
and
MorphOS MorphOS is an AmigaOS-like computer operating system (OS). It is a mixed proprietary and open source OS produced for the Pegasos PowerPC (PPC) processor based computer, PowerUP accelerator equipped Amiga computers, and a series of Freescale dev ...
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 AmigaOS is a family of proprietary native operating systems of the Amiga and AmigaOne personal computers. It was developed first by Commodore International and introduced with the launch of the first Amiga, the Amiga 1000, in 1985. Early versions ...
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 AmigaOS is a family of proprietary native operating systems of the Amiga and AmigaOne personal computers. It was developed first by Commodore International and introduced with the launch of the first Amiga, the Amiga 1000, in 1985. Early versions ...
3.1, and can run 68000 code through emulation. *Notes: # See also pages regardin
history of the PPC processor on Amiga
at Amiga.History site.

(als

on Haage&Partners site.


See also

*
Comparison of executable file formats This is a comparison of binary executable file formats which, once loaded by a suitable executable loader, can be directly executed by the CPU rather than being interpreted by software. In addition to the binary application code, the executables ma ...
* vasm, a free assembler part of vbcc


References

* The AmigaDOS Manual Third Edition (Bantam Books), Commodore Business Machines, July 1991. * Amiga ROM Kernel Reference Manual, Includes and Autodocs (3rd edition; dark gray cover) Addison-Wesley, 1991. * 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. * Eugene P. Mortimore: Amiga Programmer's Handbook, Sybex, 1985.


External links


Amiga goes PowerUP
Unofficial PowerUP Support Homepage
Third party description of Amiga hunk format
{{AmigaOS AmigaOS Executable file formats Debugging data formats Computer file formats