|
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: 1093 (0x445) Types: TextFile Notes: UNIX file Names: »oldmacin.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code └─⟦926b8033d⟧ UNIX Filesystem └─⟦this⟧ »u/demo/slide/oldmacin.c«
#include <stdio.h> #define STARTX 100 #define STARTY 32 short x = STARTX; short y = STARTY; main() { unsigned char c; short n; short i; clearw(); 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); } plotb(b) unsigned char b; { short i; short ny = y; for(i = 0; i<8 ;i++) if(b & ((unsigned char)0x80 >> i)) point(x,y-i); x++; }