|
|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 1358 (0x54e)
Types: TextFile
Notes: UNIX file
Names: »bigmacin.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
└─⟦926b8033d⟧ UNIX Filesystem
└─⟦this⟧ »u/demo/slide/bigmacin.c«
#include <stdio.h>
short STARTX, STARTY;
short x;
short y;
main(argc,argv)
char **argv;
{
unsigned char c;
short n;
short i;
/*clearw();*/
if(argc != 3) usage();
STARTX = atoi(*++argv);
STARTY = atoi(*++argv);
x = STARTX; y = STARTY;
while(1) {
c = gch();
if(c == 0x1b) {
switch(c = gch()) {
case 0x46:
x += gnumb(4);
break;
case 0x47:
n = gnumb(4);
for(i = 0; i < n; i++)
plotb(gch());
break;
case 0x54:
y += (gnumb(2) / 2);
break;
case 0x0a:
x = STARTX;
break;
case 0x0c: exit();
case 0x70:
case 0x3e:
case 0x63:
case 0x6e:
case 0x21:
case 0x22:
case 0x36:
case 0x66:
break;
default:
printf("unknown: %x\n",c);
}
}
else if(c==0x0a) x = STARTX;
}
}
gch()
{
int c;
if((c = getchar()) == EOF) exit();
return(c);
}
gnumb(n)
short n;
{
short i,j;
int c;
j = 0;
for(i = 0; i<n; i++) {
c = gch();
if((c < 0x30) || (c >0x39)) {
printf("error in gnumb\n");
exit();
}
j = (j*10) + (int)(c - 0x30);
}
return(j);
}
usage()
{
printf("Usage: macin startx, starty\n");
}
plotb(b)
unsigned char b;
{
register short s,i;
short ny = y;
for(i = 0; i<8 ;i++)
{
s = 1;
if(b & ((unsigned char)0x80 >> i))s =0;
sp((x*2),(y-i)*2,s);
sp((x*2 + 1), (y-i)*2,s);
sp((x*2),(y-i)*2+1,s);
sp((x*2 + 1), (y-i)*2+1,s);
}
x++;
}