#include #include #include #include #define COLUMNS 40 #define ROWS 48 static short addresses[]={ 0x400,0x480,0x500,0x580,0x600,0x680,0x700,0x780, 0x428,0x4a8,0x528,0x5a8,0x628,0x6a8,0x728,0x7a8, 0x450,0x4d0,0x550,0x5d0,0x650,0x6d0,0x750,0x7d0, }; static unsigned char image[1024]; static int color(int i,int j) { int x,y,c; y=addresses[j/2]-0x400; x=i; if (j%2==0) { c=image[y+x]&0xf; } else { c=((image[y+x])>>4)&0xf; } return c; } int main(int argc, char **argv) { int i,j,fd,addr=0,max; char *filename; if (argc<2) { filename=strdup("chiptune.gr"); } else { filename=strdup(argv[1]); } fd=open(filename,O_RDONLY); if (fd<0) { printf("Error operning %s\n",filename); return -1; } read(fd,&image,1024); close(fd); // printf("\\documentclass{article}\n"); // printf("\\usepackage{graphicx}\n"); // printf("\\usepackage{colortbl}\n"); // printf("\\begin{document}\n"); /* First plot, interleaved */ printf("\\tabcolsep=0.11cm\n"); printf("\\renewcommand{\\arraystretch}{0.5}\n"); printf("\\begin{tiny}\n"); printf("\\begin{table*}\n"); printf("\\caption{Apple II lores display, 40x48. " "Note the interleaving of the row addresses. " "Rows 40-47 are ASCII text being interpreted as graphic blocks.\\label{table:loresmap}}\n"); printf("\\centering\n"); printf("\\begin{tabular}{|l|l|"); for(i=0;i>4)&0xf); } if (i