drops: that was a huge pain

This commit is contained in:
Vince Weaver 2021-02-02 12:32:55 -05:00
parent 1f1c884db9
commit 7b5acbecc0
5 changed files with 49 additions and 31 deletions

View File

@ -12,7 +12,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS \
A2.BAS FOURAM.BAS FLOPPY.BAS QR.BAS A2_4EVER.BAS RLE.BAS RLE2.BAS \
RLEASM.BAS HORIZON.BAS FLYER.BAS STAR.BAS HYPER.BAS FASTAR.BAS \
FASTAR2.BAS BIN.BAS FALLING.BAS SNOW.BAS XMAS.BAS AN3.BAS PLASMA.BAS \
C64.BAS SIERPINSKI.BAS FAKES.BAS SIER.BAS
C64.BAS SIERPINSKI.BAS FAKES.BAS SIER.BAS DROPS.BAS
cp empty.dsk appleiibot.dsk
$(DOS33) -y appleiibot.dsk BSAVE -a 0x0300 LOAD
# $(DOS33) -y appleiibot.dsk BSAVE -a 0x0C00 FASTAR2
@ -60,6 +60,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS \
$(DOS33) -y appleiibot.dsk SAVE A SIERPINSKI.BAS
$(DOS33) -y appleiibot.dsk SAVE A FAKES.BAS
$(DOS33) -y appleiibot.dsk SAVE A SIER.BAS
$(DOS33) -y appleiibot.dsk SAVE A DROPS.BAS
###
@ -349,6 +350,11 @@ FAKES.BAS: fakes.bas
SIER.BAS: sier.bas
$(TOKENIZE) < sier.bas > SIER.BAS
####
DROPS.BAS: drops.bas
$(TOKENIZE) < drops.bas > DROPS.BAS
####

View File

@ -0,0 +1,2 @@
1FORI=0TO140:POKE875+I,4*PEEK(2125+I)-192+(PEEK(2266+I/3)-35)/4^(I-INT(I/3)*3):NEXT
2&"*el9D`9E`ImQminYnZ1.2,123Po>1QkU:+b6^0hKm:028JmZ3YTjaTbUARnbJlX9RZ80nS8Qn6X/\oSCLoX:LoX9Lo>Qlg20;nTmiogod+ho^mB570U]l/Q<Xn8+lan4bb4_1N8:Jo4G0[++E-$H=746F$<*@65U,L.#@$(7#$)5E@--;QY7*'E$%Oa_

View File

@ -10,7 +10,7 @@ drops.dsk: HELLO DROPS DROPS_TINY
cp empty.dsk drops.dsk
$(DOS33) -y drops.dsk SAVE A HELLO
$(DOS33) -y drops.dsk BSAVE -a 0x300 DROPS
$(DOS33) -y drops.dsk BSAVE -a 0x300 DROPS_TINY
$(DOS33) -y drops.dsk BSAVE -a 0x36B DROPS_TINY
###
@ -29,7 +29,7 @@ drops.o: drops.s
###
DROPS_TINY: drops_tiny.o
ld65 -o DROPS_TINY drops_tiny.o -C $(LINKERSCRIPTS)/apple2_300.inc
ld65 -o DROPS_TINY drops_tiny.o -C ./apple2_36b.inc
drops_tiny.o: drops_tiny.s
ca65 -o drops_tiny.o drops_tiny.s -l drops_tiny.lst

View File

@ -0,0 +1,12 @@
MEMORY {
ZP: start = $00, size = $1A, type = rw;
RAM: start = $36B, size = $8E00, file = %O;
}
SEGMENTS {
CODE: load = RAM, type = ro, align = $1;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
}

View File

@ -26,6 +26,8 @@
; 148 bytes -- beq instead of jmp
; 147 bytes -- reuse color in drop
; 145 bytes -- leave out carry setting
; 142 bytes -- reduce to 4 colors (from 8)
; 141 bytes -- don't dex at beginning ($FF close enough)
.include "hardware.inc"
@ -59,7 +61,7 @@ drops_outer:
; in all but first loop X is $FF on arrival
inx
; inx
stx BUF1L
stx BUF2L
@ -68,31 +70,28 @@ drops_outer:
;=================================
inc FRAME
lda FRAME
tay ; save frame for later
; alternate $20/$28 in BUF1H/BUF2H
lda FRAME
tay
and #$1
asl
asl
asl
asl ; A now 0 or 8
ora #$20
sta BUF1H
eor #$8
sta BUF2H
; check if we add new raindrop
tya ; FRAME
and #$f
tya ; reload FRAME
and #$f ; only drop every 16 frames
bne no_drop
; fake random by reading ROM
; fake random number generator by reading ROM
lda $E000,Y
@ -104,26 +103,23 @@ drops_outer:
ora #$20
sta DROPH
lda #31 ; $1f
lda #31 ; $1f value for drop
; ldy #41
tay ; cheat and draw drop at offset 31 to reuse value
tay
sta (DROPL),Y
sta (DROPL),Y ; draw at offset 31
iny
sta (DROPL),Y
sta (DROPL),Y ; draw at offset 32
ldy #71
sta (DROPL),Y
sta (DROPL),Y ; draw at offset 71 (y+1)
iny
sta (DROPL),Y
sta (DROPL),Y ; draw at offset 72
no_drop:
ldx #47
; sta YY
ldx #47 ; load 47 into YY
;=================================
@ -181,7 +177,8 @@ no_oflo:
; adjust color
lsr
and #$7
lsr
and #$3
tay
lda colors,Y
sta COLOR
@ -199,10 +196,11 @@ weird_outer:
bmi drops_outer ; small enough now!
colors:
.byte $00,$22,$66,$EE,$77,$ff,$ff,$ff
.byte $22,$66,$77,$ff
;colors:
;.byte $00,$22,$66,$EE,$77,$ff,$ff,$ff
; 0 2 6 e 7 f f f
; 0000 0010 0110 1110 0111 1111 1111 1111
@ -217,8 +215,8 @@ colors:
; we can't load there though as the code would end up overlapping
; $400 which is the graphics area
; this is at 389
; we want to be at 3F5, so load program at 36C?
; this is at 38A
; we want to be at 3F5, so load program at 36B?
; called by EXECUTE.STATEMENT at $D828
; which jumps to CHRGET at $00B1
@ -234,6 +232,6 @@ colors:
; N=0 V=0 Z=0 C=1
jmp drops ; entry point from &
; bcs drops