fireworks: add more cycle counting

This commit is contained in:
Vince Weaver 2018-09-10 16:53:14 -04:00
parent fd80493293
commit 3c90dcb39d

View File

@ -365,63 +365,75 @@ not_done_with_launch:
;================================== ;==================================
; Start explosion near x_old, y_old ; Start explosion near x_old, y_old
;================================== ;==================================
; cycles =
start_explosion: start_explosion:
jsr random16 ; Set X position
lda SEEDL
and #$f
sec
sbc #8
adc X_OLD
sta XPOS_L ; xpos=x_old+(random()%16)-8; x +/- 8
; FIXME: XPOS can overlow
jsr random16 jsr random16 ; 6+42
lda SEEDL lda SEEDL ; 3
and #$f and #$f ; 0..15 ; 2
sec sec ; 2
sbc #8 sbc #8 ; -8..7 ; 2
adc Y_OLD
sta YPOS_H ; ypos_h=y_old+(random()%16)-8; // y +/- 8 adc X_OLD ; 3
sta XPOS_L ; xpos=x_old+(random()%16)-8; x +/- 8 ; 3
lda #0
sta XPOS_H
; FIXME: XPOS from 255-280. A hard problem. Makes everything
; more complicated, 16-bit math
; set Y position
jsr random16 ; 6+42
lda SEEDL ; 3
and #$f ; 0..15 ; 2
sec ; 2
sbc #8 ; -8..7 ; 2
adc Y_OLD ; 3
sta YPOS_H ; ypos_h=y_old+(random()%16)-8; y +/- 8 ; 3
; draw white (with fringes) ; draw white (with fringes)
lda COLOR_GROUP lda COLOR_GROUP ; 3
clc clc ; 2
adc #$3 adc #$3 ; 2
tax tax ; 2
lda colortbl,X ; get color from table lda colortbl,X ; get color from table ; 4+
sta HGR_COLOR sta HGR_COLOR ; 3
; hplot(xpos,ypos_h); // draw at center of explosion ; hplot(xpos,ypos_h); // draw at center of explosion
; HPLOT X,Y: X= (y,x), Y=a ; HPLOT X,Y: X= (y,x), Y=a
ldx XPOS_L ldx XPOS_L ; 3
lda YPOS_H lda YPOS_H ; 3
ldy #0 ldy #0 ; never above 255? ; 3
jsr hplot0 ; hplot(x_old,y_old); jsr hplot0 ; hplot(x_old,y_old); ; 6+244
; Spread the explosion ; Spread the explosion
ldy #1 ldy #1 ; 2
sty TEMPY ; save Y sty TEMPY ; save Y ; 3
lda #3 ; move to continue explosion lda #3 ; move to continue explosion ; 2
sta STATE sta STATE ; 3
rts rts ; 6
;=============================== ;===============================
; Continue Explosion ; Continue Explosion
;=============================== ;===============================
continue_explosion: continue_explosion:
ldy TEMPY ldy TEMPY ; 3
;================================ ;================================
; Draw spreading dots in white ; Draw spreading dots in white
cpy #9 cpy #9 ; 2
beq explosion_erase beq explosion_erase
; hcolor_equals(color_group+3); ; hcolor_equals(color_group+3);
@ -488,31 +500,33 @@ explosion:
; HPLOT X,Y: X= (y,x), Y=a ; HPLOT X,Y: X= (y,x), Y=a
; Southeast pixel
clc clc
lda XPOS_L lda XPOS_L
adc OFFSET adc OFFSET
tax tax
ldy #0 lda XPOS_H
adc #0
tay
clc clc
lda YPOS_H lda YPOS_H
adc OFFSET adc OFFSET
jsr hplot0 ; hplot(xpos+o,ypos_h+o);
jsr hplot0 ; hplot(xpos+o,ypos_h+o); SE
; Northeast Pixel
clc clc
lda XPOS_L lda XPOS_L
adc OFFSET adc OFFSET
tax tax
ldy #0 lda XPOS_H
adc #0
tay
sec sec
lda YPOS_H lda YPOS_H
sbc OFFSET sbc OFFSET
jsr hplot0 ; hplot(xpos+o,ypos_h-o); NE jsr hplot0 ; hplot(xpos+o,ypos_h-o);
sec sec
@ -544,7 +558,7 @@ explosion:
; HPLOT X,Y: X= (y,x), Y=a ; HPLOT X,Y: X= (y,x), Y=a
ldx XPOS_L ldx XPOS_L
ldy #0 ldy XPOS_H
clc clc
lda OFFSET lda OFFSET
@ -581,7 +595,7 @@ explosion:
lsr lsr
adc XPOS_L adc XPOS_L
tax tax
ldy #0 ldy XPOS_H
lda YPOS_H lda YPOS_H