megademo: mode7: more minor cleanups

This commit is contained in:
Vince Weaver 2018-10-17 14:13:10 -04:00
parent b18ce38a6e
commit e510dc388c

View File

@ -947,7 +947,7 @@ screenx_loop:
nomatch: nomatch:
; Get color to draw in A ; Get color to draw in A
jsr island_lookup jsr lookup_island_map
match: match:
mask_label: mask_label:
@ -1036,19 +1036,7 @@ done_screeny:
; returns color in A ; returns color in A
; CLOBBERS: A,Y ; CLOBBERS: A,Y
; this is used to check if above water or grass ; this is used to check if above water or grass
; the high-performance per-pixel version has been inlined
lookup_island_map: lookup_island_map:
; rts ; 6
;====================
; lookup_map
;====================
; finds value in space_x.i,space_y.i
; returns color in A
; CLOBBERS: A,Y
island_lookup:
lda SPACEX_I ; 3 lda SPACEX_I ; 3
sta spacex_label+1 ; self modifying code, LAST_SPACEX_I ; 4 sta spacex_label+1 ; self modifying code, LAST_SPACEX_I ; 4
and #CONST_MAP_MASK_X ; wrap at 64 ; 2 and #CONST_MAP_MASK_X ; wrap at 64 ; 2
@ -1072,28 +1060,28 @@ island_lookup:
;============ ;============
; 39 ; 39
bcs @ocean_color ; bgt 8 ; 2nt/3 bcs ocean_color ; bgt 8 ; 2nt/3
ldy SPACEY_I ; 3 ldy SPACEY_I ; 3
cpy #$8 ; 2 cpy #$8 ; 2
;============= ;=============
; 7 ; 7
bcs @ocean_color ; bgt 8 ; 2nt/3 bcs ocean_color ; bgt 8 ; 2nt/3
tay ; 2 tay ; 2
lda flying_map,Y ; load from array ; 4 lda flying_map,Y ; load from array ; 4
bcc @update_cache ; 3 bcc update_cache ; 3
;============ ;============
; 11 ; 11
@ocean_color: ocean_color:
and #$1f ; 2 and #$1f ; 2
tay ; 2 tay ; 2
lda water_map,Y ; the color of the sea ; 4 lda water_map,Y ; the color of the sea ; 4
;=========== ;===========
; 8 ; 8
@update_cache: update_cache:
sta map_color_label+1 ; self-modifying ; 4 sta map_color_label+1 ; self-modifying ; 4
;=========== ;===========
@ -1135,6 +1123,7 @@ water_map:
.byte $22,$22,$22,$22, $22,$22,$22,$22 .byte $22,$22,$22,$22, $22,$22,$22,$22
.byte $22,$22,$22,$22, $ee,$22,$22,$22 .byte $22,$22,$22,$22, $ee,$22,$22,$22
.include "starry_sky.scroll" .include "starry_sky.scroll"
.include "multiply_fast.s" .include "multiply_fast.s"