From f99a73a2b850f0275848e693243955ae9cfbec29 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 21 Dec 2017 21:56:57 -0500 Subject: [PATCH] mode7: have both checkerboard and island running out of same code --- mode7_demo/mode7.s | 28 +++++++++++++++++++--------- mode7_demo/mode7_demo.dsk | Bin 143360 -> 143360 bytes mode7_demo/mode7_demo.s | 33 +++++++++++++++++++++++++++++++++ mode7_demo/zp.inc | 1 + 4 files changed, 53 insertions(+), 9 deletions(-) diff --git a/mode7_demo/mode7.s b/mode7_demo/mode7.s index 0b9be779..cd9fa560 100644 --- a/mode7_demo/mode7.s +++ b/mode7_demo/mode7.s @@ -56,9 +56,6 @@ mode7_flying: sta KEY_COUNT sta KEY_OFFSET - lda #1 ; slightly off North for better view of island - sta ANGLE - lda #2 ; initialize sky both pages sta DRAW_SKY @@ -163,6 +160,9 @@ turn_left: dec ANGLE + inc DRAW_SKY + inc DRAW_SKY + check_right: cmp #('D') bne check_speedup @@ -183,6 +183,8 @@ turn_right: sta TURNING inc ANGLE + inc DRAW_SKY + inc DRAW_SKY check_speedup: cmp #('Z') @@ -552,17 +554,23 @@ draw_background_mode7: ;============== ; 6 -.if .def(CHECKERBOARD_MAP) - lda #0 + dec DRAW_SKY ; usually 2 as we redraw both pages ; 5 + + + lda DRAW_BLUE_SKY + bne draw_blue_sky + +draw_black_sky: sta CV jsr scroll_background + jmp no_draw_sky -.else +draw_blue_sky: ; Draw Sky ; not performance critical as this happens rarely - dec DRAW_SKY ; usually 2 as we redraw both pages ; 5 + lda #COLOR_BOTH_MEDIUMBLUE ; MEDIUMBLUE color ; 2 sta COLOR ; 3 lda #0 ; 2 @@ -594,7 +602,7 @@ sky_loop: ; draw line across screen ;=========== ; 63+(X*16)+14 -.endif + no_draw_sky: @@ -913,9 +921,11 @@ screenx_loop: nomatch: +; This is self modified a few times +; jsr lookup_checkerboard_map +; jmp match ; Get color to draw in A .include "island_lookup.s" -; .include "checkerboard_lookup.s" match: diff --git a/mode7_dem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vs>%vq_9 zOyjpB`lT))mM*YD3NSJ&C(dJYDkNvV{2M&RsF2+x5_9EXMoS#-iz|7B^jGsff z4)AvH!Nkumc{b&T_preQ?Z{6_&K&ADm}~IElWlhK$Hn=X zi2Phd`N2#JKi4vTrUE}0v+#4H!OuL#&uyHa-4&#U@pEyOpU>!}zucUdIfwFdBl0uP z%uh{TelFzvRG9f$L-~1-@&nT(Se)8o@N*yMhj4y2a(*7M@N-b-=e=alKE}_FWHL_1 z`z&fvnb9&CPjA4e$7vI+TFv6CRrk(37A^`u1p^P2S;+3J7`XanBJ9;G!hvMZ>#QPNLYD&QYBW@Y%jiC_Y+TF73Hzt)jJHSxxvN5TS?!7qJjR z3KDi?^;3ZtrQ6Uk#Od@54y+Nz;(D2%Cq5=)DWsGn6RD&YAW*O>bAdO@Fuz1RpqK=u zBTM+BVCyFk8^z?tPaLO&6ln<(C6k`?WgtUoN7e=fwn|oYZOz`;Q7S2FiApp9Au;mE zr+`9or(JVrOU$nl3zesQ6}SuE3asipDNb(u!f_QTu3{yWRHPE6lujVoadY(J{5FL( z9civ(Ewt366Rj1f;gm&r2BYjRrk^L-J=eZQ^uzfnOy{TAyY!7_3+eN>cq9FK7i-0z zw(mK8ujH303LDf&8mgMe$^CvSgKiz5?kuZUG^=kzGlM2T(}k?r0|O3S1DPX-!LiJA z?nCDk96&gLgRYDJamahHpTWNSEB6u#a45RR(JMR{n!SE)W~&E%*mKs`x(}fBUJrJ) z-mM%|?serdI6~(^Rd}xM6qs{8&$)1jqeTx^+>@@r3OHm<>Ol=0YOd>J;#NbrTrXbb Zn}ibv3>s!Ulookup_checkerboard_map + sta nomatch+2 + lda #$4c + sta nomatch+3 + lda #match + sta nomatch+5 + jsr mode7_flying rts @@ -48,6 +65,22 @@ checkerboard_demo: island_demo: ; initialize + lda #1 + sta DRAW_BLUE_SKY + + lda #$A5 ; fix the code that was self-modified + sta nomatch ; away in checkerboard code + lda #$6A + sta nomatch+1 + lda #$8D + sta nomatch+2 + lda #<(spacex_label+1) + sta nomatch+3 + lda #>(spacex_label+1) + sta nomatch+4 + lda #$29 + sta nomatch+5 + jsr mode7_flying rts diff --git a/mode7_demo/zp.inc b/mode7_demo/zp.inc index d82038e4..0ef1742f 100644 --- a/mode7_demo/zp.inc +++ b/mode7_demo/zp.inc @@ -97,6 +97,7 @@ DRAW_SKY EQU $8A COLOR_MASK EQU $8B KEY_COUNT EQU $8C KEY_OFFSET EQU $8D +DRAW_BLUE_SKY EQU $8E SHIPY EQU $E4