From ab1e28cb6e8fdac74fa03e952c136f7848d727e0 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 30 Apr 2024 14:29:45 -0400 Subject: xex(5): add pseudo-EBNF. --- xex.rst | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'xex.rst') 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 -- cgit v1.2.3