Topic : The ATARI Compendium
Author : Scott Sanders / JAY Software
Version : 1.25 (20/6/2003)
Subject : Documentation
Nodes : 1117
Index Size : 32614
HCP-Version : 6
Compiled on : Atari
@charset : UTF-8
@lang : en
@default :
@help : %About
@options : +g -i -t4 +y +z
@width : 100
View Ref-FileA CPX Executable FormatA CPX executable is identical to a standard GEMDOS executable with the
exception of an additional 512 byte header which precedes the standard 28
byte GEMDOS header. When XCONTROL is initialized at boot time, the header
of each CPX contained in the user's designated CPX directory is loaded
and stored. The header data contains the following information:
typedef struct _cpxhead
{
UWORD magic; /* Magic = 100 dec */
struct {
unsigned reserved : 13; /* Reserved */
unsigned resident : 1; /* Resident CPX if set */
unsigned bootinit : 1; /* Boot initialize if set*/
unsigned setonly : 1; /* Set only CPX if set */
} flags;
LONG cpx_id; /* CPX ID Value */
UWORD cpx_version; /* CPX Version */
char i_text[14]; /* Icon Text */
UWORD sm_icon[48]; /* Icon Bitmap 32x24 */
UWORD i_color; /* Icon Color */
char title[18]; /* Title (16 char max) */
UWORD t_color; /* Title text color */
char buffer[64]; /* User-storage */
char reserved[306]; /* Reserved */
} CPXHEAD;
Following the 512-byte CPX header the 28-byte GEMDOS header and
executable follow. CPX's do not have a 'main()' function. Execution begins
at the first instruction of the TEXT segment. The first source file you
should link should resemble the following:
.xref _cpx_init
.text
cpxstart:
jmp _cpx_init
.end
Every CPX must have a cpx_init() function.
If you plan to store defaults back into the CPX using CPX_Save()(described later) you should add to the first source file a statement
allocating as much storage as you will need at the beginning of the DATA
segment. For example, the following is a complete stub for a CPX requiring
10 LONGs of data for permanent storage.
.xref _cpx_init
.globl _save_vars
.text
cpxstart:
jmp _cpx_init
.data
_save_vars:
.dc.l 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
.end