appleiibot: work on snow

This commit is contained in:
Vince Weaver 2020-12-07 08:52:43 -05:00
parent 8f60984bd3
commit 70735dcdeb
3 changed files with 132 additions and 31 deletions

89
appleiibot/convert_vmw.c Normal file
View File

@ -0,0 +1,89 @@
/* code by qkumba */
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv) {
int i = 0;
int e = 0,filesize;
int val,pv;
unsigned char in[1024];
unsigned char enc[1024];
int third;
printf("1REM");
filesize=read(0,in,1024);
do {
third = ((in[i + 2] & 3) << 4) +
((in[i + 1] & 3) << 2) + (in[i + 0] & 3);
enc[e++]=third+32;
if (i<filesize) {
val=in[i+0];
pv=val;
val=val+0x100;
val-=third;
val&=0xff;
val=val>>2;
val=val+32;
fprintf(stderr,"%d: %x -> %x %x ==> %x\n",
i,pv,val,third,((val-32)<<2)+third);
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",
in[i+0],pv,third,val);
if (val>0x7e) fprintf(stderr,"error0, too big! in=%x pv=%x e=%x val=%x\n",
in[i+0],pv,third,val);
printf("%c",val); //(in[i + 0] >> 2) + 32);
}
if (i + 1 < filesize) {
val=in[i+1];
pv=val;
val=val+0x100;
val-=(third>>2);
val&=0xff;
val=val>>2;
val=val+32;
fprintf(stderr,"%d: %x -> %x %x ==> %x\n",
i+1,pv,val,third>>2,((val-32)<<2)+(third>>2));
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",
in[i+0]&0xfc,third);
if (val>0x7e) fprintf(stderr,"error1, too big! in=%x pv=%x e=%x val=%x\n",
in[i+0],pv,third,val);
printf("%c",val); //(in[i + 1] >> 2) + 32);
}
if (i + 2 < filesize) {
val=in[i+2];
pv=val;
val=val+0x100;
val-=(third>>4);
val&=0xff;
val=val>>2;
val=val+32;
fprintf(stderr,"%d: %x -> %x %x ==> %x\n",
i+2,pv,val,third>>4,((val-32)<<2)+(third>>4));
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",
in[i+0]&0xfc,third);
if (val>0x7e) fprintf(stderr,"error2 too big! in=%x pv=%x e=%x val=%x\n",
in[i+0],pv,third,val);
printf("%c",val);//(in[i + 2] >> 2) + 32);
}
} while ((i += 3) < filesize);
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",
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:&
return 0;
}

View File

@ -1,2 +1,8 @@
1REM(V\J A_)Y4!+5P1YT!+5P!Y(\\J%A_Y_I_A_RHD!J A_H H@I_($]I_O7 D)ZRF*"\]I_I_X#D!&:!T .Z!A_Y_Q_\JTS 0 #& <! 08 3& , <! 9,!0 ,!/!0 ,?0!,!< ?!,!<' &#># 80 P1A,A2 *>W:&!$)H!A5G !4.1D,9).P ! #P! !#C(A+A,2,RP -
2FORI=0TO165:C%=(PEEK(2219+I/3)-32)/4^(I-INT(I/3)*3):POKE768+I,C%+4*(PEEK(2054+I)-32-INT(C%/4)):NEXT:CALL768
1REM\S\F%AVG_#>AUW_A_HVF@I_(\[IZN=ZIO%_D)ZRP&T[Y_N_,L"W / #& <! /8 \2&T],T9!^9,]/ ^^/]/ *?0Y*!; ?Y*!9' ##># 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

View File

@ -10,6 +10,8 @@
; 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
@ -30,45 +32,46 @@ HPOSN = $F411
snow:
; jsr HGR
jsr HGR2 ; 3
move_snow:
; lda #0 ; 2
; sta XIDX ; 2
; 17 bytes to set page
bit HGRPAGE ; V set if $40 ; 3
bvc show_page1 ; 2
; bit HGRPAGE ; V set if $40 ; 3
; bvc show_page1 ; 2
show_page2:
bit PAGE1 ; 3
lsr HGRPAGE ; 2
bne doit ; 2
; bit PAGE1 ; 3
; lsr HGRPAGE ; 2
; bne doit ; 2
show_page1:
bit PAGE0 ; 3
asl HGRPAGE ; 2
; bit PAGE0 ; 3
; asl HGRPAGE ; 2
doit:
jsr HCLR
; jsr HCLR
lda #22
lda #24
sta LINE
inc YBASE
lda YBASE
sta YLO
and #$7f
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
ylo_smc:
lda YLO ; ylo
jsr HPOSN
; y is xlo div 7
ldx LINE
lda offsets,X
tax
@ -79,11 +82,13 @@ line_loop:
inx
iny
tya
and #$8
beq line_loop
cpy #$18
; tya
; and #$8
bne line_loop
inc YLO
inc_smc:
dec LINE
bmi move_snow
bpl snow_loop
@ -105,22 +110,23 @@ line_loop:
; .byte $00,$60,$40,$01,$03,$00
flake:
.byte $00,$00,$40,$01,$00,$00 ; 0, 4
.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 ; 22
.byte $30,$06,$40,$01,$30,$06 ; 28
.byte $3f,$06,$40,$01,$30,$7e ; 34
.byte $40,$07,$30,$06,$70,$01 ; 40
.byte $7c,$07,$30,$06,$70,$1f ; 46
.byte $00,$18,$0F,$78,$0C,$00 ; 52
.byte $60,$40,$01,$03
.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,22,28,34,40,46,52,57
.byte 52,46,40,34,28,22,16,12,8,4,0
.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
;floke:
; .byte $0,$0,$1,$2,$0,$0