From c869306e87d2d894cf88d376666f066ea7ecc817 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 5 Sep 2018 16:48:54 -0400 Subject: [PATCH] fireworks: launching works --- fireworks/fireworks.s | 3 ++- fireworks/fw.s | 40 ++++++++++++++++++++++++++-------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/fireworks/fireworks.s b/fireworks/fireworks.s index a87475b3..20523d57 100644 --- a/fireworks/fireworks.s +++ b/fireworks/fireworks.s @@ -38,10 +38,11 @@ PTRIG = $C070 ; ROM routines HGR = $F3E2 HPLOT0 = $F457 +HGLIN = $F53A +COLORTBL= $F6F6 TEXT = $FB36 ;; Set text mode HOME = $FC58 ;; Clear the text screen WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us -COLORTBL= $F6F6 MAX = 3 diff --git a/fireworks/fw.s b/fireworks/fw.s index fff2772b..97c4dfda 100644 --- a/fireworks/fw.s +++ b/fireworks/fw.s @@ -3,7 +3,7 @@ ;======================================================================= ; Constants NUMSTARS = 16 -YSIZE = 150 +YSIZE = 160 XSIZE = 280 MARGIN = 24 @@ -92,25 +92,25 @@ launch_firework: jsr random16 lda SEEDL and #$1 - beq left_hill -right_hill: + beq right_hill +left_hill: lda XPOS_L clc adc #24 sta XPOS_L ; 24-88 (64) - lda X_VELOCITY - eor #$ff - sta X_VELOCITY - inc X_VELOCITY ; aim toward middle - jmp done_hill -left_hill: +right_hill: lda XPOS_L clc adc #191 sta XPOS_L ; 191-255 (64) + lda X_VELOCITY + eor #$ff + sta X_VELOCITY + inc X_VELOCITY ; aim toward middle + done_hill: lda #YSIZE @@ -206,14 +206,14 @@ no_peak: sec ; if (ypos_h>ysize-(ysize-peak)/2) lda #YSIZE sbc PEAK - asl + lsr eor #$FF clc adc #1 clc adc #YSIZE cmp YPOS_H - bcs done_moving + bcc done_moving going_up: @@ -248,7 +248,12 @@ draw_rocket: lda Y_OLD ldy #0 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: @@ -265,8 +270,11 @@ erase_rocket: ldy #0 jsr HPLOT0 ; hplot(x_old,y_old); - - ; hplot_to(x_old,y_old); + ; HPLOT to X,Y X=(x,a), y=Y + lda X_OLD + ldx #0 + ldy Y_OLD + jsr HGLIN ; hplot_to(x_old,y_old); done_with_loop: @@ -274,6 +282,10 @@ done_with_loop: cmp MAX_STEPS beq draw_explosion + + lda #$c0 + jsr WAIT + inc CURRENT_STEP jmp draw_rocket_loop