# HG changeset patch # User Matti Hamalainen # Date 1506271883 -10800 # Node ID b6782b785457c4952d768de23bf784726fc90aad # Parent 959b34402b81770c10ff19f2fff0de07b77c6ed4 Move things around a bit. diff -r 959b34402b81 -r b6782b785457 tools/lib64gfx.c --- a/tools/lib64gfx.c Sun Sep 24 19:49:25 2017 +0300 +++ b/tools/lib64gfx.c Sun Sep 24 19:51:23 2017 +0300 @@ -12,6 +12,39 @@ #define BUF_SIZE_GROW (4*1024) +// Based on Pepto's palette, stolen from VICE +DMColor dmC64Palette[C64_NCOLORS] = +{ + { 0x00, 0x00, 0x00, 0xff }, + { 0xFF, 0xFF, 0xFF, 0xff }, + { 0x68, 0x37, 0x2B, 0xff }, + { 0x70, 0xA4, 0xB2, 0xff }, + { 0x6F, 0x3D, 0x86, 0xff }, + { 0x58, 0x8D, 0x43, 0xff }, + { 0x35, 0x28, 0x79, 0xff }, + { 0xB8, 0xC7, 0x6F, 0xff }, + { 0x6F, 0x4F, 0x25, 0xff }, + { 0x43, 0x39, 0x00, 0xff }, + { 0x9A, 0x67, 0x59, 0xff }, + { 0x44, 0x44, 0x44, 0xff }, + { 0x6C, 0x6C, 0x6C, 0xff }, + { 0x9A, 0xD2, 0x84, 0xff }, + { 0x6C, 0x5E, 0xB5, 0xff }, + { 0x95, 0x95, 0x95, 0xff }, +}; + + +#define DM_GET_ADDR_LO(addr) ((addr) & 0xff) +#define DM_GET_ADDR_HI(addr) (((addr) >> 8) & 0xff) + + +static BOOL dmCompareAddr16(const Uint8 *buf, const size_t offs, const Uint16 addr) +{ + return buf[offs ] == DM_GET_ADDR_LO(addr) && + buf[offs + 1] == DM_GET_ADDR_HI(addr); +} + + int dmC64ImageGetNumBanks(const DMC64ImageFormat *fmt) { int nbanks = 0; @@ -113,39 +146,6 @@ } -// Based on Pepto's palette, stolen from VICE -DMColor dmC64Palette[C64_NCOLORS] = -{ - { 0x00, 0x00, 0x00, 0xff }, - { 0xFF, 0xFF, 0xFF, 0xff }, - { 0x68, 0x37, 0x2B, 0xff }, - { 0x70, 0xA4, 0xB2, 0xff }, - { 0x6F, 0x3D, 0x86, 0xff }, - { 0x58, 0x8D, 0x43, 0xff }, - { 0x35, 0x28, 0x79, 0xff }, - { 0xB8, 0xC7, 0x6F, 0xff }, - { 0x6F, 0x4F, 0x25, 0xff }, - { 0x43, 0x39, 0x00, 0xff }, - { 0x9A, 0x67, 0x59, 0xff }, - { 0x44, 0x44, 0x44, 0xff }, - { 0x6C, 0x6C, 0x6C, 0xff }, - { 0x9A, 0xD2, 0x84, 0xff }, - { 0x6C, 0x5E, 0xB5, 0xff }, - { 0x95, 0x95, 0x95, 0xff }, -}; - - -#define DM_GET_ADDR_LO(addr) ((addr) & 0xff) -#define DM_GET_ADDR_HI(addr) (((addr) >> 8) & 0xff) - - -static BOOL dmCompareAddr16(const Uint8 *buf, const size_t offs, const Uint16 addr) -{ - return buf[offs ] == DM_GET_ADDR_LO(addr) && - buf[offs + 1] == DM_GET_ADDR_HI(addr); -} - - int dmC64ConvertCSDataToImage(DMImage *img, int xoffs, int yoffs, const Uint8 *buf, int width, int height, BOOL multicolor,