xmas2019: update tree

This commit is contained in:
Vince Weaver 2019-12-14 00:12:31 -05:00
parent 681cbc350f
commit dc9473b95b
2 changed files with 156 additions and 1 deletions

View File

@ -6,11 +6,22 @@ PNG_TO_40x48D = ../gr-utils/png_to_40x48d
all: xmas2019.dsk all: xmas2019.dsk
xmas2019.dsk: SNOW HELLO xmas2019.dsk: SNOW TREE HELLO
cp empty.dsk xmas2019.dsk cp empty.dsk xmas2019.dsk
$(DOS33) -y xmas2019.dsk BSAVE -a 0x1000 SNOW $(DOS33) -y xmas2019.dsk BSAVE -a 0x1000 SNOW
$(DOS33) -y xmas2019.dsk BSAVE -a 0x1000 TREE
$(DOS33) -y xmas2019.dsk SAVE A HELLO $(DOS33) -y xmas2019.dsk SAVE A HELLO
####
TREE: tree.o
ld65 -o TREE tree.o -C ../linker_scripts/apple2_1000.inc
tree.o: tree.s
#gr_copy.s random16.s fw.s hgr.s delay_a.s \
# vapor_lock.s gr_hline.s state_machine.s move_letters.s \
# background_final.inc
ca65 -o tree.o tree.s -l tree.lst
#### ####

144
xmas_2019/tree.s Normal file
View File

@ -0,0 +1,144 @@
; Display awesome tree
; by deater (Vince Weaver) <vince@deater.net>
; Zero Page
CH = $24
CV = $25
GBASL = $26
GBASH = $27
BASL = $28
BASH = $29
HGR_COLOR = $E4
SNOWX = $F0
COLOR = $F1
HGR = $F3E2
.include "hardware.inc"
;==================================
;==================================
bit SET_GR
bit FULLGR
bit LORES
bit PAGE0
display_loop:
;=========================
; erase old line
ldx #0
ldy which_line_y,X
lda sine_table,Y
tay
ldx #0
jsr draw_line
;==========================
; move line
inc which_line_y
lda which_line_y
and #$7f
sta which_line_y
;=========================
; draw new line
ldx #0
ldy which_line_y,X
lda sine_table,Y
tay
ldx #$44
jsr draw_line
lda #100
jsr WAIT
jmp display_loop ; 3
;=================================
; draw line
draw_line:
tya
and #$1
bne draw_line_odd
draw_line_even:
lda gr_offsets,Y
clc
adc #10
sta GBASL
lda gr_offsets+1,Y
sta GBASH
ldy #0
txa
and #$0f
sta COLOR
line_loop:
lda (GBASL),Y
and #$f0
ora COLOR
sta (GBASL),Y
iny
cpy #20
bne line_loop
rts
draw_line_odd:
tya
and #$fe
tay
lda gr_offsets,Y
clc
adc #10
sta GBASL
lda gr_offsets+1,Y
sta GBASH
ldy #0
txa
and #$f0
sta COLOR
line_loop_odd:
lda (GBASL),Y
and #$0f
ora COLOR
sta (GBASL),Y
iny
cpy #20
bne line_loop_odd
rts
gr_offsets:
.word $400,$480,$500,$580,$600,$680,$700,$780
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0
which_line_y:
.byte 0
sine_table:
.byte 23,23,24,25,25,26,27,28,28,29,30,30,31,31,32,33
.byte 33,34,34,35,35,35,36,36,36,37,37,37,37,37,37,37
.byte 37,37,37,37,37,37,37,37,36,36,36,35,35,35,34,34
.byte 33,33,32,31,31,30,30,29,28,28,27,26,25,25,24,23
.byte 23,23,22,21,21,20,19,18,18,17,16,16,15,15,14,13
.byte 13,12,12,11,11,11,10,10,10, 9, 9, 9, 9, 9, 9, 9
.byte 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,11,11,11,12,12
.byte 13,13,14,15,15,16,16,17,18,18,19,20,21,21,22,23