mode7: working on checkerboard

This commit is contained in:
Vince Weaver 2017-12-12 15:39:32 -05:00
parent 29eea6a627
commit df4be961d2
3 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,17 @@
;====================
; lookup_map
;====================
; finds value in space_x.i,space_y.i
; returns color in A
; CLOBBERS: A,Y
lda SPACEX_I ; 3
sta spacex_label+1 ; self modifying code, LAST_SPACEX_I ; 4
lda SPACEY_I ; 3
sta spacey_label+1 ; self modifying code, LAST_SPACEY_I ; 4
lda #$11 ; always red
sta map_color_label+1 ; self-modifying

Binary file not shown.

View File

@ -1,3 +1,6 @@
ISLAND_MAP = 0
CHECKERBOARD_MAP = 1
.include "zp.inc" .include "zp.inc"
;=========== ;===========
@ -963,7 +966,11 @@ screenx_loop:
nomatch: nomatch:
; Get color to draw in A ; Get color to draw in A
.if ISLAND_MAP=1
.include "island_lookup.s" .include "island_lookup.s"
.elseif CHECKERBOARD_MAP=1
.include "checkerboard_lookup.s"
.endif
match: match:
@ -1055,7 +1062,13 @@ done_screeny:
; 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 ; the high-performance per-pixel version has been inlined
lookup_map: lookup_map:
.if ISLAND_MAP=1
.include "island_lookup.s" .include "island_lookup.s"
.elseif CHECKERBOARD_MAP=1
.include "checkerboard_lookup.s"
.endif
rts ; 6 rts ; 6
;===================== ;=====================
@ -1091,14 +1104,16 @@ exit:
;=============================================== ;===============================================
; waste memory with a lookup table ; waste memory with a lookup table
; maybe faster than using GBASCALC? ; move this to the zeropage?
gr_offsets: gr_offsets:
.word $400,$480,$500,$580,$600,$680,$700,$780 .word $400,$480,$500,$580,$600,$680,$700,$780
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8 .word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0 .word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0
.if ISLAND_MAP=1
.include "island_map.inc" .include "island_map.inc"
.endif
.include "fast_multiply.s" .include "fast_multiply.s"