diff tools/lib64fmts.c @ 1876:a35f6e19f57a

Implement read-only support for HCB (Half Char Bitmap) format.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 24 Jun 2018 23:37:01 +0300
parents 752893fa6412
children f8b7baf3ff89
line wrap: on
line diff
--- a/tools/lib64fmts.c	Sun Jun 24 22:17:28 2018 +0300
+++ b/tools/lib64fmts.c	Sun Jun 24 23:37:01 2018 +0300
@@ -866,6 +866,18 @@
 }
 
 
+static Uint8 fmtGetPixelHCB(
+    const DMC64Image *img, const int bmoffs, const int scroffs,
+    const int shift, const int bitmap, const int rasterX, const int rasterY)
+{
+    const int vbank = (rasterY / 4) & 1;
+    (void) bitmap;
+    (void) rasterX;
+
+    return dmC64GetGenericMCPixel(img, bmoffs, scroffs, shift, vbank, 0, vbank, img->bgcolor);
+}
+
+
 static Uint8 fmtGetPixelCrestHIFLIorCDHM(
     const DMC64Image *img, const int bmoffs, const int scroffs,
     const int shift, const int bitmap, const int rasterX, const int rasterY)
@@ -1696,6 +1708,28 @@
     },
 
     {
+        "hcb", "Half Char Bitmap (unpacked)", 0x5000, 12148, DM_FMT_RD,
+        NULL,
+        NULL, NULL,
+        {
+            D64_FMT_MC | D64_FMT_FLI,
+            C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
+            C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
+            NULL, NULL,
+            fmtGetPixelHCB,
+            {
+                { DO_COPY       , DS_COLOR_RAM   , 0x0000, 0,  0,   0, NULL, NULL },
+                { DO_COPY       , DS_COLOR_RAM   , 0x0400, 1,  0,   0, NULL, NULL },
+                { DO_COPY       , DS_SCREEN_RAM  , 0x0800, 0,  0,   0, NULL, NULL },
+                { DO_COPY       , DS_SCREEN_RAM  , 0x0c00, 1,  0,   0, NULL, NULL },
+                { DO_COPY       , DS_BITMAP_RAM  , 0x1000, 0,  0,   0, NULL, NULL },
+                { DO_LAST       , 0              , 0     , 0,  0,   0, NULL, NULL },
+            }
+        },
+        NULL
+    },
+
+    {
         "pen", "Pentel Paint (unpacked)", 0x4800, 19845, DM_FMT_RD | DM_FMT_BROKEN,
         NULL,
         NULL, NULL,