 __  __       _           _               _____ 
|  \/  | __ _| | _____   / \   _ __  _ __|___ / 
| |\/| |/ _` | |/ / _ \ / _ \ | '_ \| '_ \ |_ \ 
| |  | | (_| |   <  __// ___ \| |_) | |_) |__) |
|_|  |_|\__,_|_|\_\___/_/   \_\ .__/| .__/____/ 
                              |_|   |_|         
================================================
v1.08 (30 May 2007) by James Lampard (james_lampard@talk21.com)

In the process of writing WrapAIF, I spent some time using MakeApp2.
Although pretty good for it's time; in some areas I found it lacking,
so I decided to write my own replacement. This is the result.

For the uninitiated, the MakeApp series of programs take a BASIC program
and add a small machine code stub. The resultant program can then be
treated as machine-code absolute program. This is intended for people who
want to hide their programs, or comply with the conditions of BASIC
libraries they may be using.

Here is a quick comparison table of the two programs.

MakeApp2                        MakeApp3

Desktop only                    Desktop & cli
256 chars command line limit    No limit (so supports 1024 on RO4+)()
Use system variable for cli     Copies to end of image instead
Doesn't produce AIF header      Produces AIF header for A9 compatibility
BASIC V only                    Also supports BASIC64
Stub uses slow byte copy        Uses faster word copy
Adds aprox 276 bytes to program Adds aprox 400 bytes to program

This assumes your BASIC program itself supports long command lines, ie by
using OS_ReadArgs, and not just doing SYS "OS_GetEnv" TO str$


Desktop use:
After running !MakeApp3.  Drag a BASIC Program to the icon, select which
options you want and then press run.

"26Bit": If this option is ticked, the AIF header will identify the file as
26Bit, this is the default, to force you to actually check if programs are 
32Bit compatible.

"Disguise Basic": If you want to pretend your program isn't Basic, this option
will encode your program. So that it can't be seen on loading into an editor.

"No end of file sig":  By default the produced file will have the string
"MakeApp3 1.08" added to the end, this is intended to help future
programmers who might have to alter AIF images some more for future versions
of RISC OS. If you don't want this helpful text, just select this option.

"Use Basic64":  Some programs will run better with BBC Basic VI, with it's
long FP support, if you choose this option, your final absolute will use
Basic VI.
It is however up to you to make sure the module is loaded first.

"Size xxx K": This is the desired slot size, it's stored in the zero-init
size word in the header and when added to the read-only and read/write entries
this will come to the slot size you've asked for. If you specify too little,
MakeApp3 will put a sensible value in instead.


CLI use:
MakeApp3 can also be run directly via the CLI, for use in Makefiles and the
like.

The command is *MakeApp3
and it's parameters are
[-INFILE] <afsp>      the input file
[[-OUTFILE] <fsp>]    the output file - if not supplied, the input file will
be overwritten
[-SIZE <kilobytes>]   specifies the slot size, in the AIF header
[-26Bit]              switch causing 26 to be written to byte &30 (see above)
[-NOSIG]              switch which will suppress the signature (see above)
[-DISGUISE]           hide the basic program by EORing it
[-64BASIC]            use BASIC VI


The first difference I can find between the original BASIC program and the
produced absolute is in cli handling.
Calling a BASIC program directly (ie not through an alias) with no
parameters, but with spaces on the end;
On the plain BASIC the spaces are stripped (except for one)
On the converted program they remain.
I can't see this causing any problems.

The second difference is with the passed path when the program is called
relative to the CSD (instead of by a complete path)
When calling the program 'tst' (which shows the passed cli & time of start) 
relative to the CSD in basic;

*/ BASIC.tst testpassing parameters to program 
CLI [BASIC -quit "ADFS::HardDisc4.$.Develop.Libraries.Resurgam2.MakeApp3
.BASIC.tst" testpassing parameters to program ]
RAM Limit [A8000]
Time low [B6E1515C]
Time high [4E]

Calling the copy that has been run through MakeApp3 produces the following;
*/ AIF.tst testpassing parameters to program 
CLI [Basic -quit "AIF.tst" testpassing parameters to program ]
RAM Limit [A8000]
Time low [B6E12A06]
Time high [4E]

As you can see the path isn't being canonicalised.
MakeApp2 shows exactly the same behaviour, so I can't see this effecting anyone
either.


History
v1.01 (01 Sep 2006)
  First official release version, thanks to David Ruck for helping find a bug
on the Iyonix.

v1.06 (19 Feb 2007)
  Updated to use ResFind, signature is now last version when output changed (ie
1.01) and wont be changed again until the output alters.

v1.08 (30 May 2007)
  Added 'Disguise Basic' option, thanks to Bernard Veasey for suggesting this
and for sending me Rob Kendrick's MakeApp3 (turned out to be a hacked MakeApp2)
which implemented this. Code used in stub simplified.

  
Copyright & Warranty:
MakeApp3 and it's associated files are freeware (c) James Lampard 2006,
it may be distributed only if no files are altered.
This software comes with no warranty, and the author cannot be held
responsible for any damage caused by use or misuse of this program.
