diff --git a/appleiibot/Makefile b/appleiibot/Makefile index b805c6b9..07f50fa2 100644 --- a/appleiibot/Makefile +++ b/appleiibot/Makefile @@ -3,7 +3,7 @@ include ../Makefile.inc DOS33 = ../dos33fs-utils/dos33 TOKENIZE = ../asoft_basic-utils/tokenize_asoft -all: appleiibot.dsk convert_to convert_back convert_qkumba make_boxes +all: appleiibot.dsk convert_to convert_back convert_qkumba make_boxes convert_vmw appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS \ CIRCLES.BAS AUTUMN.BAS QKUMBA.BAS ASTEROID.BAS PERSON.BAS SHIP.BAS \ @@ -80,6 +80,15 @@ convert_qkumba.o: convert_qkumba.c ### +convert_vmw: convert_vmw.o + $(CC) $(LFLAGS) -o convert_vmw convert_vmw.o + +convert_vmw.o: convert_vmw.c + $(CC) $(CFLAGS) -c convert_vmw.c + + +### + convert_back: convert_back.o $(CC) $(LFLAGS) -o convert_back convert_back.o @@ -305,4 +314,4 @@ HYPER.BAS: hyper.bas #### clean: - rm -f *~ *.o *.lst convert_to convert_from convert_qkumba make_boxes convert_back LOAD *.BAS + rm -f *~ *.o *.lst convert_to convert_from convert_qkumba convert_vmw make_boxes convert_back LOAD *.BAS diff --git a/appleiibot/convert_vmw.c b/appleiibot/convert_vmw.c index 1325fd75..5d988c1f 100644 --- a/appleiibot/convert_vmw.c +++ b/appleiibot/convert_vmw.c @@ -7,7 +7,7 @@ int main(int argc, char **argv) { int i = 0; int e = 0,filesize; - int val,pv; + int val,pv,final; unsigned char in[1024]; unsigned char enc[1024]; int third; @@ -21,13 +21,15 @@ int main(int argc, char **argv) { if (i>2; val=val+32; + final=((val-32)<<2)+third-0x40; fprintf(stderr,"%d: %x -> %x %x ==> %x\n", - i,pv,val,third,((val-32)<<2)+third); + i,pv,val,third,final); + if (pv!=final) fprintf(stderr,"error0: no match!\n"); if (val<0) fprintf(stderr,"error0, negative! in=%x e=%x val=%x\n", in[i+0],third,val); if (val<0x20) fprintf(stderr,"error0, unprintable! in=%x pv=%x e=%x val=%x\n", @@ -39,14 +41,16 @@ int main(int argc, char **argv) { if (i + 1 < filesize) { val=in[i+1]; pv=val; - val=val+0x100; + val=val+0x40; val-=(third>>2); - val&=0xff; +// val&=0xff; val=val>>2; val=val+32; + final=((val-32)<<2)+(third>>2)-0x40; fprintf(stderr,"%d: %x -> %x %x ==> %x\n", - i+1,pv,val,third>>2,((val-32)<<2)+(third>>2)); + i+1,pv,val,third>>2,final); + if (pv!=final) fprintf(stderr,"error1: no match!\n"); if (val<0) fprintf(stderr,"error1, negative! %x %x\n", in[i+0]&0xfc,third); if (val<0x20) fprintf(stderr,"error1, unprintable! %x %x\n", @@ -58,15 +62,15 @@ int main(int argc, char **argv) { if (i + 2 < filesize) { val=in[i+2]; pv=val; - val=val+0x100; + val=val+0x40; val-=(third>>4); - val&=0xff; +// val&=0xff; val=val>>2; val=val+32; - + final=((val-32)<<2)+(third>>4)-0x40; fprintf(stderr,"%d: %x -> %x %x ==> %x\n", - i+2,pv,val,third>>4,((val-32)<<2)+(third>>4)); - + i+2,pv,val,third>>4,final); + if (pv!=final) fprintf(stderr,"error2: no match!\n"); if (val<0) fprintf(stderr,"error2, negative! %x %x\n", in[i+0]&0xfc,third); if (val<0x20) fprintf(stderr,"error2, unprintable! %x %x\n", @@ -79,8 +83,10 @@ int main(int argc, char **argv) { enc[e]=0; printf("%s\n",enc); - printf("2FORI=0TO%d:C=(PEEK(%d+I/3)-32)/4^(I-INT(I/3)*3):POKE768+I,C+4*(PEEK(2054+I)-32-INT(C/4)):NEXT:CALL768\n", + printf("2FORI=0TO%d:POKE768+I,4*PEEK(2054+I)-192+(PEEK(%d+I/3)-32)/4^(I-INT(I/3)*3):NEXT:CALL768\n", filesize,2054+filesize); +// printf("2FORI=0TO%d:C=(PEEK(%d+I/3)-32)/4^(I-INT(I/3)*3):POKE768+I,C+4*(PEEK(2054+I)-32-INT(C/4)):NEXT:CALL768\n", +// filesize,2054+filesize); // note, peek/poke truncate? //2FORI=1013TO1141:C=(PEEK(1843+I/3)-32)/4^(I-INT(I/3)*3):POKEI,C+4*(PEEK(1041+I)-32-INT(C/4)):NEXT:& diff --git a/appleiibot/snow.bas b/appleiibot/snow.bas index 7f838958..5a094c37 100644 --- a/appleiibot/snow.bas +++ b/appleiibot/snow.bas @@ -1,12 +1,2 @@ -1REM,clV5QfWo3NQegoQoX&VPYo8,kYj^M*Y_5/T9jb`6dkio^o<\2g000000?0003600L100?H0,B6$-<$I1.I<-?0..?-?0:O@):1K0O):1I7033N30H3-0012345.699<>7<<9986543210P1G=J!H!A7;?" ).B $ #'0PP(2X2(C$C,, T B(A(" -2FORI=0TO142 -3POKE768+I,4*PEEK(2054+I)-64+(PEEK(2196+I/3)-32)/4^(I-INT(I/3)*3)-128:NEXT:CALL768 -'1REM\S\F%AVG_#>AUW_A_HVF@I_(\[IZN=ZIO%_D)ZRP&T[Y_N_,L"W / #& # 8#] !"#$%^&)),.',,))(&%$#"! P1G=J!H!A7;?" ).B $ #'0PP(2X2(C$C,, T B(A(" -'2FORI=0TO142:Z%=(PEEK(2196+I/3)-32)/4^(I-INT(I/3)*3)+4*PEEK(2054+I)-128 -'4POKE768+I,Z%-256*Z%>255:NEXT:CALL768 -'2FORI=0TO142:Z=INT((PEEK(2196+I/3)-32)/4^(I-INT(I/3)*3)+4*PEEK(2054+I)-128) -'4POKE768+I,Z-256*(Z>255):NEXT:CALL768 -'2FORI=0TO47:FORJ=0TO2:Z%=(PEEK(2196+I)-32)/4^J+4*(PEEK(2054+I*3+J)-32) -'4POKE768+I*3+J,Z%-256*(Z%>255):NEXTJ,I:CALL768 -' 301 is one to beat -' 290 is one to beat +1REM,clV5QfWo3NQegoQoX&VPYo8,kYf]J+Y_60T9jb`6dkio^o<\2g000000?0003600L100?H0,B6$-<$I1.I<-?0..?-?0:O@):1K0O):1I7033N30H3-0012345.699<>7<<998654321P1G=J!H!AG80" ).B $ #'0PP(2X2(C$C,, T B(A(" +2FORI=0TO141:POKE1013+I,4*PEEK(2054+I)-192+(PEEK(2195+I/3)-32)/4^(I-INT(I/3)*3):NEXT:& diff --git a/hgr/Makefile b/hgr/Makefile index 3fe1e9ea..e8576344 100644 --- a/hgr/Makefile +++ b/hgr/Makefile @@ -5,10 +5,11 @@ TOKENIZE = ../asoft_basic-utils/tokenize_asoft all: hgr.dsk -hgr.dsk: SNOW SNOW2 +hgr.dsk: SNOW SNOW2 SNOW3 cp empty.dsk hgr.dsk $(DOS33) -y hgr.dsk BSAVE -a 0x0300 SNOW $(DOS33) -y hgr.dsk BSAVE -a 0x0300 SNOW2 + $(DOS33) -y hgr.dsk BSAVE -a 0x0367 SNOW3 ### @@ -26,8 +27,16 @@ SNOW2: snow2.o snow2.o: snow2.s ca65 -o snow2.o snow2.s -l snow2.lst +### + +SNOW3: snow3.o + ld65 -o SNOW3 snow3.o -C ./apple2_custom.inc + +snow3.o: snow3.s + ca65 -o snow3.o snow3.s -l snow3.lst + ### clean: - rm -f *~ *.o *.lst SNOW SNOW2 + rm -f *~ *.o *.lst SNOW SNOW2 SNOW3 diff --git a/hgr/snow3.s b/hgr/snow3.s new file mode 100644 index 00000000..79d0a401 --- /dev/null +++ b/hgr/snow3.s @@ -0,0 +1,180 @@ +; a snowflake + +; 216 bytes +; 209 -- remove extraneous call to HGR +; 207 -- use bvc to check page +; 203 -- hardcode x coords +; 199 -- line in ZP +; 192 -- ybase in ZP +; 171 -- remove self-modifying code +; 167 -- remove YBASE ininitialization +; 161 -- only fall to 128 then recycle +; 156 -- use lookup table +; 145 -- drop page flipping +; 142 -- only need one row of zeros + +GBASL = $26 +GBASH = $27 +HGRPAGE = $E6 + +YLO = $FC +XIDX = $FD +YBASE = $FE +LINE = $FF + +PAGE0 = $C054 +PAGE1 = $C055 + +HGR = $F3E2 +HGR2 = $F3D8 +HCLR = $F3F2 +HPOSN = $F411 + + +snow: +; jsr HGR + jsr HGR2 ; 3 + +move_snow: + + ; 17 bytes to set page + +; bit HGRPAGE ; V set if $40 ; 3 +; bvc show_page1 ; 2 + +show_page2: +; bit PAGE1 ; 3 +; lsr HGRPAGE ; 2 +; bne doit ; 2 + +show_page1: +; bit PAGE0 ; 3 +; asl HGRPAGE ; 2 + +doit: +; jsr HCLR + + lda #24 + sta LINE + + lda YBASE ; be sure gets init at start + and #$7f ; wrap at 128 + sta YBASE + inc YBASE + sta YLO + + +snow_loop: + ldy #$0 ; xhi + ldx #130 ; xlo -- (mult of 16)+2 for code to work + lda YLO ; ylo + jsr HPOSN + + ; y is xlo div 7 + + ldx LINE + lda offsets,X + tax +line_loop: + + lda flake,X + sta (GBASL),Y + + inx + iny + cpy #$18 +; tya +; and #$8 + bne line_loop + + inc YLO +inc_smc: + dec LINE + bmi move_snow + bpl snow_loop + + +; 6*12 = 72 bytes +;flake: +; .byte $00,$00,$40,$01,$00,$00 +; .byte $00,$00,$0C,$18,$00,$00 +; .byte $00,$00,$70,$07,$00,$00 +; .byte $00,$00,$43,$61,$00,$00 +; .byte $00,$00,$4C,$19,$00,$00 +; .byte $33,$00,$70,$07,$00,$66 +; .byte $30,$06,$40,$01,$30,$06 +; .byte $3f,$06,$40,$01,$30,$7e +; .byte $40,$07,$30,$06,$70,$01 +; .byte $7c,$07,$30,$06,$70,$1f +; .byte $00,$18,$0F,$78,$0C,$00 +; .byte $00,$60,$40,$01,$03,$00 + +flake: + .byte $00,$00,$00,$00 ; 0 + .byte $00,$00,$40,$01,$00,$00 ; 4,8 + .byte $0C,$18,$00,$00 ; + .byte $70,$07,$00,$00 ; + .byte $43,$61,$00,$00 ; + .byte $4C,$19,$00,$00 ; + .byte $33,$00,$70,$07,$00,$66 ; 26 + .byte $30,$06,$40,$01,$30,$06 ; 32 + .byte $3f,$06,$40,$01,$30,$7e ; 38 + .byte $40,$07,$30,$06,$70,$01 ; 44 + .byte $7c,$07,$30,$06,$70,$1f ; 50 + .byte $00,$18,$0F,$78,$0C,$00 ; 56 + .byte $60,$40,$01,$03 ; 61 + +offsets: + .byte 0,4,8,12,16,20,26,32,38,44,50,56,61 + .byte 56,50,44,38,32,26,20,16,12,8,4 ; ,0 + + ; want to be at $3f5 to get called by & + +; jmp snow + +;floke: +; .byte $0,$0,$1,$2,$0,$0 +; .byte $0,$0,$3,$4,$0,$0 +; .byte $0,$0,$5,$6,$0,$0 +; .byte $0,$0,$7,$8,$0,$0 +; .byte $0,$0,$9,$A,$0,$0 +; .byte $B,$0,$5,$6,$0,$C +; .byte $D,$E,$1,$2,$d,$E +; .byte $F,$E,$1,$2,$d,$7e +; .byte $1,$6,$d,$e,$5,$01 +; .byte $7c,$6,$d,$e,$5,$1f +; .byte $0,$4,$0F,$78,$3,$0 +; .byte $0,$60,$1,$2,$03,$0 + + +;tokens: +; .byte $00,$40,$01,$0C +; .byte $18,$70,$07,$43 +; .byte $61,$4C,$19,$33 +; .byte $66,$30,$06,$3F + + ; 00 000000 -> 0 0 00 00 00 - 0 00 00 00 0 + ; 08 000100 -> 0 1 00 00 00 - 0 00 00 00 1 + +; lda flake2,X +; asl +; php +; ror out +; plp +; ror out + +;flake2: +; .byte $00,$08,$00 +; .byte $00,$22,$00 +; .byte $00,$1C,$00 +; .byte $00,$49,$00 +; .byte $00,$2A,$00 +; .byte $60,$1C,$05 +; .byte $14,$08,$14 +; .byte $74,$08,$17 +; .byte $0C,$14,$18 +; .byte $3C,$14,$1E +; .byte $02,$63,$20 +; .byte $01,$08,$40 + +