Standard file header
Although Durango-X is a ROM-based computer, thus not depending on a proper filesystem, the use of a mass-storage device with ROM image files instead of "blowing" and switching physical (E)EPROMs is certainly convenient. Having into account the limitations of an 8-bit computer, especially when dealing with huge modern storage devices, a fully-featured filesystem implemented on the 6502 side would be pretty cumbersome; thus, an intermediate solution is proposed.
The idea behind this is to simply add a standard header to any ROM image (like any individual "file") which creates, by simple concatenation, a linked list of ROM images, easily sorted out by the Durango-X computer thru jumping between headers. This very same principle has been used on the minimOS Operating System as a means to manage ROM contents, but does apply to mass-storage devices as well, especially Solid-State ones (like a readily available SD card).
This header will provide adequate metadata, with some room for expansion. By the way, even if the desired software is going to live on an EPROM permanently and never downloaded from SD, it does not harm to have the Standard Header all the time, if you have 256 spare bytes for it.
The Durango-X Development Cartridge provides a convenient way to upload and run software on the Durango-X computer. It provides an extra 32 KiB RAM switchable with the standard ROM, plus an inexpensive SD-card interface. While standard ROMs (up to 16 KiB) can be placed on this cartridge for regular use, with a suitable bootloader firmware it allows choosing whithin the ROM images stored in the card, downloading any of them in a matter of seconds, and running the selected software flawlessly -- as the Development Cartridge may lock its RAM after downloading, making it read-only just like a regular ROM.
Just like any other 6502 system, ROMs for Durango-X must have appropriate
NMI/RESET/IRQ hardware vectors at the last addresses
$FFFA-$FFFF. However, in order to be fully compliant, a suitable header plus some extra information at the end must be provided, according to this document.
In order to be fully compliant with all devices, all ROM images must have a 512-byte multiple size, including all headers and footers.
A simple 256-byte block must be provided in front of any ROM image in order to be properly identified and linked to other images on the device.
|0||1||$00||Magic number #1 (
|1||2||see table below||Signature|
|3||2||16-bit pointer or
||Loading address (for Pocket format only)|
|5||2||16-bit pointer or
||Execution address (for Pocket format only)|
|7||1||$0D||Magic number #2 (
|8||n||Filename||C-string with filename|
|9+n||m||Comment||C-string with optional comment (n+m ≤ 220 in current version)|
|230 ($E6)||8||User Field 2||8-char string, free for the user, usually library commit hash|
|238 ($EE)||8||User Field 1||8-char string, free for the user, usually main code commit hash|
|246 ($F6)||2||Version (if applies)||Little-endian 16-bit
|248 ($F8)||2||Time||Last modification time in FAT format|
|250 ($FA)||2||Date||Last modification date in FAT format|
|252 ($FC)||3||file size||Includes the 256-byte header. Cannot be over 16 MiB in the current implementation; most likely below 64 KiB.|
|255 ($FF)||1||$00||Magic number #3 (
additional metadata may be included just before the user field 2 (offset < 230), as long as a tighter limit is set to filename+comment total length.
In order not to depend on file extensions, the minimOS file system adds a non-mutable file signature which describes the type of file stored afterwards. Currently supported signatures are shown in the table below:
||< 64 KiB||executable ROM image|
||< 24 KiB||Pocket executable to be loaded into standard RAM (under development)|
||< 16 MiB||generic file|
||< 16 MiB||free space|
||8.5 KiB||HIRES screen dump (256x256 1bpp)|
||8.5 KiB||Colour screen dump (128x128 4bpp)|
||< 8.5 KiB||RLE-compressed HIRES screen dump (256x256 1bpp)|
||< 8.5 KiB||RLE-compressed Colour screen dump (128x128 4bpp)|
Uncompressed screen dumps include a 256-byte empty leader, in order to be sector-aligned. Compressed pictures aren't yes (as of v2.0) supported by the bootloader, and neither are Pocket executables.
In order to be fully compliant with the Development Cartridge, some extra content must be provided at the end of the ROM image. More often than not, the actual code from any ROM will end before the standard
$FFFA vectors initial address. We need to reserve the last 42 bytes for compliance, just as shown in the following example:
; (actual ROM code above) .dsb $FFD6 - *, $FF ; padding to reserved area .asc "DmOS" ; Durango-X ROM signature .dsb $FFE1 - *, $FF ; padding to Development Cartridge interface JMP ($FFFC) ; jump to (downloaded) RESET vector .dsb $FFFA - *, $FF ; standard padding .word nmi ; standard 6502 hard vectors for the supplied ROM .word reset .word irq
While not absolutely necessary, it is highly recommended that the interrupt hard vectors point to
JMP ($0200) (for IRQ) and
JMP($0202) (for NMI), for ease of integration with debuggers. In this case, the startup code must fill the RAM vectors at
$0200-$0203 to make them point to the supplied IRQ and NMI service routines (or to a stored
RTI opcode, if not used).
Pocket format cannot supply the
NMI hard vectors, thus relies on setting the standard interrupt vectors at
$0202 as described above. The footer is not needed for this format.
Using ROM images
ROM images compliant with the aforementioned format are suitable for ROM chips, downloadable files stored in a Raspberry Pi server, or even joined into a Durango-X volume. Check the following link for more information about getting these running in Durango-X