changeset 2130:3b5be00759ed

Add initial (and incomplete) support for Marq's PETSCII editor PRG export format.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 27 May 2019 12:22:08 +0300
parents 2129d4ac6f45
children 781b1d63109a
files tools/lib64fmts.c
diffstat 1 files changed, 48 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64fmts.c	Mon May 27 11:29:37 2019 +0300
+++ b/tools/lib64fmts.c	Mon May 27 12:22:08 2019 +0300
@@ -61,6 +61,31 @@
 }
 
 
+static const Uint8 fmtMarqPETSCII_ID[] =
+{
+    0x0b, 0x08, 0xef, 0x00, 0x9e, 0x32, 0x30, 0x36, 0x31, 0x00, 0x00, 0x00,
+    0xa9, 0x0b, 0x8d, 0x11, 0xd0, 0xa9, 0x17, 0x8d, 0x18, 0xd0, 0xa9, 0x0f,
+    0x8d, 0x20, 0xd0, 0xa9, 0x0e, 0x8d, 0x21, 0xd0, 0xa2, 0x00, 0xa0, 0xfa,
+    0xbd, 0x61, 0x08, 0x9d, 0x00, 0x04, 0xbd, 0x5b, 0x09, 0x9d, 0xfa, 0x04,
+    0xbd, 0x55, 0x0a, 0x9d, 0xf4, 0x05, 0xbd, 0x4f, 0x0b, 0x9d, 0xee, 0x06,
+    0xbd, 0x49, 0x0c, 0x9d, 0x00, 0xd8, 0xbd, 0x43, 0x0d, 0x9d, 0xfa, 0xd8,
+    0xbd, 0x3d, 0x0e, 0x9d, 0xf4, 0xd9, 0xbd, 0x37, 0x0f, 0x9d, 0xee, 0xda,
+    0xe8, 0x88, 0xd0, 0xcc, 0xa9, 0x1b, 0x8d, 0x11, 0xd0, 0x4c, 0x5e, 0x08,
+};
+
+static int fmtProbeMarqPETSCII(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
+{
+    (void) fmt;
+
+    if (buf->len == 2098 &&
+        DM_MEMCMP_SIZE(buf->data + 2, fmtMarqPETSCII_ID) == 0
+        )
+        return DM_PROBE_SCORE_MAX;
+
+    return DM_PROBE_SCORE_FALSE;
+}
+
+
 static int fmtProbeKoalaPainter(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
 {
     int score = DM_PROBE_SCORE_FALSE;
@@ -2007,6 +2032,29 @@
         NULL, NULL,
         { }, &dmC64CommonFormats[8]
     },
+    {
+        "pet", "Marq's PETSCII (unpacked)", 0x0801, 0, DM_FMT_RD,
+        fmtProbeMarqPETSCII,
+        NULL, NULL,
+        {
+            D64_FMT_HIRES | D64_FMT_CHAR,
+            D64_SCR_WIDTH   , D64_SCR_HEIGHT,
+            D64_SCR_CH_WIDTH, D64_SCR_CH_HEIGHT,
+            1, 1,
+            NULL, NULL,
+            NULL,
+            {
+                { DO_COPY       , DS_SCREEN_RAM  , 0x60, 0, 0,   0, NULL, NULL },
+                { DO_COPY       , DS_COLOR_RAM   , 0x60 + 1000, 0, 0,   0, NULL, NULL },
+
+                { DO_SET_MEM_LO , DS_D020        , 0x17, 0,  0,   0, NULL, NULL },
+                { DO_SET_MEM_LO , DS_BGCOL       , 0x1c, 0,  0,   0, NULL, NULL },
+
+                { DO_LAST       , 0              , 0             , 0, 0,   0, NULL, NULL },
+            }
+        },
+        NULL
+    },
 };
 
 const int ndmC64ImageFormats = sizeof(dmC64ImageFormats) / sizeof(dmC64ImageFormats[0]);