/* Creates an AppleSoft BASIC shape table */ /* See the AppleSoft manual for info on how this works */ /* Other online info (I'm looking at you, atariarchives.org) */ /* is inaccurate */ #include #include #define MAX_SIZE 8192 /* not really, but anything larger would be crazy */ static unsigned char table[MAX_SIZE]; void set_offset(current_shape,current_offset) { table[2+(current_shape*2)]=current_offset&0xff; table[2+(current_shape*2)+1]=(current_offset>>8)&0xff; } #define LOC_A 0 #define LOC_B 1 #define LOC_C 2 static void warn_if_zero(unsigned char byte, int line) { /* Check to see if we're accidentally ignoring bytes */ if (byte==0) { fprintf(stderr,"Warning, all-0 byte will be ignored on line %d!\n", line); } if ((byte&0xf8)==0) { fprintf(stderr,"Warning, ignoring C and B due to 0 on line %d!\n", line); } } int main(int argc, char **argv) { char string[BUFSIZ]; char *result; int table_size=0; int num_shapes=0; int current_offset=0,current_shape=0; int i,line=1; int command=0,sub_pointer; while(1) { result=fgets(string,BUFSIZ,stdin); if (result==NULL) break; line++; /* skip comments and blank lines */ if ((string[0]=='#') || (string[0]=='\n')) continue; sscanf(string,"%d",&num_shapes); break; } //fprintf(stderr,"Num shapes: %d\n",num_shapes); table[0]=num_shapes; table[1]=0; current_shape=0; current_offset=2+2*(num_shapes); for(current_shape=0;current_shape>8)&0xff); printf("30 FOR L=%d TO %d: READ B:POKE L,B:NEXT L\n", address,(address+table_size)-1); printf("35 HGR:ROT=0:SCALE=2\n"); printf("40 FOR I=1 TO %d: XDRAW I AT I*10,100:NEXT I\n", num_shapes); printf("90 END\n"); for(i=0;i