mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-07-13 22:29:14 +00:00
png2gr: fix to work again
hopefully I didn't break anything that depended on the old behavior
This commit is contained in:
parent
b9e04f6605
commit
cdcd274923
@ -1,3 +1,8 @@
|
||||
/* Loads a 80x48 PNG image into a 40x48 Apple II layout */
|
||||
/* It's not interleaved like an actual Apple II */
|
||||
/* But the top/bottom are pre-packed into a naive 40x24 array */
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -19,6 +19,7 @@ int main(int argc, char **argv) {
|
||||
int col=0;
|
||||
int enough=0;
|
||||
int x;
|
||||
unsigned char out_buffer[1024];
|
||||
|
||||
unsigned char *image;
|
||||
int xsize,ysize;
|
||||
@ -42,35 +43,20 @@ int main(int argc, char **argv) {
|
||||
|
||||
printf("Loaded image %d by %d\n",xsize,ysize);
|
||||
|
||||
x=0;
|
||||
while(1) {
|
||||
fputc( image[col+(row*xsize)] |
|
||||
(image[col+(row+1)*xsize]<<4),outfile);
|
||||
x++;
|
||||
if (x>0x3f8) break;
|
||||
enough++;
|
||||
if (enough>119) {
|
||||
/* screen hole */
|
||||
/* We should never BLOAD this image */
|
||||
/* as we can corrupt important state here */
|
||||
fputc(0,outfile);
|
||||
fputc(0,outfile);
|
||||
fputc(0,outfile);
|
||||
fputc(0,outfile);
|
||||
fputc(0,outfile);
|
||||
fputc(0,outfile);
|
||||
fputc(0,outfile);
|
||||
fputc(0,outfile);
|
||||
enough=0;
|
||||
short gr_offsets[]={
|
||||
0x400,0x480,0x500,0x580,0x600,0x680,0x700,0x780,
|
||||
0x428,0x4a8,0x528,0x5a8,0x628,0x6a8,0x728,0x7a8,
|
||||
0x450,0x4d0,0x550,0x5d0,0x650,0x6d0,0x750,0x7d0,
|
||||
};
|
||||
|
||||
memset(out_buffer,0,1024);
|
||||
for(row=0;row<24;row++) {
|
||||
for(col=0;col<40;col++) {
|
||||
out_buffer[(gr_offsets[row]-0x400)+col]=image[row*xsize+col];
|
||||
}
|
||||
}
|
||||
|
||||
col++;
|
||||
if (col>39) {
|
||||
col=0;
|
||||
row+=16;
|
||||
if (row>47) row-=46;
|
||||
}
|
||||
}
|
||||
for(x=0;x<1024;x++) fputc( out_buffer[x],outfile);
|
||||
|
||||
fclose(outfile);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user