1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-12 17:30:50 +00:00

Add support for 4 pixels per plane

This commit is contained in:
karri 2022-12-29 19:40:00 +02:00
parent e953c1aa08
commit 05766d4bfe

View File

@ -230,109 +230,109 @@ static void ReadPlane (FILE* F, PCXHeader* P, unsigned char* L)
/* Write the data to the buffer */ /* Write the data to the buffer */
switch (P->BPP) { switch (P->BPP) {
default: default:
for (i = 0; i < C; i++) { for (i = 0; i < C; i++) {
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = B; *L = B;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
Remaining -= 1; Remaining -= 1;
} }
break; break;
case 4: case 4:
for (i = 0; i < C; i++) { for (i = 0; i < C; i++) {
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = B >> 4; *L = B >> 4;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = B & 15; *L = B & 15;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
Remaining -= 1; Remaining -= 1;
} }
break; break;
case 2: case 2:
for (i = 0; i < C; i++) { for (i = 0; i < C; i++) {
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = (B >> 6) & 3; *L = (B >> 6) & 3;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = (B >> 4) & 3; *L = (B >> 4) & 3;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = (B >> 2) & 3; *L = (B >> 2) & 3;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = B & 3; *L = B & 3;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
Remaining -= 1; Remaining -= 1;
} }
break; break;
case 1: case 1:
for (i = 0; i < C; i++) { for (i = 0; i < C; i++) {
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = (B >> 7) & 1; *L = (B >> 7) & 1;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = (B >> 6) & 1; *L = (B >> 6) & 1;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = (B >> 5) & 1; *L = (B >> 5) & 1;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = (B >> 4) & 1; *L = (B >> 4) & 1;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = (B >> 3) & 1; *L = (B >> 3) & 1;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = (B >> 2) & 1; *L = (B >> 2) & 1;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = (B >> 1) & 1; *L = (B >> 1) & 1;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
if (WidthCounter > 0) { if (WidthCounter > 0) {
*L = B & 1; *L = B & 1;
L += 1; L += 1;
WidthCounter -= 1; WidthCounter -= 1;
} }
Remaining -= 1; Remaining -= 1;
}
break;
} }
break;
}
} }
} else { } else {
/* Just read one line */ /* Just read one line */
if (P->BPP == 4) { if (P->BPP == 4) {
printf("Not implemented\n"); printf("Not implemented\n");
} else { } else {
ReadData (F, L, P->Width); ReadData (F, L, P->Width);
} }
} }
} }