Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!sri-unix!sri-spam!ames!ucbcad!ucbvax!IASSNS.BITNET!LYMAN From: LYMAN@IASSNS.BITNET Newsgroups: comp.sys.apple Subject: Apple ][+ screen format pgm (C source) Message-ID: <8705121201.aa02772@SPARK.BRL.ARPA> Date: Mon, 11-May-87 22:58:00 EDT Article-I.D.: SPARK.8705121201.aa02772 Posted: Mon May 11 22:58:00 1987 Date-Received: Sat, 16-May-87 02:39:19 EDT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 112 If anyone is interested, here is the source (in C) for programs which convert an Apple ][+ hi-res screen image (obtained via BSAVE SCREEN,A$4000,L$2000) to SUN Microsystems raster format and back. I do not assume that most of you out there have SUN's, but the code should be easy to generalize, and contains an algorithm for going from Apple layout to a more usual memory map. The programs work strictly in Black & White (that's the only kind of monitor I own) but are not hard to generalize. The application? I wanted to be able to make pictures for my Apple on a much more powerful machine. /* apl2sun.c - filter for going from Apple II images to SUN raster format */ /* usage apl2sun < {apple file} > {SUN raster file (B&W)} */ /* cc -O apl2sun.c -o apl2sun -lpixrect */ #include #include #define WIDTH 280 #define HEIGHT 192 #define DEPTH 1 #define BLACK 1 #define NBITS 8192 #define TRUE 1 main() { struct pixrect *cur_pixr; short int array[NBITS]; register x=0,y=0,bit,i=0; int row, col, index, pass; while (EOF != (array[i++]=getchar())); /* setup and clear pixrect */ cur_pixr = mem_create(WIDTH,HEIGHT,DEPTH); /* graph points */ for (pass=0;pass<8;pass++) /* 8 banks of 1024 bytes */ { for (row=0;row<24;row++) /* 24 rows (0,24...,1,25...) */ { for (col=0;col<40;col++) /* 40 * 7 pixels accross page */ { index = 1024*pass + 128*(row%8) + 40 * (row/8) + col; y = row * 8 + pass; for (bit=0;bit<7;bit++) /* 7 bits for each word */ { x = col * 7 + bit; if ((1 << bit) & array[index]) pr_put(cur_pixr,x,y,BLACK); } } } } pr_dump(cur_pixr,stdout,NULL,RT_STANDARD,TRUE); /* dump image */ } /* sun2apl.c - filter for going from Apple II images to SUN raster format */ /* usage sun2apl < {apple file} > {SUN raster file (B&W)} */ /* cc -O sun2apl.c -o sun2apl -lpixrect */ #include #include #define WIDTH 280 #define HEIGHT 192 #define DEPTH 1 #define BLACK 1 #define NBITS 8192 #define TRUE 1 #define MASK 128 main() { struct pixrect *cur_pixr,*pr_load(); short int array[NBITS]; register x=0,y=0,bit,i=0; int row, col, index, pass; /* open raster file */ cur_pixr = pr_load(stdin,NULL); if (cur_pixr == NULL) { printf("Unable to open raster file.\n"); exit(1); } /* graph points */ for (pass=0;pass<8;pass++) /* 8 banks of 1024 bytes */ { for (row=0;row<24;row++) /* 24 rows (0,24...,1,25...) */ { for (col=0;col<40;col++) /* 40 * 7 pixels accross page */ { index = 1024*pass + 128*(row%8) + 40 * (row/8) + col; y = row * 8 + pass; for (bit=0;bit<7;bit++) /* 7 bits for each word */ { x = col * 7 + bit; if (pr_get(cur_pixr,x,y)) array[index] |= MASK + (1 << bit); } } } } for (i=0;i