mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-25 20:30:31 +00:00
docs: update to load graphics image
This commit is contained in:
parent
86bc4aafdb
commit
298c76c2b7
BIN
mode7_demo/docs/chiptune.gr
Normal file
BIN
mode7_demo/docs/chiptune.gr
Normal file
Binary file not shown.
@ -6,6 +6,23 @@
|
||||
|
||||
\newcommand*\rot{\rotatebox{90}}
|
||||
|
||||
\definecolor{color0}{rgb}{0.000,0.000,0.000} % Black
|
||||
\definecolor{color1}{rgb}{0.890,0.118,0.376} % Magenta
|
||||
\definecolor{color2}{rgb}{0.376,0.306,0.741} % Dark Blue
|
||||
\definecolor{color3}{rgb}{1.000,0.267,0.992} % Purple
|
||||
\definecolor{color4}{rgb}{0.000,0.638,0.376} % Dark Green
|
||||
\definecolor{color5}{rgb}{0.612,0.612,0.612} % Grey 1
|
||||
\definecolor{color6}{rgb}{0.078,0.812,0.992} % Medium Blue
|
||||
\definecolor{color7}{rgb}{0.816,0.765,1.000} % Light Blue
|
||||
\definecolor{color8}{rgb}{0.376,0.447,0.012} % Brown
|
||||
\definecolor{color9}{rgb}{1.000,0.416,0.235} % Orange
|
||||
\definecolor{color10}{rgb}{0.616,0.616,0.616} % Grey 2
|
||||
\definecolor{color11}{rgb}{1.000,0.627,0.816} % Pink
|
||||
\definecolor{color12}{rgb}{0.078,0.961,0.235} % Bright Green
|
||||
\definecolor{color13}{rgb}{0.816,0.867,0.553} % Yellow
|
||||
\definecolor{color14}{rgb}{0.447,1.000,0.816} % Aqua
|
||||
\definecolor{color15}{rgb}{1.000,1.000,1.000} % White
|
||||
|
||||
\begin{document}
|
||||
|
||||
Sort of similar to how the Raspberry Pi started out as a GPU with a small
|
||||
|
@ -1,4 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define COLUMNS 40
|
||||
#define ROWS 48
|
||||
@ -9,24 +12,61 @@ static short addresses[]={
|
||||
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;
|
||||
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{tiny}\n");
|
||||
printf("\\begin{table*}\n");
|
||||
|
||||
printf("\\caption{Apple II lores memory, showing the interleaving"
|
||||
" of the 40x48 display.\\label{table:loresmap}}\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<COLUMNS;i++) printf("c|");
|
||||
@ -51,7 +91,6 @@ int main(int argc, char **argv) {
|
||||
|
||||
|
||||
|
||||
|
||||
for(j=0;j<ROWS;j++) {
|
||||
if (j%2==0) {
|
||||
printf("\\hline\n");
|
||||
@ -66,7 +105,8 @@ int main(int argc, char **argv) {
|
||||
printf("%d &",j);
|
||||
|
||||
for(i=0;i<COLUMNS;i++) {
|
||||
printf("\\cellcolor{red}");
|
||||
printf("\\cellcolor{color%d}",
|
||||
color(i,j));
|
||||
if (i<COLUMNS-1) printf("&");
|
||||
else printf("\\\\\n");
|
||||
}
|
||||
@ -75,6 +115,77 @@ int main(int argc, char **argv) {
|
||||
printf("\\end{tabular}\n");
|
||||
printf("\\end{table*}\n");
|
||||
printf("\\end{tiny}\n");
|
||||
|
||||
|
||||
/* Second plot, this one showing non-interleaved */
|
||||
|
||||
printf("\\begin{tiny}\n");
|
||||
printf("\\begin{table*}\n");
|
||||
|
||||
printf("\\caption{Apple II lores raw memory if viewed linearly. "
|
||||
"Note the screen ``holes'' which pad every third line to a 128 "
|
||||
"byte boundary. This unused memory can be used by I/O cards. "
|
||||
"\\label{table:linear}}\n");
|
||||
printf("\\centering\n");
|
||||
printf("\\begin{tabular}{|l|l|");
|
||||
for(i=0;i<COLUMNS+8;i++) printf("c|");
|
||||
printf("}\n");
|
||||
|
||||
// printf("\\hline\n");
|
||||
|
||||
addr=0x400;
|
||||
|
||||
for(j=0;j<ROWS;j++) {
|
||||
if (j%2==0) {
|
||||
printf("\\hline\n");
|
||||
printf("\\multirow{2}{*}{\\tt \\$%3X} &",
|
||||
addr);
|
||||
}
|
||||
else {
|
||||
printf("\\cline{2-42}\n");
|
||||
printf("&");
|
||||
}
|
||||
|
||||
printf("%d &",j);
|
||||
|
||||
if ((j/2)%3==2) {
|
||||
max=COLUMNS+8;
|
||||
}
|
||||
else {
|
||||
max=COLUMNS;
|
||||
}
|
||||
|
||||
for(i=0;i<max;i++) {
|
||||
if (j%2==0) {
|
||||
printf("\\cellcolor{color%d}",
|
||||
image[(addr-0x400)+i]&0xf);
|
||||
}
|
||||
else {
|
||||
printf("\\cellcolor{color%d}",
|
||||
(image[(addr-0x400)+i]>>4)&0xf);
|
||||
|
||||
}
|
||||
if (i<max-1) printf("&");
|
||||
else printf("\\\\\n");
|
||||
}
|
||||
|
||||
if ((j%6)==1) {
|
||||
addr+=40;
|
||||
}
|
||||
else if ((j%6)==3) {
|
||||
addr+=40;
|
||||
}
|
||||
else if ((j%6)==5) {
|
||||
addr+=40+8;
|
||||
}
|
||||
|
||||
}
|
||||
printf("\\hline\n");
|
||||
printf("\\end{tabular}\n");
|
||||
printf("\\end{table*}\n");
|
||||
printf("\\end{tiny}\n");
|
||||
|
||||
|
||||
// printf("\\end{document}\n");
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user