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 tiles are 2x4, or 4 bytes each
so in theory can have up to 256 of them 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 tilemap is 256 wide by 40 tall = 10k
Tiles: Tile types:
hard tiles start at 32 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 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: tilemap_loop:
ldx TILEMAP_OFFSET ; get actual tile number ldx TILEMAP_OFFSET ; get actual tile number
@ -58,7 +60,7 @@ not_odd_line:
cpy #40 ; until done cpy #40 ; until done
bne tilemap_loop bne tilemap_loop
; FIXME: countdown instead?
; row is done, move to next line ; row is done, move to next line
@ -103,18 +105,14 @@ done_move_to_line:
;=================================== ;===================================
; copy tilemap ; copy tilemap
;=================================== ;===================================
; want to copy a 16x10 area from global tileset to local ; local tilemap subset is 20x12 tiles = 240 bytes
; nicely fits in one page
; originally 16x10 16x10 = 160 bytes ;
; extend to 20x12 for full screen? 20x12 = 240 bytes
; big tilemap is 256*40 ; big tilemap is 256*40
; so each row is a page ; so each row is a page
; TILEMAP_X, TILEMAP_Y specify where in big ; TILEMAP_X, TILEMAP_Y specify where in big
; copy to tilemap
TILEMAP_X_COPY_SIZE = 20 TILEMAP_X_COPY_SIZE = 20
TILEMAP_Y_COPY_SIZE = 12 TILEMAP_Y_COPY_SIZE = 12

View File

@ -38,7 +38,7 @@ laser_check_tiles:
ldx LASER_TILE ldx LASER_TILE
lda tilemap,X lda tilemap,X
cmp #HARD_TILES cmp #ALLHARD_TILES
bcs destroy_laser 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 YDEFAULT = 20
HARD_TILES = 32 ; start at 32 HARDTOP_TILES = 32 ; start at 32
ALLHARD_TILES = 40 ; start at 40
TILE_COLS = 20 TILE_COLS = 20
@ -133,8 +134,8 @@ keen_check_head:
lda tilemap,X lda tilemap,X
; if tile# < HARD_TILES then we are fine ; if tile# < ALLHARD_TILES then we are fine
cmp #HARD_TILES cmp #ALLHARD_TILES
bcc collide_left_right ; blt bcc collide_left_right ; blt
lda #0 lda #0
@ -162,8 +163,8 @@ check_right_collide:
tax tax
lda tilemap,X lda tilemap,X
; if tile# < HARD_TILES then we are fine ; if tile# < ALLHARD_TILES then we are fine
cmp #HARD_TILES cmp #ALLHARD_TILES
bcc done_keen_collide ; blt bcc done_keen_collide ; blt
lda #1 ; lda #1 ;
@ -179,8 +180,8 @@ check_left_collide:
tax tax
lda tilemap,X lda tilemap,X
; if tile# < HARD_TILES then we are fine ; if tile# < ALLHARD_TILES then we are fine
cmp #HARD_TILES cmp #ALLHARD_TILES
bcc done_keen_collide ; blt bcc done_keen_collide ; blt
lda #1 lda #1
@ -328,8 +329,8 @@ check_falling:
tax tax
lda tilemap,X lda tilemap,X
; if tile# < HARD_TILES then we fall ; if tile# < HARDTOP_TILES then we fall
cmp #HARD_TILES cmp #HARDTOP_TILES
bcs feet_on_ground ; bge bcs feet_on_ground ; bge
;======================= ;=======================