PGX v1 Proposal - aka Chunked PGX
Posted: Tue Mar 09, 2021 8:44 pm
Kernel and BASIC Updates 2020-04-11 brought us the PGX format (v0), thank you @PJW.
I'll hereby suggest the next version of the PGX format - the "chunked" PGX format v1:
PGX header:
Bytes 0--2: the ASCII text "PGX", serving as a signature.
Byte 3: the byte 0x11. The upper 4 bits are the PGX file format version (1), and the lower 4 bits are the CPU code (1 for 65816).
Chunk header:
Bytes 4--7: the destination address in little endian format.
(until this point it's the same as v0, except for the updated pgx version)
Bytes 8--11: the chunk size. A chunk size and destination address of 0 indicates the end of the chunk chain.
Chunk data:
Bytes 12--(12+chunk size): Data to load to the destination address.
..and repeating the next chunk header and chunk data until both chunk size and destination addresses are set to 0.
So it's the nearly the same as v0 but with an additional chunk size field and following chunk data with optionally any
number of chunk header+data blocks.
While specifiying the end of the chunked data with a chunk address and size of 0 instead of just the end of the file
would allow to put arbitrary data at the end of all of the directly loaded chunk data which could be loaded on demand via code -
thus multiple code & data blocks loaded into memory and following code-loadable data resulting in a single file format.
The starting address would be the first chunk address (same as in v0) - but it would be possible to start with a runable code chunk at
e.g. address $03:0000 and then following a data chunk at a lower address (e.g. $02:0000) than the initial run code chunk.
I'll hereby suggest the next version of the PGX format - the "chunked" PGX format v1:
PGX header:
Bytes 0--2: the ASCII text "PGX", serving as a signature.
Byte 3: the byte 0x11. The upper 4 bits are the PGX file format version (1), and the lower 4 bits are the CPU code (1 for 65816).
Chunk header:
Bytes 4--7: the destination address in little endian format.
(until this point it's the same as v0, except for the updated pgx version)
Bytes 8--11: the chunk size. A chunk size and destination address of 0 indicates the end of the chunk chain.
Chunk data:
Bytes 12--(12+chunk size): Data to load to the destination address.
..and repeating the next chunk header and chunk data until both chunk size and destination addresses are set to 0.
So it's the nearly the same as v0 but with an additional chunk size field and following chunk data with optionally any
number of chunk header+data blocks.
While specifiying the end of the chunked data with a chunk address and size of 0 instead of just the end of the file
would allow to put arbitrary data at the end of all of the directly loaded chunk data which could be loaded on demand via code -
thus multiple code & data blocks loaded into memory and following code-loadable data resulting in a single file format.
The starting address would be the first chunk address (same as in v0) - but it would be possible to start with a runable code chunk at
e.g. address $03:0000 and then following a data chunk at a lower address (e.g. $02:0000) than the initial run code chunk.