xdraw: add shimmer effect

This commit is contained in:
Vince Weaver 2021-05-05 13:07:09 -04:00
parent 096291528f
commit e9c0699bc1
2 changed files with 161 additions and 2 deletions

View File

@ -8,7 +8,7 @@ LINKERSCRIPTS = ../../../linker_scripts
all: xdraw.dsk
xdraw.dsk: HELLO TINY_XDRAW TINY_COOL TINY_LINES TINY_CENTER NYAN XDRAW_TEST
xdraw.dsk: HELLO TINY_XDRAW TINY_COOL TINY_LINES TINY_CENTER NYAN XDRAW_TEST SHIMMER
cp $(EMPTYDISK) xdraw.dsk
$(DOS33) -y xdraw.dsk SAVE A HELLO
$(DOS33) -y xdraw.dsk BSAVE -a 0xE7 TINY_XDRAW
@ -17,6 +17,7 @@ xdraw.dsk: HELLO TINY_XDRAW TINY_COOL TINY_LINES TINY_CENTER NYAN XDRAW_TEST
$(DOS33) -y xdraw.dsk BSAVE -a 0xE7 TINY_CENTER
$(DOS33) -y xdraw.dsk BSAVE -a 0xC00 NYAN
$(DOS33) -y xdraw.dsk BSAVE -a 0xE7 XDRAW_TEST
$(DOS33) -y xdraw.dsk BSAVE -a 0xC00 SHIMMER
###
@ -74,9 +75,18 @@ NYAN: nyan.o
nyan.o: nyan.s
ca65 -o nyan.o nyan.s -l nyan.lst
###
SHIMMER: shimmer.o
ld65 -o SHIMMER shimmer.o -C $(LINKERSCRIPTS)/apple2_c00.inc
shimmer.o: shimmer.s
ca65 -o shimmer.o shimmer.s -l shimmer.lst
####
clean:
rm -f *~ *.o *.lst HELLO TINY_COOL TINY_XDRAW TINY_LINES TINY_CENTER NYAN XDRAW_TEST
rm -f *~ *.o *.lst HELLO TINY_COOL TINY_XDRAW TINY_LINES TINY_CENTER NYAN XDRAW_TEST SHIMMER

View File

@ -0,0 +1,149 @@
; zero page locations
HGR_SHAPE = $1A
SEEDL = $4E
FRAME = $A4
OUR_ROT = $A5
RND_EXP = $C9
HGR_PAGE = $E6
HGR_SCALE = $E7
HGR_ROTATION = $F9
DIRECTION = $FC
XPOS = $FD
YPOS = $FF
; Soft Switches
KEYPRESS = $C000
KEYRESET = $C010
SPEAKER = $C030
PAGE0 = $C054
PAGE1 = $C055
; ROM calls
RND = $EFAE
HGR2 = $F3D8
HCLR = $F3F2
HCLR_COLOR = $F3F4
HPOSN = $F411
XDRAW0 = $F65D
TEXT = $FB36 ; Set text mode
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
shimmer:
;=========================================
; SETUP
;=========================================
jsr HGR2
lda #0
sta FRAME
lda #14
sta YPOS
lda #3
sta HGR_SCALE
lda #32
sta DIRECTION
lda #22 ; only set once, we wrap
sta XPOS
y_loop:
x_loop:
main_loop:
;=======================
; xdraw
;=======================
xdraw:
; setup X and Y co-ords
ldy #0 ; XPOSH always 0 for us
ldx XPOS
lda YPOS
jsr HPOSN ; X= (y,x) Y=(a)
ldx #<shape_dsr
ldy #>shape_dsr
lda #0 ; set rotation
jsr XDRAW0 ; XDRAW 1 AT X,Y
; Both A and X are 0 at exit
inc FRAME
lda FRAME
and #$7
beq reverse
add_x:
lda XPOS
clc
adc DIRECTION
sta XPOS
jmp x_loop
reverse:
lda DIRECTION ; switch direction
eor #$ff
sec
adc #0
sta DIRECTION
lda YPOS
clc
adc #16
sta YPOS
cmp #190
bne y_loop
do_shimmer_y:
ldx #0
do_shimmer_x:
blargh:
lda $4000,X
eor #$80
blargh2:
sta $4000,X
inx
bne do_shimmer_x
inc blargh+2
inc blargh2+2
lda blargh+2
cmp #$60
bne do_shimmer_y
lda #$40
sta blargh+2
sta blargh2+2
jmp do_shimmer_y
end:
jmp end
shape_dsr:
.byte $2d,$36,$ff,$3f
.byte $24,$ad,$22,$24,$94,$21,$2c,$4d
.byte $91,$3f,$36,$00