home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 4
/
FreshFish_May-June1994.bin
/
new
/
amigalibdisks
/
d982
/
bin2hunk
/
bin2hunk.doc
< prev
next >
Wrap
Text File
|
1994-04-04
|
6KB
|
148 lines
***************************************************************************
* *
* Bin2Hunk V2.2 *
* *
* © 1993 by Brian Koetting *
* *
***************************************************************************
** DISTRIBUTION:***********************************************************
Bin2Hunk is FREELY redistributable. With the exception of reasonable media
and distribution costs, no one should be making money off this.
** AAD:********************************************************************
Please add ALL APPLICABLE DISCLAIMERS here.
** INTRODUCTION:***********************************************************
As the name implies, this program will convert any binary file to an
AmigaDOS hunk (or object file) that can be linked with your linker into
your program.
This is most useful when you wish some form of data to be a part of your
executable. This data can be sound samples, images, text, or whatever.
At least one other program of this genre is available, but the one I am
aware of, did not even work properly, was CLI-based only, and about 20K.
Bin2Hunk, however, sports a ReadArgs() CLI-interface, a GadTools
Intuition interface, and weighs-in around 6K! Bin2Hunk also boasts the
ASL file requester and also asks for confirmation before overwriting
an already existing file. So what are you waiting for?
Bin2Hunk is "Enforcer" and "Mungwall" passed, and tested with the SAS/C
compiler Versions 5.10 through 6.51.
** USAGE:******************************************************************
Bin2Hunk runs only under AmigaDOS 2.0 and above.
Bin2Hunk accepts the following command line argument:
Bin2Hunk InFile/A,OutFile,NAME/K,LENGTH/K,HUNK/K,CHIP/S,FAST/S:
where:
- InFile is the name (and path) of your binary file to convert.
- OutFile is the name (and path) of the final hunk object file.
- NAME=<string> is the name of the data array that will be used as
the external reference. (the name by which you want to access the
data)
- LENGTH=<string> is the name of an optional external reference to
the size of your data. This 32-bit value (LONG) will be in bytes.
- HUNK=<string> is the name of the new hunk. See below for details.
- CHIP will ensure that your data will be loaded into CHIP ram.
- FAST will ensure that your data will be loaded into FAST ram.
When you specify an InFile, Bin2Hunk also creates default names for the
remaining strings with the following rules:
- OutFile becomes the base name of InFile but with an .o appended.
- Data Name becomes the base name of InFile with an "_" prepended.
This is useful for C programmers.
- Length Name is the base name of InFile with an "_" prepended and
"_len" appended.
When other names are specified, the default ones are overwritten. Note
that Bin2Hunk will allow names that AmigaDOS and/or your compliler/
assembler will not accept. Please be careful with your names.
Most C compilers require an underscore ("_") prepended to the varible,
since they also do this themselves. In other words, if you want to
access the data with the name "foo_data", then you need to supply
Bin2Hunk with the name "_foo_data". Assemblers do not do this however.
The Hunk name is used by the linker to merge hunks. Any hunks with the
same name are merged together. A blank name is a valid hunk name.
If you do not use the __MERGED hunk name, you may have to declare
your external data reference item with the "__far" keyword (assuming
you're using a SAS/C compiler).
Typically your external declaration should look like this:
For Memory Type of ANY:
extern UBYTE data_ptr[];
For Memory Type of CHIP:
extern UBYTE __chip data_ptr[];
For Memory Type of FAST:
extern UBYTE __far data_ptr[];
You may have to experiment using the __far and __chip keywords, or your
compilers equivalents. Please consult your compiler's manual for more
information.
If no InFile is specified, Bin2Hunk will open it's interface window.
The interface window contains gadgets for all these options and operates
in a self-explanitory manner.
** WHAT IT DOES:***********************************************************
Basically, Bin2Hunk takes your file and copies it into an AmigaDOS hunk
file in the following format:
HUNK_UNIT
HUNK_NAME <your hunk name>
HUNK_DATA <your data>
HUNK_EXT <external reference to your data and a variable of its length>
HUNK_END
as detailed in the Bantam AmigaDOS Manual 3rd Edition Chapter 10.
** CREDITS, COMMENTS, REQUESTS, BUGS, DONATIONS:***************************
Brian Koetting can be reached through:
BIX: bsk
EMAIL: koettingb@yvax.byu.edu
MAIL:
671 East 420 North
Provo, Utah 84606
** HISTORY:****************************************************************
V1.4 First public release
V1.5 Added ASL file requester for SAVE function
V1.6 Fixed bug with "Memory Type" due to error in AmigaDOS manual
V1.7 Made window adjust to different Screen fonts. (still uses topaz,
but now adjusts the window to account for a differnt size title bar)
V2.0 Added HUNK_NAME support - now accepts (and saves) a name for the hunk
V2.1 Added LAmiga-Q to quit
V2.2 Fixed minor bug
***************************************************************************