mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-08-15 08:27:41 +00:00
xmas2019: update snow
This commit is contained in:
165
xmas_2019/snow.s
165
xmas_2019/snow.s
@@ -15,6 +15,7 @@ SEEDH = $4F
|
|||||||
|
|
||||||
HGR_COLOR = $E4
|
HGR_COLOR = $E4
|
||||||
SNOWX = $F0
|
SNOWX = $F0
|
||||||
|
TEMPY = $F1
|
||||||
|
|
||||||
HGR = $F3E2
|
HGR = $F3E2
|
||||||
|
|
||||||
@@ -31,6 +32,28 @@ NUMFLAKES = 10
|
|||||||
jsr HGR
|
jsr HGR
|
||||||
bit FULLGR
|
bit FULLGR
|
||||||
|
|
||||||
|
|
||||||
|
;==================================
|
||||||
|
; init snow
|
||||||
|
;==================================
|
||||||
|
|
||||||
|
ldx #NUMFLAKES-1
|
||||||
|
snow_init_loop:
|
||||||
|
|
||||||
|
jsr random16
|
||||||
|
|
||||||
|
lda SEEDL
|
||||||
|
and #$3f
|
||||||
|
sta snow_x,X
|
||||||
|
|
||||||
|
lda SEEDH
|
||||||
|
and #$7f
|
||||||
|
sta snow_y,X
|
||||||
|
|
||||||
|
dex
|
||||||
|
bpl snow_init_loop
|
||||||
|
|
||||||
|
|
||||||
display_loop:
|
display_loop:
|
||||||
|
|
||||||
; 0 4 8 c 10 14 18 1c
|
; 0 4 8 c 10 14 18 1c
|
||||||
@@ -38,35 +61,47 @@ display_loop:
|
|||||||
|
|
||||||
;=========================
|
;=========================
|
||||||
; erase old snow
|
; erase old snow
|
||||||
|
;=========================
|
||||||
|
; 2 + (35+29+7)*NUMFLAKES - 1
|
||||||
|
; 1 +71*NUMFLAKES = 711
|
||||||
|
|
||||||
ldx #0
|
ldx #0 ; 2
|
||||||
erase_loop:
|
erase_loop:
|
||||||
lda snow_y,X ; get Y
|
lda snow_y,X ; get Y ; 4+
|
||||||
lsr
|
lsr ; 2
|
||||||
lsr
|
lsr ; 2
|
||||||
lsr ; divide by 8
|
lsr ; divide by 8 ; 2
|
||||||
tay
|
sta TEMPY ; 3
|
||||||
|
lda snow_x,X ; 4+
|
||||||
|
tay ; 2
|
||||||
|
lda div_7_q,Y ; 4+
|
||||||
|
ldy TEMPY ; 3
|
||||||
|
clc ; 2
|
||||||
|
adc hgr_offsets_l,Y ; 4+
|
||||||
|
sta GBASL ; 3
|
||||||
|
;=============
|
||||||
|
; 35
|
||||||
|
|
||||||
clc
|
lda snow_y,X ; 4+
|
||||||
lda hgr_offsets_l,Y
|
asl ; 2
|
||||||
adc snow_x,X
|
asl ; 2
|
||||||
sta GBASL ; point GBASL to right location
|
and #$1f ; 2
|
||||||
|
clc ; 2
|
||||||
|
adc hgr_offsets_h,Y ; 4
|
||||||
|
sta GBASH ; 3
|
||||||
|
lda #0 ; 2
|
||||||
|
tay ; 2
|
||||||
|
sta (GBASL),Y ; 6
|
||||||
|
;============
|
||||||
|
; 29
|
||||||
|
|
||||||
lda snow_y,X
|
inx ; 2
|
||||||
asl
|
cpx #NUMFLAKES ; 2
|
||||||
asl
|
bne erase_loop ; 3
|
||||||
and #$1f
|
;============
|
||||||
clc
|
; 7
|
||||||
adc hgr_offsets_h,Y
|
|
||||||
sta GBASH
|
|
||||||
|
|
||||||
ldy #0
|
; -1
|
||||||
lda #0
|
|
||||||
sta (GBASL),Y
|
|
||||||
|
|
||||||
inx
|
|
||||||
cpx #NUMFLAKES
|
|
||||||
bne erase_loop
|
|
||||||
|
|
||||||
;==========================
|
;==========================
|
||||||
; move snow
|
; move snow
|
||||||
@@ -97,11 +132,11 @@ just_inc:
|
|||||||
jmp snow_no
|
jmp snow_no
|
||||||
|
|
||||||
snow_right:
|
snow_right:
|
||||||
inc snow_offset,X
|
inc snow_x,X
|
||||||
jmp snow_no
|
jmp snow_no
|
||||||
|
|
||||||
snow_left:
|
snow_left:
|
||||||
dec snow_offset,X
|
dec snow_x,X
|
||||||
snow_no:
|
snow_no:
|
||||||
|
|
||||||
done_inc:
|
done_inc:
|
||||||
@@ -112,35 +147,54 @@ done_inc:
|
|||||||
|
|
||||||
;=========================
|
;=========================
|
||||||
; draw new snow
|
; draw new snow
|
||||||
|
;=========================
|
||||||
|
; 2+ (35+22+19+7)*NUMFLAKES -1
|
||||||
|
; 1+83*NUMFLAKES = 831
|
||||||
|
|
||||||
ldx #0
|
ldx #0 ; 2
|
||||||
draw_loop:
|
draw_loop:
|
||||||
lda snow_y,X
|
lda snow_y,X ; 4+
|
||||||
lsr
|
lsr ; 2
|
||||||
lsr
|
lsr ; 2
|
||||||
lsr
|
lsr ; 2
|
||||||
tay
|
sta TEMPY ; 3
|
||||||
clc
|
lda snow_x,X ; 4+
|
||||||
lda hgr_offsets_l,Y
|
tay ; 2
|
||||||
adc snow_x,X
|
lda div_7_q,Y ; 4+
|
||||||
sta GBASL
|
ldy TEMPY ; 3
|
||||||
|
clc ; 2
|
||||||
|
adc hgr_offsets_l,Y ; 4+
|
||||||
|
sta GBASL ; 3
|
||||||
|
;===========
|
||||||
|
; 35
|
||||||
|
|
||||||
lda snow_y,X
|
lda snow_y,X ; 4+
|
||||||
asl
|
asl ; 2
|
||||||
asl
|
asl ; 2
|
||||||
and #$1f
|
and #$1f ; 2
|
||||||
clc
|
clc ; 2
|
||||||
adc hgr_offsets_h,Y
|
adc hgr_offsets_h,Y ; 4+
|
||||||
sta GBASH
|
sta GBASH ; 3
|
||||||
|
;=============
|
||||||
|
; 19
|
||||||
|
|
||||||
ldy #0
|
ldy snow_x,X ; 4+
|
||||||
lda #1
|
lda div_7_r,Y ; 4+
|
||||||
sta (GBASL),Y
|
tay ; 2
|
||||||
|
lda pixel_lookup,Y ; 4+
|
||||||
|
|
||||||
inx
|
ldy #0 ; 2
|
||||||
cpx #NUMFLAKES
|
sta (GBASL),Y ; 6
|
||||||
bne draw_loop
|
;=============
|
||||||
|
; 22
|
||||||
|
|
||||||
|
inx ; 2
|
||||||
|
cpx #NUMFLAKES ; 2
|
||||||
|
bne draw_loop ; 3
|
||||||
|
;=============
|
||||||
|
; 7
|
||||||
|
|
||||||
|
; -1
|
||||||
lda #100
|
lda #100
|
||||||
jsr WAIT
|
jsr WAIT
|
||||||
|
|
||||||
@@ -148,10 +202,7 @@ draw_loop:
|
|||||||
|
|
||||||
|
|
||||||
snow_x:
|
snow_x:
|
||||||
.byte 2,4,6,8,10,12,14,16,18,20
|
.byte 0,0,0,0,0,0,0,0,0,0
|
||||||
|
|
||||||
snow_offset:
|
|
||||||
.byte 0,1,2,3,4,5,6,7,0,1
|
|
||||||
|
|
||||||
snow_y:
|
snow_y:
|
||||||
.byte 0,0,0,0,0,0,0,0,0,0
|
.byte 0,0,0,0,0,0,0,0,0,0
|
||||||
@@ -191,11 +242,7 @@ div_7_r:
|
|||||||
.byte 0,1,2,3,4,5,6 ; 56..62
|
.byte 0,1,2,3,4,5,6 ; 56..62
|
||||||
.byte 0 ; 63
|
.byte 0 ; 63
|
||||||
|
|
||||||
|
pixel_lookup:
|
||||||
|
.byte $01,$02,$04,$08,$10,$20,$40
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.include "random16.s"
|
.include "random16.s"
|
||||||
|
Reference in New Issue
Block a user