firework: done converting launch code

This commit is contained in:
Vince Weaver 2018-09-05 16:27:42 -04:00
parent ee81b1f97c
commit d8d4ad8f38

View File

@ -23,7 +23,7 @@ Y_OLD = $FB
Y_OLDER = $FC Y_OLDER = $FC
X_OLD = $FD X_OLD = $FD
X_OLDER = $FE X_OLDER = $FE
TEMPY = $FF
;signed char o,i; ;signed char o,i;
@ -159,45 +159,71 @@ draw_rocket_loop:
sta YPOS_H ; adjust ypos sta YPOS_H ; adjust ypos
; /* adjust Y velocity, slow it down */ ; adjust Y velocity, slow it down
;// c=0; clc
;// a=y_velocity_l; lda Y_VELOCITY_L
;// adc(0x20); // 0x20 = 0.125 adc #$20 ; $20 = 0.125
;// y_velocity_l=a; sta Y_VELOCITY_L
;// a=y_velocity_h; lda Y_VELOCITY_H
;// adc(0); adc #0
;// y_velocity_h=a; sta Y_VELOCITY_H
; sadd16(&y_velocity_h,&y_velocity_l,0x00,0x20);
; /* if we went higher, adjust peak */ ; if we went higher, adjust peak
; if (ypos_h<peak) peak=ypos_h; lda YPOS_H
cmp PEAK
bmi no_peak
sta PEAK
no_peak:
; /* check if out of bounds and stop moving */ ;========================================
; if (xpos_l<=margin) { ; Check if out of bounds and stop moving
; cs=max_steps; // too far left ;========================================
; }
; if (xpos_l>=(xsize-margin)) { lda XPOS_L ; if (xpos_l<=margin) too far left
; cs=max_steps; // too far right cmp #MARGIN
; } bcc done_moving
; if (ypos_h<=margin) { ; Due to 256 wraparound, the above will catch this case???
; cs=max_steps; // too far up ; cmp #XSIZE-MARGIN ; if (xpos_l>=(xsize-margin)) too far right
; } ; bcs done_moving
lda YPOS_H ; if (ypos_h<=margin) too far up
cmp #MARGIN
bcc done_moving
; // if falling downward ;======================
; if (y_velocity_h>0) { ; if falling downward
; // if too close to ground, explode ;======================
; if (ypos_h>=ysize-margin) { lda Y_VELOCITY_H
; cs=max_steps; bmi going_up ; if (y_velocity_h>0)
; }
; // if fallen a bit past peak, explode
; if (ypos_h>ysize-(ysize-peak)/2) {
; cs=max_steps;
; }
; }
; if too close to ground, explode
lda YPOS_H ; if (ypos_h>=ysize-margin)
cmp #(YSIZE-MARGIN)
bcs done_moving
; if fallen a bit past peak, explode
sec ; if (ypos_h>ysize-(ysize-peak)/2)
lda #YSIZE
sbc PEAK
asl
eor #$FF
clc
adc #1
clc
adc #YSIZE
cmp YPOS_H
bcs done_moving
going_up:
jmp done_bounds_checking
done_moving:
lda MAX_STEPS
sta CURRENT_STEP
done_bounds_checking:
;========================== ;==========================
; if not done, draw rocket ; if not done, draw rocket