From 75889c131f24785fa0d59b6db38180ec0e83cd75 Mon Sep 17 00:00:00 2001 From: adiee5 <58359866+adiee5@users.noreply.github.com> Date: Sat, 4 Oct 2025 18:26:58 +0200 Subject: [PATCH 1/2] add atari XEX format --- patterns/xex.hexpat | 34 ++++++++++++++++++++++++ tests/patterns/test_data/xex.hexpat.xex | Bin 0 -> 128 bytes 2 files changed, 34 insertions(+) create mode 100644 patterns/xex.hexpat create mode 100644 tests/patterns/test_data/xex.hexpat.xex diff --git a/patterns/xex.hexpat b/patterns/xex.hexpat new file mode 100644 index 00000000..6d6ed8ac --- /dev/null +++ b/patterns/xex.hexpat @@ -0,0 +1,34 @@ +#pragma author Adiee5 +#pragma description Atari 8-bit binary format (.xex) +#pragma endian little +#pragma magic [ FF FF ] @ 0 + +import std.mem; +import std.io; + +u16 header @ 0; + +if (header != 0xFFFF) + std::error("Not a valid XEX file"); + +fn hex_dec_addr(u16 num){ + return std::format("0x{:04X} ({})", num, num); +}; + +struct block { + u16 start [[comment("Address of the first byte"), format("hex_dec_addr")]]; + if (start == 0xFFFF) continue; //an unnecessary header to be ignored + u16 end [[comment("Address of the last byte"), format("hex_dec_addr")]]; + + // since 1 and 2 byte blocks sometimes have special meanings, + // we make them regural variables instead of byte arrays, + // so that reading their values from the GUI is easier + match (end-start){ + (0): u8 data; + (1): u16 data [[format("hex_dec_addr")]]; + (_): u8 data[end-start+1]; + } + +}; + +block data_blocks[while(!std::mem::eof())] @ 2 [[name("Data Blocks")]]; \ No newline at end of file diff --git a/tests/patterns/test_data/xex.hexpat.xex b/tests/patterns/test_data/xex.hexpat.xex new file mode 100644 index 0000000000000000000000000000000000000000..41c2aadac4072050b23256bff9ef4f907d88f717 GIT binary patch literal 128 zcmaKj%L#xm3_xQp9y);6IE}6mX@z2Jp$g*7QAO7%#?Ju0cYRM4vdOIziL}Hdwm$Gg x$bbg7YZ_UEEYG~FD*S-}s@G!yRDBEiKup&6y-P04)NvTz;3-RJVzk}r>Kp81Dn$SQ literal 0 HcmV?d00001 From 2eadf1ef96e5e4cc98fd94a3393971bf72ea7125 Mon Sep 17 00:00:00 2001 From: adiee5 <58359866+adiee5@users.noreply.github.com> Date: Sat, 4 Oct 2025 18:29:47 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3d2f2d70..7de6da5e 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi | ZSTD | `application/zstd` | [`patterns/zstd.hexpat`](patterns/zstd.hexpat) | Zstandard compressed data format | | MOD | `3d-model/mod` | [`patterns/DMC3HD-Mod.hexpat`](patterns/dmc3_hd_mod.hexpat) | 3D Model files used in Devil May Cry 3 HD Collection | | CBM BASIC | | [`commodore_basic.hexpat`](patterns/commodore_basic.hexpat) | Commodore BASIC | +| Atari XEX | | [`xex.hexpat`](patterns/xex.hexpat) | Atari 8-bit binary format | | Terminfo | `application/x-terminfo` and `application/x-terminfo2` | [`patterns/terminfo.hexpat`](patterns/terminfo.hexpat) | Compiled *(legacy and extended)* term info entry | ### Scripts