Binary packaging on the CPCs

Amstrad CPC and NC systems
Post Reply
stefano
Well known member
Posts: 1534
Joined: Mon Jul 16, 2007 7:39 pm

Binary packaging on the CPCs

Post by stefano »

Should the appmake features need fixes or improvements ?

Do we need to update the documentation (see below) ?

http://www.z88dk.org/wiki/doku.php/platform:amstradcpc
Mochilote
Member
Posts: 42
Joined: Thu Jul 19, 2007 10:54 am

Post by Mochilote »

stefano wrote:Do we need to update the documentation (see below) ?
I'm at work so i not sure at all, but:

If you use -make-app instead -create-app, you could execute the binary directly, without the need of "memory, load, call", you can execute it using run"binary

Cheers.
norecess
Member
Posts: 73
Joined: Thu Mar 20, 2008 12:58 am

Post by norecess »

I had no problems while using create-app. It produced a good CPC binary, including AMSDOS header with correct origin and execution address. Lovely !

On the other side, I had to use some third-party tools to convert binary data to source-code and so on (using well-known tools such as BIN2C etc) but I think it's outside z88dk's scope.

About the wiki, I just noted few things..
"zcc +cpc [...] -lmz -l6128_math
or -l664_math or -l664_math which will save about 600 bytes of memory."
I wonder why this 600 bytes difference !

Still, on the wiki. If you produce code under 0x1200 and needs to get loaded then run from BASIC, you need the following sequence :

Code: Select all

openout"d":memory &3ff:closeout:load"mybin",&400:call &400
stefano
Well known member
Posts: 1534
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Hmm.. could you be able to rewrite that page ?
It's a (quick) mix of deifferent docs, at the moment.. I can try to clean the gross, but I'm unsure on many informations.
As far as I recall the 600 bytes was the difference between the standard z88dk float lib and the target specific one.
User avatar
dom
Well known member
Posts: 1195
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

stefano wrote:As far as I recall the 600 bytes was the difference between the standard z88dk float lib and the target specific one.
Actually, it's because there's a generic CPC math library which will pull in all cpc math routines and patch them so that the correct firmware address is called. Using the machine specific one will only pull in the routines that are needed.
stefano
Well known member
Posts: 1534
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Ok, I slightly changed some text in that page (I suppose the question about the 600 bytes was due to a typing error, cpc664 in place of cpc464).

Could you please help explaining in detail the..
run"binary

Trick ?
norecess
Member
Posts: 73
Joined: Thu Mar 20, 2008 12:58 am

Post by norecess »

Could you please help explaining in detail the..
run"binary
Each files in Amstrad file-system is defined by the following header :

Code: Select all

typedef struct
    {
    BYTE    UserNumber;   
    BYTE    FileName[ 15 ];
    BYTE    BlockNum;      
    BYTE    LastBlock;       
    BYTE    FileType;         
    WORD    Length;         
    WORD    Adress;         
    BYTE    FirstBlock;       
    WORD    LogicalLength;
    WORD    EntryAdress;
    BYTE    Unused[ 0x24 ];
    WORD    RealLength; 
    BYTE    BigLength;   
    WORD    CheckSum; 
    BYTE    Unused2[ 0x3B ];
    } StAmsdos;
This header contains 3 informations : Adress, Length, EntryAdress.

When using run"Binary", the system check for the file's header. It loads the binary at LoadAdress and execute (call) EntryAdress, once loaded.

Run"Binary is equal to

Code: Select all

memory LoadAdress - 1
load "binary", LoadAdress
call EntryAdress
Hope this helps.
Mochilote
Member
Posts: 42
Joined: Thu Jul 19, 2007 10:54 am

Post by Mochilote »

norecess wrote:Run"Binary is equal to

Code: Select all

memory LoadAdress - 1
load "binary", LoadAdress
call EntryAdress
As you can see in this other post that its not totally true.

Finally i have tested -create-app and -make-App:

-create-app Inserts amsoft header, so the binary can execute with run"binary
-make-app need to use memory/load/call to run.

Cheers.
stefano
Well known member
Posts: 1534
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

"-make-app" is new to me.. is it really necessary ?
What if you just omit that flag ?
Mochilote
Member
Posts: 42
Joined: Thu Jul 19, 2007 10:54 am

Post by Mochilote »

stefano wrote:"-make-app" is new to me.. is it really necessary ?
What if you just omit that flag ?
I not use it, i only say that:
-create-app Inserts amsoft header, so the binary can execute with run"binary
-make-app need to use memory/load/call to run.

I tried it in the past because i don't understand the difference between them, i think the doc explanation is confused:
http://www.z88dk.org/wiki/doku.php/zcc

-create-app Create an application image (i.e. bank 63,62 etc)
-make-app (App) Notify the compiler that you're trying to make an
application


Cheers.
stefano
Well known member
Posts: 1534
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

I suspect it is only Z88 related, that platform supports a special "application" format.
Leaving it without options will make a raw binary anyway.
Please have another look at the CPC wiki page and let me know..
User avatar
dom
Well known member
Posts: 1195
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

-make-app puts all uninitialised static variables into a DEFVARS block, it's useful for ROM based targets such as the z88 when generating a .app application.

A lot of the random options are used for the z88, sccz80 -h will list them.
stefano
Well known member
Posts: 1534
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Thank you, Dom. I slightly adjusted that page.
Post Reply