mode7: have both checkerboard and island running out of same code

This commit is contained in:
Vince Weaver 2017-12-21 21:56:57 -05:00
parent 31a4e2b107
commit f99a73a2b8
4 changed files with 53 additions and 9 deletions

View File

@ -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:

Binary file not shown.

View File

@ -37,6 +37,23 @@ checkerboard_demo:
sta INL
jsr decompress_scroll
lda #0
sta DRAW_BLUE_SKY
lda #$20
sta nomatch
lda #<lookup_checkerboard_map
sta nomatch+1
lda #>lookup_checkerboard_map
sta nomatch+2
lda #$4c
sta nomatch+3
lda #<match
sta nomatch+4
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

View File

@ -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