appleiibot: trying to shrink snow

This commit is contained in:
Vince Weaver 2020-12-06 00:47:52 -05:00
parent 62858a0c57
commit c6f00818c2
3 changed files with 151 additions and 73 deletions

View File

@ -22,7 +22,7 @@ int main(int argc, char **argv) {
enc[e]=0; enc[e]=0;
printf("%s\n",enc); 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: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); filesize,2054+filesize);
// note, peek/poke truncate? // note, peek/poke truncate?

View File

@ -5,9 +5,10 @@ TOKENIZE = ../asoft_basic-utils/tokenize_asoft
all: hgr.dsk all: hgr.dsk
hgr.dsk: SNOW hgr.dsk: SNOW SNOW2
cp empty.dsk hgr.dsk cp empty.dsk hgr.dsk
$(DOS33) -y hgr.dsk BSAVE -a 0x0300 SNOW $(DOS33) -y hgr.dsk BSAVE -a 0x0300 SNOW
$(DOS33) -y hgr.dsk BSAVE -a 0x0300 SNOW2
### ###
@ -19,5 +20,14 @@ snow.o: snow.s
### ###
SNOW2: snow2.o
ld65 -o SNOW2 snow2.o -C ../linker_scripts/apple2_300.inc
snow2.o: snow2.s
ca65 -o snow2.o snow2.s -l snow2.lst
###
clean: clean:
rm -f *~ *.o *.lst SNOW rm -f *~ *.o *.lst SNOW SNOW2

View File

@ -1,109 +1,114 @@
GBASL = $26 ; a snowflake
GBASH = $27
HGRPAGE = $E6
PAGE0 = $C054 ; 216 bytes
PAGE1 = $C055 ; 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
HGR = $F3E2 GBASL = $26
HGR2 = $F3D8 GBASH = $27
HGRPAGE = $E6
YLO = $FC
XIDX = $FD
YBASE = $FE
LINE = $FF
PAGE0 = $C054
PAGE1 = $C055
HGR = $F3E2
HGR2 = $F3D8
HCLR = $F3F2 HCLR = $F3F2
HPOSN = $F411 HPOSN = $F411
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
snow: snow:
jsr HGR jsr HGR2 ; 3
jsr HGR2
lda #0
sta ybase
lda #$20
sta HGRPAGE
move_snow: move_snow:
lda HGRPAGE lda #0 ; 2
cmp #$20 sta XIDX ; 2
beq show_page1
; 17 bytes to set page
bit HGRPAGE ; V set if $40 ; 3
bvc show_page1 ; 2
show_page2: show_page2:
bit PAGE1 bit PAGE1 ; 3
lsr HGRPAGE lsr HGRPAGE ; 2
bne doit bne doit ; 2
show_page1: show_page1:
bit PAGE0 bit PAGE0 ; 3
asl HGRPAGE asl HGRPAGE ; 2
doit: doit:
jsr HCLR jsr HCLR
lda #<flake
sta ll_smc+1
lda #$18
sta c_smc
lda #$69
sta dir_smc
lda #23 lda #23
sta line sta LINE
inc ybase inc YBASE
lda ybase lda YBASE
sta ylo sta YLO
cmp #160 ; cmp #160
bne snow_loop ; bcc snow_loop
lda #0 ; lda #0
sta ybase and #$7f
sta YBASE
snow_loop: snow_loop:
ldy xhi ldy #$0 ; xhi
ldx xlo ldx #130 ; xlo -- (mult of 16)+2 for code to work
lda ylo ylo_smc:
lda YLO ; ylo
jsr HPOSN jsr HPOSN
ldx #0 ldx XIDX
line_loop: line_loop:
ll_smc:
lda flake,X lda flake,X
sta (GBASL),Y sta (GBASL),Y
inx inx
iny iny
cpx #6 tya
bne line_loop and #$8
beq line_loop
lda ll_smc+1
c_smc: lda XIDX
ldx LINE
cpx #13
bcc do_sub
do_add:
clc clc
dir_smc:
adc #6 adc #6
sta ll_smc+1 bne done_math
do_sub:
sec
sbc #6
inc ylo done_math:
dec line sta XIDX
beq forever
lda line inc YLO
cmp #12 dec LINE
beq move_snow
bne snow_loop bne snow_loop
lda #$E9 ; sbc imm
sta dir_smc
lda #$38 ; sec
sta c_smc
jmp snow_loop
forever:
jmp move_snow
xhi: .byte $00
xlo: .byte 77
ybase: .byte 100
ylo: .byte 100
line: .byte 23
; 6*12 = 72 bytes
flake: flake:
.byte $00,$00,$40,$01,$00,$00 .byte $00,$00,$40,$01,$00,$00
.byte $00,$00,$0C,$18,$00,$00 .byte $00,$00,$0C,$18,$00,$00
@ -118,3 +123,66 @@ flake:
.byte $00,$18,$0F,$78,$0C,$00 .byte $00,$18,$0F,$78,$0C,$00
.byte $00,$60,$40,$01,$03,$00 .byte $00,$60,$40,$01,$03,$00
;fluke:
; .byte $00,$00,$40,$01,$00,$00
; .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
; .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
;offsets:
; .byte 0,4,8,12,16,
;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