aboutsummaryrefslogtreecommitdiff
path: root/xex.rst
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-04-30 14:29:45 -0400
committerB. Watson <urchlay@slackware.uk>2024-04-30 14:29:45 -0400
commitab1e28cb6e8fdac74fa03e952c136f7848d727e0 (patch)
treefe0b2a0b1760367625b9abf25c46b65ec2e7c107 /xex.rst
parentf952610919261d2d83ad69d11b071a3b64f7af6c (diff)
downloadbw-atari8-tools-ab1e28cb6e8fdac74fa03e952c136f7848d727e0.tar.gz
xex(5): add pseudo-EBNF.
Diffstat (limited to 'xex.rst')
-rw-r--r--xex.rst20
1 files changed, 19 insertions, 1 deletions
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