hgr: boxes: messing around with tiny BASIC version

This commit is contained in:
Vince Weaver 2021-06-16 13:57:52 -04:00
parent 87dff8394f
commit 7b3fa6758a
5 changed files with 133 additions and 40 deletions

View File

@ -7,13 +7,12 @@ EMPTYDISK = ../../../empty_disk/empty.dsk
all: boxes.dsk make_boxes
boxes.dsk: HELLO A2_BOXES BOXES RR NYAN
boxes.dsk: HELLO MYST.BAS MYST_TINY.BAS
cp $(EMPTYDISK) boxes.dsk
$(DOS33) -y boxes.dsk SAVE A HELLO
$(DOS33) -y boxes.dsk BSAVE -a 0x300 BOXES
$(DOS33) -y boxes.dsk BSAVE -a 0xC00 A2_BOXES
$(DOS33) -y boxes.dsk BSAVE -a 0xC00 RR
$(DOS33) -y boxes.dsk BSAVE -a 0xC00 NYAN
$(DOS33) -y boxes.dsk SAVE A MYST.BAS
$(DOS33) -y boxes.dsk SAVE A MYST_TINY.BAS
# $(DOS33) -y boxes.dsk BSAVE -a 0x300 BOXES
###
@ -22,37 +21,13 @@ HELLO: hello.bas
###
A2_BOXES: a2_boxes.o
ld65 -o A2_BOXES a2_boxes.o -C $(LINKERSCRIPTS)/apple2_c00.inc
a2_boxes.o: a2_boxes.s
ca65 -o a2_boxes.o a2_boxes.s -l a2_boxes.lst
MYST.BAS: myst.bas
$(TOKENIZE) < myst.bas > MYST.BAS
###
RR: rr.o
ld65 -o RR rr.o -C $(LINKERSCRIPTS)/apple2_c00.inc
rr.o: rr.s
ca65 -o rr.o rr.s -l rr.lst
###
NYAN: nyan.o
ld65 -o NYAN nyan.o -C $(LINKERSCRIPTS)/apple2_c00.inc
nyan.o: nyan.s
ca65 -o nyan.o nyan.s -l nyan.lst
###
BOXES: boxes.o
ld65 -o BOXES boxes.o -C $(LINKERSCRIPTS)/apple2_300.inc
boxes.o: boxes.s
ca65 -o boxes.o boxes.s -l boxes.lst
MYST_TINY.BAS: myst_tiny.bas
$(TOKENIZE) < myst_tiny.bas > MYST_TINY.BAS
###
@ -66,4 +41,4 @@ make_boxes.o: make_boxes.c
###
clean:
rm -f *~ *.o *.lst HELLO A2_BOXES BOXES RR make_boxes
rm -f *~ *.o *.lst MYST.BAS MYST_TINY.BAS make_boxes

View File

@ -0,0 +1,95 @@
#include <stdio.h>
int main(int argc, char **argv) {
char buffer[1024];
char *ptr;
int color1,color2,x1,x2,y1,y2;
char output[1024];
int out_ptr=0;
int old_color=0xff;
int line=1;
int add=' ';
#if 0
while(1) {
ptr=fgets(buffer,1024,stdin);
if (ptr==NULL) break;
sscanf(buffer,"%d %d %d %d %d",
&color,&x1,&x2,&y1,&y2);
// printf("\t.byte $%02X,$%02X,$%02X,$%02X,$%02X\n",
// color,x1,x2,y1,y2);
if (color==old_color) {
printf("\t.byte $%02X,$%02X,$%02X,$%02X\n",
y1|0x80,y2,x1,x2);
}
else {
printf("\t.byte $%02X,$%02X,$%02X,$%02X,$%02X\n",
color,y1,y2,x1,x2);
}
old_color=color;
// output[out_ptr]=color+32;
// output[out_ptr+1]=x1+32;
// output[out_ptr+2]=x2+32;
// output[out_ptr+3]=y1+32;
// output[out_ptr+4]=y2+32;
// out_ptr+=5;
}
// output[out_ptr]=0;
// printf("%s\n",output);
printf("\t.byte $FF\n");
#endif
while(1) {
ptr=fgets(buffer,1024,stdin);
if (ptr==NULL) break;
if (buffer[0]==';') continue;
sscanf(buffer,"%d %d %d %d %d %d",
&color1,&color2,&x1,&y1,&x2,&y2);
x2=(x2-x1)/2;
x1=x1/2;
y2=(y2-y1)/2;
y1=y1/2;
if (x1>94) { printf("X1 too big %d line %d!\n",x1,line); }
if (x2>94) { printf("X2 too big %d!\n",x2); }
if (y1>94) { printf("Y1 too big %d!\n",y1); }
if (y2>94) { printf("Y2 too big %d line %d!\n",y2,line); }
printf("%c",color1+add);
printf("%c",color2+add);
printf("%c",x1+add);
printf("%c",y1+add);
printf("%c",x2+add);
printf("%c",y2+add);
line++;
// printf("\t.byte $%02X,$%02X,$%02X,$%02X\n",
// y1,y2,
// ((color&0x03)<<6)|x1,
// ((color&0x0c)<<4)|x2);
}
// printf("\t.byte $FF\n");
printf("\n");
return 0;
}

