aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xex.521
-rw-r--r--xex.rst20
2 files changed, 38 insertions, 3 deletions
diff --git a/xex.5 b/xex.5
index ce9e449..b46b2fb 100644
--- a/xex.5
+++ b/xex.5
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.TH "XEX" 5 "2024-04-29" "0.2.1" "Urchlay's Atari 8-bit Tools"
+.TH "XEX" 5 "2024-04-30" "0.2.1" "Urchlay's Atari 8-bit Tools"
.SH NAME
xex \- Atari 8-bit executable file format.
.\" RST source for xex(5) man page. Convert with:
@@ -42,8 +42,23 @@ as ".xex" or "binary load".
The file format consists of one or more segments, each having its own
load address. This is an absolute address in the Atari\(aqs memory map,
and there\(aqs no facility for relocating the code.
+.SS File Structure
.sp
-Segments have a 4\- or 6\-byte header. The first segment in the file
+In pseudo\-EBNF, the file structure looks like:
+.INDENT 0.0
+.IP \(bu 2
+ffff_header = "$FF", "$FF"
+.IP \(bu 2
+initial_segment = ffff_header, segment
+.IP \(bu 2
+segment = start_address, end_address, data
+.IP \(bu 2
+file = initial_segment, [ (initial_segment | segment) ... ]
+.UNINDENT
+.sp
+In English:
+.sp
+Each segment has a 4\- or 6\-byte header. The first segment in the file
must use the 6\-byte header. Further segments can use either the 4\-byte
or 6\-byte header.
.sp
@@ -63,6 +78,7 @@ initial \fB$FF\fP, \fB$FF\fP bytes.
.sp
The rest of each segment just consists of the data to be loaded,
exactly \fI(end_address \- load_address) + 1\fP bytes.
+.SS Initialization
.sp
It\(aqs possible to run code in the middle of loading the file. Such code
is usually referred to as an an "init routine". A XEX file can have
@@ -74,6 +90,7 @@ soon as this segment is loaded, the DOS will jump (actually \fBJSR\fP)
to this address, which should exit back to DOS with an \fBRTS\fP
instruction. After the routine exits, DOS will continue loading the
file normally.
+.SS Run Address
.sp
A .xex file can (and usually does) also have a run address. Unlike
init addresses, there can be only one run address. If the file
diff --git a/xex.rst b/xex.rst
index 41ecb0e..8f77f6e 100644
--- a/xex.rst
+++ b/xex.rst
@@ -21,7 +21,19 @@ The file format consists of one or more segments, each having its own
load address. This is an absolute address in the Atari's memory map,
and there's no facility for relocating the code.
-Segments have a 4- or 6-byte header. The first segment in the file
+File Structure
+--------------
+
+In pseudo-EBNF, the file structure looks like:
+
+- ffff_header = "$FF", "$FF"
+- initial_segment = ffff_header, segment
+- segment = start_address, end_address, data
+- file = initial_segment, [ (initial_segment | segment) ... ]
+
+In English:
+
+Each segment has a 4- or 6-byte header. The first segment in the file
must use the 6-byte header. Further segments can use either the 4-byte
or 6-byte header.
@@ -40,6 +52,9 @@ initial **$FF**, **$FF** bytes.
The rest of each segment just consists of the data to be loaded,
exactly *(end_address - load_address) + 1* bytes.
+Initialization
+--------------
+
It's possible to run code in the middle of loading the file. Such code
is usually referred to as an an "init routine". A XEX file can have
multiple init routines, or none at all.
@@ -51,6 +66,9 @@ to this address, which should exit back to DOS with an **RTS**
instruction. After the routine exits, DOS will continue loading the
file normally.
+Run Address
+-----------
+
A .xex file can (and usually does) also have a run address. Unlike
init addresses, there can be only one run address. If the file
contains more than one run address, only the last one loaded has any