keen: add support for partial blocks

This commit is contained in:
Vince Weaver 2024-03-14 01:21:45 -04:00
parent 6460d12c25
commit 1866d19a53
5 changed files with 27 additions and 22 deletions

View File

@ -15,9 +15,15 @@ Memory map:
tiles are 2x4, or 4 bytes each
so in theory can have up to 256 of them
in 16x16 grid
but if we want data to fit in one page then 64 it the maximum
tilemap:
tilemap is 256 wide by 40 tall = 10k
Tiles:
hard tiles start at 32
Tile types:
0..26 transparent tiles
27..31 items
32..39 walkthrough tiles
40..63 hard tiles

View File

@ -25,7 +25,9 @@ tilemap_outer_loop:
sta GBASH
ldy #0 ; draw row from 0..40
ldy #0 ; draw row from 0..39
; might be faster to count backwards
; but would have to adjust a lot
tilemap_loop:
ldx TILEMAP_OFFSET ; get actual tile number
@ -58,7 +60,7 @@ not_odd_line:
cpy #40 ; until done
bne tilemap_loop
; FIXME: countdown instead?
; row is done, move to next line
@ -103,18 +105,14 @@ done_move_to_line:
;===================================
; copy tilemap
;===================================
; want to copy a 16x10 area from global tileset to local
; originally 16x10 16x10 = 160 bytes
; extend to 20x12 for full screen? 20x12 = 240 bytes
; local tilemap subset is 20x12 tiles = 240 bytes
; nicely fits in one page
;
; big tilemap is 256*40
; so each row is a page
; TILEMAP_X, TILEMAP_Y specify where in big
; copy to tilemap
TILEMAP_X_COPY_SIZE = 20
TILEMAP_Y_COPY_SIZE = 12

View File

@ -38,7 +38,7 @@ laser_check_tiles:
ldx LASER_TILE
lda tilemap,X
cmp #HARD_TILES
cmp #ALLHARD_TILES
bcs destroy_laser

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@ -2,7 +2,8 @@ KEEN_SPEED = $80
YDEFAULT = 20
HARD_TILES = 32 ; start at 32
HARDTOP_TILES = 32 ; start at 32
ALLHARD_TILES = 40 ; start at 40
TILE_COLS = 20
@ -133,8 +134,8 @@ keen_check_head:
lda tilemap,X
; if tile# < HARD_TILES then we are fine
cmp #HARD_TILES
; if tile# < ALLHARD_TILES then we are fine
cmp #ALLHARD_TILES
bcc collide_left_right ; blt
lda #0
@ -162,8 +163,8 @@ check_right_collide:
tax
lda tilemap,X
; if tile# < HARD_TILES then we are fine
cmp #HARD_TILES
; if tile# < ALLHARD_TILES then we are fine
cmp #ALLHARD_TILES
bcc done_keen_collide ; blt
lda #1 ;
@ -179,8 +180,8 @@ check_left_collide:
tax
lda tilemap,X
; if tile# < HARD_TILES then we are fine
cmp #HARD_TILES
; if tile# < ALLHARD_TILES then we are fine
cmp #ALLHARD_TILES
bcc done_keen_collide ; blt
lda #1
@ -328,8 +329,8 @@ check_falling:
tax
lda tilemap,X
; if tile# < HARD_TILES then we fall
cmp #HARD_TILES
; if tile# < HARDTOP_TILES then we fall
cmp #HARDTOP_TILES
bcs feet_on_ground ; bge
;=======================