Article View: net.micro.atari
Article #2097atst.out.h - format of .prg files
From: D'arc Angel
Date: Thu, 16 Jan 1986 03:54
Date: Thu, 16 Jan 1986 03:54
87 lines
3248 bytes
3248 bytes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~\ lineater,\~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
so far this is the only source i have worth contributing, hopefully
more will follow, this is a .h file i wrote (with some help from a
friend at CWRU) that describes the format of the header for atari .o
and .prg files:
/* atst.out.h .1 24Dec85 */
/*
* Header prepended to each Atari ST .prg file
*/
struct exec {
short a_magic; /* magic number */
unsigned long a_text; /* size of text segment */
unsigned long a_data; /* size of initialized data */
unsigned long a_bss; /* size of uninitialized data */
unsigned long a_syms; /* size of symbol table */
unsigned long a_AZero1; /* always zero */
unsigned long a_AZero2; /* always zero */
unsigned short a_isreloc; /* is reloc info present */
};
#define CMAGIC 0x601a /* contiguous text */
#define ISRELOCINFO 0 /* relocation information is present */
/* any other value - no reloc info */
/*
* Macros which take exec structures as arguments and tell whether
* the file has a reasonable magic number or offsets to text|symbols|strings.
*/
#define N_BADMAG(x) \
(((x).a_magic)!=CMAGIC)
#define N_TXTOFF(x) \
((x).a_magic==ZMAGIC ? 1024 : sizeof (struct exec))
#define N_SYMOFF(x) \
(N_TXTOFF(x) + (x).a_text+(x).a_data)
#define N_STROFF(x) \
(N_SYMOFF(x) + (x).a_syms)
/*
* Format of a relocation datum.
*/
struct relocation_info {
int r_address; /* offset from beg of Text Segment of */
/* 1st longword needing relocation */
unsigned char r_offset; /* reloc offset byte */
};
/*
* Format of a symbol table entry
*/
struct nlist {
char n_name[9]; /* symbol name */
unsigned short n_type; /* type flag, i.e. N_TEXT etc; see below */
unsigned long n_value; /* value of this symbol (or sdb offset) */
};
/*
* Simple values for n_type.
*/
#define N_BSS 0x0100 /* bss */
#define N_TEXT 0x0200 /* text */
#define N_DATA 0x0400 /* data */
#define N_EXT 0x0800 /* external */
#define N_EQREG 0x1000 /* equated register */
#define N_GLOBL 0x2000 /* global */
#define N_EQU 0x4000 /* equated */
#define N_DEF 0x8000 /* defined */
-------------------------------------------------------------------------
it has a problem (at least on VAXen) that C likes to add a half word
of filler after the magic number in the start of the header, anyone
have a work around for it?
--
god bless Lily St. Cyr
-Rocky Horror Picture Show
Name: James Turner
Mail: Imagen Corp. 2650 San Tomas Expressway, P.O. Box 58101
Santa Clara, CA 95052-9400
AT&T: (408) 986-9400
UUCP: ...{decvax,ucbvax}!decwrl!imagen!turner
CompuServe: 76327,1575
Technical Details
Message-ID:
<202@imagen.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!sun!saber!imagen!turnerShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site imagen.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!sun!saber!imagen!turner From: turner@imagen.UUCP (D'arc Angel) Newsgroups: net.micro.atari Subject: atst.out.h - format of .prg files Message-ID: <202@imagen.UUCP> Date: Wed, 15-Jan-86 22:54:29 EST Article-I.D.: imagen.202 Posted: Wed Jan 15 22:54:29 1986 Date-Received: Sat, 18-Jan-86 07:20:42 EST Distribution: net Organization: The Houses of the Holy Lines: 87