changeset 944:c62bb4028cf0

Implement multicolor / standard switching support based on color ram value's fourth bit for multicolor char mode decoding.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 26 Feb 2015 01:45:52 +0200
parents 8eacbc38b043
children 47f111643745
files tools/lib64gfx.c
diffstat 1 files changed, 18 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64gfx.c	Wed Feb 25 23:35:04 2015 +0200
+++ b/tools/lib64gfx.c	Thu Feb 26 01:45:52 2015 +0200
@@ -1086,18 +1086,27 @@
                 const int x = xc / 4;
                 const int scroffs = scroffsy + x;
                 const int chr = src->screen[0][scroffs];
-                const int v = 6 - ((xc * 2) & 6);
-                Uint8 c;
+                const int col = src->color[0][scroffs] & 15;
 
-                switch ((src->charmem[0][chr * C64_CHR_SIZE + yb] >> v) & 3)
+                if (col & 8)
                 {
-                    case 0: c = src->bgcolor; break;
-                    case 1: c = src->d022; break;
-                    case 2: c = src->d023; break;
-                    case 3: c = src->color[0][scroffs];
+                    const int v = 6 - ((xc * 2) & 6);
+                    switch ((src->charmem[0][chr * C64_CHR_SIZE + yb] >> v) & 3)
+                    {
+                        case 0: *d++ = src->bgcolor; break;
+                        case 1: *d++ = src->d022; break;
+                        case 2: *d++ = src->d023; break;
+                        case 3: *d++ = col;
+                    }
                 }
-
-                *d++ = c;
+                else
+                {
+                    const int v = 7 - (xc & 7);
+                    if ((src->charmem[0][chr * C64_CHR_SIZE + yb] >> v) & 1)
+                        *d++ = src->color[0][scroffs];
+                    else
+                        *d++ = src->bgcolor;
+                }
             }
         }
         else