fireworks: launching works

This commit is contained in:
Vince Weaver 2018-09-05 16:48:54 -04:00
parent d8d4ad8f38
commit c869306e87
2 changed files with 28 additions and 15 deletions

View File

@ -38,10 +38,11 @@ PTRIG = $C070
; ROM routines ; ROM routines
HGR = $F3E2 HGR = $F3E2
HPLOT0 = $F457 HPLOT0 = $F457
HGLIN = $F53A
COLORTBL= $F6F6
TEXT = $FB36 ;; Set text mode TEXT = $FB36 ;; Set text mode
HOME = $FC58 ;; Clear the text screen HOME = $FC58 ;; Clear the text screen
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
COLORTBL= $F6F6
MAX = 3 MAX = 3

View File

@ -3,7 +3,7 @@
;======================================================================= ;=======================================================================
; Constants ; Constants
NUMSTARS = 16 NUMSTARS = 16
YSIZE = 150 YSIZE = 160
XSIZE = 280 XSIZE = 280
MARGIN = 24 MARGIN = 24
@ -92,25 +92,25 @@ launch_firework:
jsr random16 jsr random16
lda SEEDL lda SEEDL
and #$1 and #$1
beq left_hill beq right_hill
right_hill: left_hill:
lda XPOS_L lda XPOS_L
clc clc
adc #24 adc #24
sta XPOS_L ; 24-88 (64) sta XPOS_L ; 24-88 (64)
lda X_VELOCITY
eor #$ff
sta X_VELOCITY
inc X_VELOCITY ; aim toward middle
jmp done_hill jmp done_hill
left_hill: right_hill:
lda XPOS_L lda XPOS_L
clc clc
adc #191 adc #191
sta XPOS_L ; 191-255 (64) sta XPOS_L ; 191-255 (64)
lda X_VELOCITY
eor #$ff
sta X_VELOCITY
inc X_VELOCITY ; aim toward middle
done_hill: done_hill:
lda #YSIZE lda #YSIZE
@ -206,14 +206,14 @@ no_peak:
sec ; if (ypos_h>ysize-(ysize-peak)/2) sec ; if (ypos_h>ysize-(ysize-peak)/2)
lda #YSIZE lda #YSIZE
sbc PEAK sbc PEAK
asl lsr
eor #$FF eor #$FF
clc clc
adc #1 adc #1
clc clc
adc #YSIZE adc #YSIZE
cmp YPOS_H cmp YPOS_H
bcs done_moving bcc done_moving
going_up: going_up:
@ -248,7 +248,12 @@ draw_rocket:
lda Y_OLD lda Y_OLD
ldy #0 ldy #0
jsr HPLOT0 ; hplot(x_old,y_old); jsr HPLOT0 ; hplot(x_old,y_old);
; hplot_to(xpos_l,ypos_h);
; HPLOT to X,Y X=(x,a), y=Y
lda XPOS_L
ldx #0
ldy YPOS_H
jsr HGLIN ; hplot_to(xpos_l,ypos_h);
erase_rocket: erase_rocket:
@ -265,8 +270,11 @@ erase_rocket:
ldy #0 ldy #0
jsr HPLOT0 ; hplot(x_old,y_old); jsr HPLOT0 ; hplot(x_old,y_old);
; HPLOT to X,Y X=(x,a), y=Y
; hplot_to(x_old,y_old); lda X_OLD
ldx #0
ldy Y_OLD
jsr HGLIN ; hplot_to(x_old,y_old);
done_with_loop: done_with_loop:
@ -274,6 +282,10 @@ done_with_loop:
cmp MAX_STEPS cmp MAX_STEPS
beq draw_explosion beq draw_explosion
lda #$c0
jsr WAIT
inc CURRENT_STEP inc CURRENT_STEP
jmp draw_rocket_loop jmp draw_rocket_loop