comparison tools/lib64fmts.c @ 2172:de88333acc44

Move the PETSCII getpixel function to lib64gfx.c and remove the fmtGetGenericChar*() helper functions that were not being used really.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 11 Jun 2019 21:06:35 +0300
parents 7c4c9013e412
children a5c4eb5c7309
comparison
equal deleted inserted replaced
2171:a39bf85308e5 2172:de88333acc44
106 106
107 img->extraInfo[D64_EI_CHAR_MODE] = D64_FMT_HIRES; 107 img->extraInfo[D64_EI_CHAR_MODE] = D64_FMT_HIRES;
108 img->extraInfo[D64_EI_CHAR_CUSTOM] = 0; 108 img->extraInfo[D64_EI_CHAR_CUSTOM] = 0;
109 109
110 return DMERR_OK; 110 return DMERR_OK;
111 }
112
113
114 static int fmtGetPixelPETSCII(Uint8 *col,
115 const DMC64Image *img, const int rasterX, const int rasterY)
116 {
117 DM_C64_GENERIC_CHAR_PIXEL(img)
118 int chr = img->screen[0].data[scroffs];
119
120 if (!img->extraInfo[D64_EI_CHAR_CUSTOM] &&
121 img->extraInfo[D64_EI_CHAR_CASE])
122 chr += 256; // lower case, so add 256 to char ROM offset
123
124 switch (img->extraInfo[D64_EI_CHAR_MODE])
125 {
126 case D64_FMT_HIRES:
127 return dmC64GetGenericCharSCPixel(
128 col, img,
129 scroffs, rasterX,
130 0, (chr * D64_CHR_SIZE) + (rasterY & 7), chr,
131 0, img->bgcolor);
132
133 case D64_FMT_MC:
134 return dmC64GetGenericCharMCPixel(
135 col, img,
136 scroffs, rasterX,
137 0, (chr * D64_CHR_SIZE) + (rasterY & 7), chr,
138 0, img->bgcolor, img->d022, img->d023);
139
140 case D64_FMT_ECM:
141 return dmC64GetGenericCharECMPixel(
142 col, img,
143 scroffs, rasterX,
144 0, ((chr & 0x3f) * D64_CHR_SIZE) + (rasterY & 7), chr,
145 0, img->bgcolor, img->d022, img->d023, img->d024);
146
147 default:
148 return DMERR_INVALID_DATA;
149 }
150 } 111 }
151 112
152 113
153 static const Uint8 fmtPetsciiKrisszHu_ID1[] = 114 static const Uint8 fmtPetsciiKrisszHu_ID1[] =
154 { 115 {
2416 D64_FMT_HIRES | D64_FMT_CHAR, 2377 D64_FMT_HIRES | D64_FMT_CHAR,
2417 D64_SCR_WIDTH , D64_SCR_HEIGHT, 2378 D64_SCR_WIDTH , D64_SCR_HEIGHT,
2418 D64_SCR_CH_WIDTH, D64_SCR_CH_HEIGHT, 2379 D64_SCR_CH_WIDTH, D64_SCR_CH_HEIGHT,
2419 1, 1, 2380 1, 1,
2420 NULL, NULL, 2381 NULL, NULL,
2421 fmtGetPixelPETSCII, 2382 NULL,
2422 { 2383 {
2423 { DO_COPY , DS_SCREEN_RAM , 0x60, 0, 0, 0, NULL, NULL }, 2384 { DO_COPY , DS_SCREEN_RAM , 0x60, 0, 0, 0, NULL, NULL },
2424 { DO_COPY , DS_COLOR_RAM , 0x60 + 1000, 0, 0, 0, NULL, NULL }, 2385 { DO_COPY , DS_COLOR_RAM , 0x60 + 1000, 0, 0, 0, NULL, NULL },
2425 2386
2426 // For offset values see petscii/m_c64.pde :: save_prg() 2387 // For offset values see petscii/m_c64.pde :: save_prg()
2443 D64_FMT_CHAR, 2404 D64_FMT_CHAR,
2444 D64_SCR_WIDTH , D64_SCR_HEIGHT, 2405 D64_SCR_WIDTH , D64_SCR_HEIGHT,
2445 D64_SCR_CH_WIDTH, D64_SCR_CH_HEIGHT, 2406 D64_SCR_CH_WIDTH, D64_SCR_CH_HEIGHT,
2446 1, 1, 2407 1, 1,
2447 NULL, NULL, 2408 NULL, NULL,
2448 fmtGetPixelPETSCII, 2409 NULL,
2449 { 2410 {
2450 { DO_COPY , DS_SCREEN_RAM , 0x2001 - 2, 0, 0, 0, NULL, NULL }, 2411 { DO_COPY , DS_SCREEN_RAM , 0x2001 - 2, 0, 0, 0, NULL, NULL },
2451 { DO_COPY , DS_COLOR_RAM , 0x23e9 - 2, 0, 0, 0, NULL, NULL }, 2412 { DO_COPY , DS_COLOR_RAM , 0x23e9 - 2, 0, 0, 0, NULL, NULL },
2452 2413
2453 { DO_COPY , DS_EXTRA_DATA , 0x0000 , 0, 0x0100, 0, NULL, NULL }, 2414 { DO_COPY , DS_EXTRA_DATA , 0x0000 , 0, 0x0100, 0, NULL, NULL },