Mercurial > hg > dmlib
comparison tools/lib64fmts.c @ 2134:5daed72fd211
Improve Marq's PETSCII prg export support.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 28 May 2019 10:50:50 +0300 |
parents | 898c1edadbc6 |
children | cb4689d9ceed |
comparison
equal
deleted
inserted
replaced
2133:898c1edadbc6 | 2134:5daed72fd211 |
---|---|
59 | 59 |
60 return DMERR_OK; | 60 return DMERR_OK; |
61 } | 61 } |
62 | 62 |
63 | 63 |
64 static const Uint8 fmtMarqPETSCII_ID[] = | 64 static const Uint8 fmtMarqPETSCII_ID1[] = |
65 { | 65 { |
66 0x0b, 0x08, 0xef, 0x00, 0x9e, 0x32, 0x30, 0x36, 0x31, 0x00, 0x00, 0x00, | 66 0x01, 0x08, 0x0b, 0x08, 0xef, 0x00, 0x9e, 0x32, 0x30, 0x36, |
67 0xa9, 0x0b, 0x8d, 0x11, 0xd0, 0xa9, 0x17, 0x8d, 0x18, 0xd0, 0xa9, 0x0f, | 67 0x31, 0x00, 0x00, 0x00, 0xa9, 0x0b, 0x8d, 0x11, 0xd0, 0xa9, |
68 0x8d, 0x20, 0xd0, 0xa9, 0x0e, 0x8d, 0x21, 0xd0, 0xa2, 0x00, 0xa0, 0xfa, | |
69 0xbd, 0x61, 0x08, 0x9d, 0x00, 0x04, 0xbd, 0x5b, 0x09, 0x9d, 0xfa, 0x04, | |
70 0xbd, 0x55, 0x0a, 0x9d, 0xf4, 0x05, 0xbd, 0x4f, 0x0b, 0x9d, 0xee, 0x06, | |
71 0xbd, 0x49, 0x0c, 0x9d, 0x00, 0xd8, 0xbd, 0x43, 0x0d, 0x9d, 0xfa, 0xd8, | |
72 0xbd, 0x3d, 0x0e, 0x9d, 0xf4, 0xd9, 0xbd, 0x37, 0x0f, 0x9d, 0xee, 0xda, | |
73 0xe8, 0x88, 0xd0, 0xcc, 0xa9, 0x1b, 0x8d, 0x11, 0xd0, 0x4c, 0x5e, 0x08, | |
74 }; | 68 }; |
75 | 69 |
70 static const Uint8 fmtMarqPETSCII_ID2[] = | |
71 { | |
72 0x8d, 0x21, 0xd0, 0xa2, 0x00, 0xa0, 0xfa, 0xbd, 0x61, 0x08, | |
73 0x9d, 0x00, 0x04, 0xbd, 0x5b, 0x09, 0x9d, 0xfa, 0x04, 0xbd, | |
74 0x55, 0x0a, 0x9d, 0xf4, | |
75 }; | |
76 | |
77 | |
76 static int fmtProbeMarqPETSCII(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) | 78 static int fmtProbeMarqPETSCII(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) |
77 { | 79 { |
78 (void) fmt; | 80 (void) fmt; |
79 | 81 |
80 if (buf->len == 2098 && | 82 if (buf->len == 2098 && |
81 DM_MEMCMP_SIZE(buf->data + 2, fmtMarqPETSCII_ID) == 0 | 83 DM_MEMCMP_SIZE(buf->data, fmtMarqPETSCII_ID1) == 0 && |
84 DM_MEMCMP_SIZE(buf->data + 0x1f, fmtMarqPETSCII_ID2) == 0 | |
82 ) | 85 ) |
83 return DM_PROBE_SCORE_MAX; | 86 return DM_PROBE_SCORE_MAX; |
84 | 87 |
85 return DM_PROBE_SCORE_FALSE; | 88 return DM_PROBE_SCORE_FALSE; |
89 } | |
90 | |
91 | |
92 static int fmtGetPixelMarqPETSCII(Uint8 *col, | |
93 const DMC64Image *img, const int rasterX, const int rasterY) | |
94 { | |
95 DM_C64_GENERIC_CHAR_PIXEL(img) | |
96 int chr = img->screen[0].data[scroffs]; | |
97 | |
98 // d018 has been copied to extraData[0].data[0] | |
99 switch (img->extraData[0].data[0]) | |
100 { | |
101 case 23: chr += 256; break; // lower case, so add 256 to char ROM offset | |
102 case 20: break; // upper case | |
103 default: | |
104 return DMERR_INVALID_DATA; | |
105 } | |
106 | |
107 return dmC64GetGenericCharSCPixel( | |
108 col, img, | |
109 scroffs, rasterX, | |
110 0, (chr * D64_CHR_SIZE) + (rasterY & 7), chr, | |
111 0, img->bgcolor); | |
86 } | 112 } |
87 | 113 |
88 | 114 |
89 static int fmtProbeKoalaPainter(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) | 115 static int fmtProbeKoalaPainter(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) |
90 { | 116 { |
2052 D64_FMT_HIRES | D64_FMT_CHAR, | 2078 D64_FMT_HIRES | D64_FMT_CHAR, |
2053 D64_SCR_WIDTH , D64_SCR_HEIGHT, | 2079 D64_SCR_WIDTH , D64_SCR_HEIGHT, |
2054 D64_SCR_CH_WIDTH, D64_SCR_CH_HEIGHT, | 2080 D64_SCR_CH_WIDTH, D64_SCR_CH_HEIGHT, |
2055 1, 1, | 2081 1, 1, |
2056 NULL, NULL, | 2082 NULL, NULL, |
2057 NULL, | 2083 fmtGetPixelMarqPETSCII, |
2058 { | 2084 { |
2059 { DO_COPY , DS_SCREEN_RAM , 0x60, 0, 0, 0, NULL, NULL }, | 2085 { DO_COPY , DS_SCREEN_RAM , 0x60, 0, 0, 0, NULL, NULL }, |
2060 { DO_COPY , DS_COLOR_RAM , 0x60 + 1000, 0, 0, 0, NULL, NULL }, | 2086 { DO_COPY , DS_COLOR_RAM , 0x60 + 1000, 0, 0, 0, NULL, NULL }, |
2061 | 2087 |
2062 { DO_SET_MEM_LO , DS_D020 , 0x17, 0, 0, 0, NULL, NULL }, | 2088 // For offset values see petscii/m_c64.pde :: save_prg() |
2063 { DO_SET_MEM_LO , DS_BGCOL , 0x1c, 0, 0, 0, NULL, NULL }, | 2089 { DO_SET_MEM_LO , DS_D020 , 25 - 2, 0, 0, 0, NULL, NULL }, |
2064 | 2090 { DO_SET_MEM_LO , DS_BGCOL , 30 - 2, 0, 0, 0, NULL, NULL }, |
2065 { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL }, | 2091 { DO_COPY , DS_EXTRA_DATA , 20 - 2, 0, 1, 0, NULL, NULL }, // upper/lower |
2092 | |
2093 { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL }, | |
2066 } | 2094 } |
2067 }, | 2095 }, |
2068 NULL | 2096 NULL |
2069 }, | 2097 }, |
2070 }; | 2098 }; |