View File

@ -4,8 +4,8 @@
1 6 140 90 279 191 ; ocean right
4 1 157 121 208 191 ; tower shadow
0 7 141 116 231 135 ; gear base
0 7 180 17 213 121 ;
7 0 156 20 209 126 ; tower
0 7 210 17 213 121 ;
7 0 145 9 212 20
0 7 162 0 220 20
5 0 172 91 187 123
@ -16,7 +16,7 @@
5 1 177 185 230 191 ; grass
5 0 23 0 39 178 ; tree
1 5 1 13 99 44 ; leaves
5 0 0 0 20 191 ; tree
5 0 0 0 20 188 ; tree
0 5 66 0 81 187 ; tree
1 5 66 1 99 19 ; leaves
0 0 177 32 181 50 ; clock hand

View File

@ -1,4 +1,5 @@
0REM## fM##f eM!& MfR!&fMeR$!n\9C 'fZM) 'z(0T' n*:U' h$A% 'q =*% vM'0''t/+0''r3.*%! q?.%!?sY,%!x|:#% + (y!% &Q/% *~ %A '}!%A 0) x0")
1DEFFNP(X)=2*PEEK(2054+I*6+X)-64:HGR2
3P=0:FORY=FNP(3)TOFNP(3)+FNP(5):HCOLOR=FNP(0)/2:IFPTHENHCOLOR=FNP(1)/2
4P=NOTP:HPLOTFNP(2),YTOFNP(2)+FNP(4),Y:NEXT:I=I+1:GOTO3
0REM## fM##f eM!& MfR!&fMeR$"n\9C 'fZM) z(0T' n*:U 'h%A% 'q =*% vM'0''t/+0''r3.*%! q?.%!?sY,%!x|:#% + (y!% &Q/% )~ %A '} x0")
1HGR2
2FORQ=0TO5:A(Q)=2*PEEK(2054+I+Q)-64:NEXT:P=0
3FORY=A(3)TOY+A(5):HCOLOR=(P*A(0)+NOTP*A(1))/2
4P=NOTP:HPLOTA(2),YTOA(2)+A(4),Y:NEXT:I=I+6:GOTO2

View File

@ -0,0 +1,22 @@
3 3 0 0 140 90 ; sky left
3 3 140 0 279 90 ; sky right
1 6 0 90 140 191 ; ocean left
1 6 140 90 279 191 ; ocean right
4 2 157 121 208 191 ; tower shadow
0 7 141 116 231 135 ; gear base
0 0 180 17 213 121 ; tower side wall
7 0 156 20 209 126 ; tower
0 7 145 10 212 20 ; roof lower
0 7 162 0 220 20 ; roof higher
5 0 172 91 187 123 ; door
7 7 169 31 191 63 ; clock face tall
7 7 165 39 194 60 ; clock face wide
5 1 0 163 63 191 ; grass
5 1 63 167 177 191 ; grass
5 1 177 185 230 191 ; grass
5 0 23 0 39 178 ; far tree
1 5 1 13 99 44 ; leaves
5 0 0 0 18 188 ; left tree
0 5 66 0 81 187 ; tree
;1 5 66 1 99 19 ; leaves
0 0 177 32 181 50 ; clock hand