appleiibot: add bitmap example

This commit is contained in:
Vince Weaver 2020-10-20 02:01:54 -04:00
parent 3946598f20
commit 8fb76846a0
4 changed files with 81 additions and 4 deletions

View File

@ -9,7 +9,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS \
CIRCLES.BAS AUTUMN.BAS QKUMBA.BAS ASTEROID.BAS PERSON.BAS SHIP.BAS \
CONCERT.BAS NYAN.BAS RASTER.BAS RASTER2.BAS RASTER3.BAS LOTS.BAS LOAD \
RASTER4.BAS RASTER5.BAS PUMPKIN.BAS PUMPKIN_SMALL.BAS LADY.BAS \
A2.BAS
A2.BAS FOURAM.BAS
cp empty.dsk appleiibot.dsk
$(DOS33) -y appleiibot.dsk BSAVE -a 0x0300 LOAD
$(DOS33) -y appleiibot.dsk SAVE A E2.BAS
@ -33,6 +33,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS \
$(DOS33) -y appleiibot.dsk SAVE A PUMPKIN_SMALL.BAS
$(DOS33) -y appleiibot.dsk SAVE A LADY.BAS
$(DOS33) -y appleiibot.dsk SAVE A A2.BAS
$(DOS33) -y appleiibot.dsk SAVE A FOURAM.BAS
###
@ -191,5 +192,11 @@ A2.BAS: a2.bas
####
FOURAM.BAS: fouram.bas
$(TOKENIZE) < fouram.bas > FOURAM.BAS
####
clean:
rm -f *~ *.o *.lst convert_to convert_from convert_qkumba make_boxes convert_back LOAD *.BAS

5
appleiibot/fouram.bas Normal file
View File

@ -0,0 +1,5 @@
1REM_'> $^__XW?#__'\][C__!>W\Y_/&W:?\_SC=W/^?^1_]G_G_P=_Y_8><W?\/+, \/_S4&__S_T+C__\/]/P_/_3\_XYS_,X?@\\/K@/N$_CK"&OP_YO*B?^?^_*PA_'__;XX_#F9&$__1F9.X_?8F9&^_/8F9P_
2HOME:FORY=0TO158:Z=PEEK(2054+Y)-32:FORI=0TO5:NORMAL:Q=INT(Z/2):IFQ*2<>ZTHENINVERSE
3Z=Q:PRINT" ";:NEXT I,Y:GETA

View File

@ -2,7 +2,8 @@ include ../Makefile.inc
CFLAGS = -g -Wall -O2
all: text2gr png2gr png2gr_text png2rle png2lz4 png_to_40x48d png_to_40x96
all: text2gr png2gr png2gr_text png2rle png2lz4 png_to_40x48d png_to_40x96 \
png2sixbitmap
###
@ -38,6 +39,15 @@ png2gr_text.o: png2gr_text.c loadpng.h
###
png2sixbitmap: png2sixbitmap.o loadpng.o
$(CC) $(LFLAGS) -o png2sixbitmap png2sixbitmap.o loadpng.o -lpng
png2sixbitmap.o: png2sixbitmap.c loadpng.h
$(CC) $(CFLAGS) -c png2sixbitmap.c
###
png2rle: png2rle.o loadpng.o rle_common.o
$(CC) $(LFLAGS) -o png2rle png2rle.o loadpng.o rle_common.o -lpng
@ -75,8 +85,8 @@ png_to_40x96.o: png_to_40x96.c loadpng.h rle_common.h
###
install:
cp png2gr png2gr_text png2rle png2lz4 png_to_40x48d png_to_40x96 $(INSTALL_LOC)
cp png2gr png2gr_text png2rle png2lz4 png_to_40x48d png_to_40x96 png2sixbitmap $(INSTALL_LOC)
clean:
rm -f *~ *.o png2gr png2gr_text png2rle png2lz4 png_to_40x48d png_to_40x96
rm -f *~ *.o png2gr png2gr_text png2rle png2lz4 png_to_40x48d png_to_40x96 png2sixbitmap

55
gr-utils/png2sixbitmap.c Normal file
View File

@ -0,0 +1,55 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "loadpng.h"
/* Converts a PNG to a shifted 6 bitmap */
int main(int argc, char **argv) {
int row=0;
int col=0;
unsigned char ch;
unsigned char *image;
int xsize,ysize;
if (argc<2) {
fprintf(stderr,"Usage:\t%s INFILE\n\n",argv[0]);
exit(-1);
}
if (loadpng(argv[1],&image,&xsize,&ysize,PNG_WHOLETHING)<0) {
fprintf(stderr,"Error loading png!\n");
exit(-1);
}
fprintf(stderr,"Loaded image %d by %d\n",xsize,ysize);
ch=0;
for(row=0;row<24;row++) {
for(col=0;col<40;col++) {
if (image[row*xsize+col]) {
ch|=1<<5;
}
if ((row*xsize+col)%6==5) {
printf("%c",ch+32);
ch=0;
}
else {
ch>>=1;
}
}
}
printf("\n");
return 0;
}