changeset 2570:1559011d749f

Add preliminary support for "Unknown $1000 format (unpacked)" as "xx5". Unfinished and broken.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 02 Mar 2022 00:31:27 +0200
parents b4d536379687
children bb44c48cffac
files tools/lib64fmts.c
diffstat 1 files changed, 63 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64fmts.c	Wed Mar 02 00:13:48 2022 +0200
+++ b/tools/lib64fmts.c	Wed Mar 02 00:31:27 2022 +0200
@@ -1410,6 +1410,38 @@
 }
 
 
+static const Uint8 fmtFormatXX5_MagicID_1[] =
+{
+    0x00, 0x10, 0xa9, 0x01, 0x8d, 0x86, 0x02, 0x20,
+    0x44, 0xe5, 0xa9, 0x16, 0x8d, 0x18, 0xd0, 0xa2,
+};
+
+static int fmtProbeFormatXX5(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
+{
+    if (buf->len >= fmt->size &&
+        DM_MEMCMP_SIZE(buf->data, fmtFormatXX5_MagicID_1) == 0
+        )
+        return DM_PROBE_SCORE_MAX;
+
+    return DM_PROBE_SCORE_FALSE;
+}
+
+
+static int fmtGetPixelXX5(DMC64ScanLine *scan,
+    const DMC64Image *img, const int rasterX, const int rasterY)
+{
+    DM_C64_GENERIC_SC_PIXEL_DEFS(img)
+
+    (void) vshift;
+
+    return dmC64GetGenericMCPixel(scan->col, img,
+        bmoffs, scroffs,
+        6 - (rasterX & 6),
+        (rasterY & 7),
+        rasterX & 1, 0, img->bgcolor);
+}
+
+
 #define XX2_MIN_SIZE   4000
 #define XX2_WIDTH_CH   40
 #define XX2_HEIGHT_CH  10
@@ -3318,6 +3350,37 @@
         { }, &dmC64CommonFormats[0]
     },
 
+    {
+        "xx5", "Unknown $1000 format (unpacked)", 0x1000, 45000, 0, DM_FMT_RD | DM_FMT_BROKEN,
+        fmtProbeFormatXX5,
+        NULL, NULL,
+        {
+            D64_FMT_HIRES | D64_FMT_FLI | D64_FMT_ILACE,
+            D64_SCR_WIDTH , D64_SCR_HEIGHT,
+            D64_SCR_CH_WIDTH, D64_SCR_CH_HEIGHT,
+            1, 1,
+            NULL, NULL,
+            fmtGetPixelXX5,
+            {
+                DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0x4000 - 0x1000, 0, 0x400, 0, DF_NORMAL),
+                DEF_REPEAT_BLOCK_8(DO_COPY, DS_SCREEN_RAM , 0x8000 - 0x1000, 8, 0x400, 0, DF_NORMAL),
+
+                { DO_COPY       , DS_BITMAP_RAM  , 0x6000 - 0x1000, 0,  0,   0, NULL, NULL, DF_NORMAL },
+                { DO_COPY       , DS_BITMAP_RAM  , 0xa400 - 0x1000, 1,  0,   0, NULL, NULL, DF_NORMAL },
+
+                { DO_COPY       , DS_COLOR_RAM   , 0x8000 - 0x1000, 0,  0,   0, NULL, NULL, DF_NORMAL },
+
+                // BG/FG always 0
+                { DO_SET_MEM_LO , DS_BGCOL       , 0              , 0,  0,   0, NULL, NULL, DF_NORMAL },
+                { DO_SET_MEM_LO , DS_D020        , 0              , 0,  0,   0, NULL, NULL, DF_NORMAL },
+
+                { DO_SET_OP     , DS_EXTRA_INFO  , D64_ILACE_RES  , 0,  0,   D64_EI_ILACE_TYPE, NULL, NULL, DF_DECODE },
+                { DO_SET_OP     , DS_EXTRA_INFO  , D64_FLI_8      , 0,  0,   D64_EI_FLI_TYPE, NULL, NULL, DF_DECODE },
+                { DO_LAST       , 0              , 0              , 0,  0,   0, NULL, NULL, DF_NORMAL },
+            }
+        },
+        NULL
+    },
 
 };