keen: working on making it full screen
This commit is contained in:
parent
bff5f6c13b
commit
eef30bc258
|
@ -8,3 +8,26 @@ $9400 -- global tilemap
|
||||||
$BC00 -- local tilemap subset
|
$BC00 -- local tilemap subset
|
||||||
$BD00 -- unused
|
$BD00 -- unused
|
||||||
$C000 -- ROM
|
$C000 -- ROM
|
||||||
|
|
||||||
|
|
||||||
|
Memory map:
|
||||||
|
$0000-$00ff = zero page
|
||||||
|
$0100-$01ff = stack
|
||||||
|
$0200-$03ff = ???
|
||||||
|
$0400-$07ff = lo-res page1
|
||||||
|
$0800-$0bff = lo-res page2
|
||||||
|
$0c00-$0fff = background image
|
||||||
|
$1000-$1fff = loader
|
||||||
|
$2000-????? = code
|
||||||
|
$9000-$93ff = tiles (1k)
|
||||||
|
$9400-????? = big_tilemap (10k)
|
||||||
|
$BC00-????? = tilemap (1k) 10x16
|
||||||
|
|
||||||
|
tiles are 2x4, or 4 bytes each
|
||||||
|
so in theory can have up to 256 of them
|
||||||
|
in 16x16 grid
|
||||||
|
tilemap is 256 wide by 40 tall = 10k
|
||||||
|
|
||||||
|
Tiles:
|
||||||
|
hard tiles start at 32
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
|
||||||
|
Memory map:
|
||||||
|
$0000-$00ff = zero page
|
||||||
|
$0100-$01ff = stack
|
||||||
|
$0200-$03ff = ???
|
||||||
|
$0400-$07ff = lo-res page1
|
||||||
|
$0800-$0bff = lo-res page2
|
||||||
|
$0c00-$0fff = background image
|
||||||
|
$1000-$1fff = loader
|
||||||
|
$2000-????? = code
|
||||||
|
$9000-$93ff = tiles (1k)
|
||||||
|
$9400-????? = big_tilemap (10k)
|
||||||
|
$BC00-????? = tilemap (1k) 10x16
|
||||||
|
|
||||||
|
tiles are 2x4, or 4 bytes each
|
||||||
|
so in theory can have up to 256 of them
|
||||||
|
in 16x16 grid
|
||||||
|
tilemap is 256 wide by 40 tall = 10k
|
||||||
|
|
||||||
|
Tiles:
|
||||||
|
hard tiles start at 32
|
||||||
|
|
|
@ -58,7 +58,7 @@ no_red_key:
|
||||||
; there has to be a more efficient way of doing this
|
; there has to be a more efficient way of doing this
|
||||||
open_the_wall:
|
open_the_wall:
|
||||||
; reset smc
|
; reset smc
|
||||||
lda #>BIG_TILEMAP
|
lda #>big_tilemap
|
||||||
sta rwr_smc1+2
|
sta rwr_smc1+2
|
||||||
sta rwr_smc2+2
|
sta rwr_smc2+2
|
||||||
|
|
||||||
|
@ -66,12 +66,12 @@ remove_red_wall_outer:
|
||||||
ldx #0
|
ldx #0
|
||||||
remove_red_wall_loop:
|
remove_red_wall_loop:
|
||||||
rwr_smc1:
|
rwr_smc1:
|
||||||
lda BIG_TILEMAP,X
|
lda big_tilemap,X
|
||||||
cmp #49 ; red key tile
|
cmp #49 ; red key tile
|
||||||
bne not_red_tile
|
bne not_red_tile
|
||||||
lda #2 ; lblue bg tile
|
lda #2 ; lblue bg tile
|
||||||
rwr_smc2:
|
rwr_smc2:
|
||||||
sta BIG_TILEMAP,X
|
sta big_tilemap,X
|
||||||
not_red_tile:
|
not_red_tile:
|
||||||
inx
|
inx
|
||||||
bne remove_red_wall_loop
|
bne remove_red_wall_loop
|
||||||
|
@ -80,7 +80,7 @@ not_red_tile:
|
||||||
inc rwr_smc2+2
|
inc rwr_smc2+2
|
||||||
|
|
||||||
lda rwr_smc1+2
|
lda rwr_smc1+2
|
||||||
cmp #(>BIG_TILEMAP)+40
|
cmp #(>big_tilemap)+40
|
||||||
bne remove_red_wall_outer
|
bne remove_red_wall_outer
|
||||||
|
|
||||||
; refresh local tilemap
|
; refresh local tilemap
|
||||||
|
|
|
@ -4,7 +4,7 @@ LOAD_KEEN1 = 2
|
||||||
LOAD_KEEN2 = 3
|
LOAD_KEEN2 = 3
|
||||||
|
|
||||||
|
|
||||||
TILES = $9000
|
tiles = $9000
|
||||||
BIG_TILEMAP = $9400
|
big_tilemap = $9400
|
||||||
TILEMAP = $BC00
|
tilemap = $BC00
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
; draw local tilemap to screen
|
; draw local tilemap to screen
|
||||||
;================================
|
;================================
|
||||||
|
|
||||||
|
; tilemap is 20x12 grid with 2x4 (well, 2x2) tiles
|
||||||
|
|
||||||
draw_tilemap:
|
draw_tilemap:
|
||||||
ldy #0 ; Y on screen currently drawing
|
ldy #0 ; Y on screen currently drawing
|
||||||
sty tiley ; we draw two at a time
|
sty tiley ; we draw two at a time
|
||||||
|
@ -13,7 +15,7 @@ draw_tilemap:
|
||||||
sta tile_odd
|
sta tile_odd
|
||||||
|
|
||||||
tilemap_outer_loop:
|
tilemap_outer_loop:
|
||||||
ldy tiley ; setup pointer to current Y
|
ldy tiley ; setup output pointer to current Y
|
||||||
lda gr_offsets,Y
|
lda gr_offsets,Y
|
||||||
sta GBASL
|
sta GBASL
|
||||||
lda gr_offsets+1,Y
|
lda gr_offsets+1,Y
|
||||||
|
@ -21,10 +23,12 @@ tilemap_outer_loop:
|
||||||
adc DRAW_PAGE
|
adc DRAW_PAGE
|
||||||
sta GBASH
|
sta GBASH
|
||||||
|
|
||||||
ldy #6 ; we draw in window 6->34
|
|
||||||
|
ldy #0
|
||||||
|
; ldy #6 ; we draw in window 6->34
|
||||||
tilemap_loop:
|
tilemap_loop:
|
||||||
ldx tilemap_offset ; get actual tile
|
ldx tilemap_offset ; get actual tile
|
||||||
lda TILEMAP,X
|
lda tilemap,X
|
||||||
|
|
||||||
asl ; *4 ; get offset in tile
|
asl ; *4 ; get offset in tile
|
||||||
asl
|
asl
|
||||||
|
@ -36,14 +40,14 @@ tilemap_loop:
|
||||||
inx
|
inx
|
||||||
not_odd_line:
|
not_odd_line:
|
||||||
|
|
||||||
lda TILES,X ; draw two tiles
|
lda tiles,X ; draw two tiles
|
||||||
cmp #$AA ; transparency
|
cmp #$AA ; transparency
|
||||||
beq skip_tile1
|
beq skip_tile1
|
||||||
sta (GBASL),Y
|
sta (GBASL),Y
|
||||||
skip_tile1:
|
skip_tile1:
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda TILES+1,X
|
lda tiles+1,X
|
||||||
cmp #$AA
|
cmp #$AA
|
||||||
beq skip_tile2
|
beq skip_tile2
|
||||||
sta (GBASL),Y
|
sta (GBASL),Y
|
||||||
|
@ -52,7 +56,8 @@ skip_tile2:
|
||||||
|
|
||||||
inc tilemap_offset
|
inc tilemap_offset
|
||||||
|
|
||||||
cpy #34 ; until done
|
cpy #40 ; until done
|
||||||
|
; cpy #34 ; until done
|
||||||
bne tilemap_loop
|
bne tilemap_loop
|
||||||
|
|
||||||
; move to next line
|
; move to next line
|
||||||
|
@ -61,6 +66,7 @@ skip_tile2:
|
||||||
sta tile_odd
|
sta tile_odd
|
||||||
bne move_to_odd_line
|
bne move_to_odd_line
|
||||||
|
|
||||||
|
; ????
|
||||||
move_to_even_line:
|
move_to_even_line:
|
||||||
lda tilemap_offset
|
lda tilemap_offset
|
||||||
clc
|
clc
|
||||||
|
@ -75,12 +81,13 @@ move_to_odd_line:
|
||||||
done_move_to_line:
|
done_move_to_line:
|
||||||
sta tilemap_offset
|
sta tilemap_offset
|
||||||
|
|
||||||
ldy tiley ; move to next line
|
ldy tiley ; move to next output line
|
||||||
iny
|
iny
|
||||||
iny
|
iny
|
||||||
sty tiley
|
sty tiley
|
||||||
|
|
||||||
cpy #40 ; check if at end
|
cpy #48 ; check if at end
|
||||||
|
; cpy #40 ; check if at end
|
||||||
bne tilemap_outer_loop
|
bne tilemap_outer_loop
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
@ -96,21 +103,33 @@ tiley: .byte $00
|
||||||
;===================================
|
;===================================
|
||||||
; want to copy a 16x10 area from global tileset to local
|
; want to copy a 16x10 area from global tileset to local
|
||||||
|
|
||||||
; default at first we want to start at 128,88
|
; originally 16x10 16x10 = 160 bytes
|
||||||
; which is 13, 20???
|
; extend to 20x12 for full screen? 20x12 = 240 bytes
|
||||||
|
|
||||||
|
; 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
|
||||||
|
|
||||||
copy_tilemap_subset:
|
copy_tilemap_subset:
|
||||||
|
|
||||||
; set start
|
; set start
|
||||||
lda TILEMAP_Y
|
lda TILEMAP_Y
|
||||||
clc
|
clc ; set start
|
||||||
adc #>BIG_TILEMAP
|
adc #>big_tilemap ; each row is a page, so adding
|
||||||
|
; Y to top byte is indexing to row
|
||||||
|
|
||||||
sta cptl1_smc+2 ; set proper row in big tilemap
|
sta cptl1_smc+2 ; set proper row in big tilemap
|
||||||
adc #$10
|
adc #TILEMAP_Y_COPY_SIZE
|
||||||
sta cptl3_smc+1 ; set loop limit
|
sta cptl3_smc+1 ; set loop limit (end)
|
||||||
|
|
||||||
; reset row
|
; reset row
|
||||||
lda #<TILEMAP
|
lda #<tilemap
|
||||||
sta cptl2_smc+1 ; set small tilemap to row0
|
sta cptl2_smc+1 ; set small tilemap to row0
|
||||||
|
|
||||||
cp_tilemap_outer_loop:
|
cp_tilemap_outer_loop:
|
||||||
|
@ -125,19 +144,19 @@ cptl2_smc:
|
||||||
sta $BC00,Y
|
sta $BC00,Y
|
||||||
iny
|
iny
|
||||||
inx
|
inx
|
||||||
cpy #16
|
cpy #TILEMAP_X_COPY_SIZE
|
||||||
bne cp_tilemap_inner_loop
|
bne cp_tilemap_inner_loop
|
||||||
|
|
||||||
; next line
|
; next line
|
||||||
inc cptl1_smc+2 ; incremement page
|
inc cptl1_smc+2 ; incremement page
|
||||||
clc
|
clc
|
||||||
lda cptl2_smc+1 ; increment row
|
lda cptl2_smc+1 ; increment row
|
||||||
adc #$10
|
adc #TILEMAP_X_COPY_SIZE
|
||||||
sta cptl2_smc+1
|
sta cptl2_smc+1
|
||||||
|
|
||||||
lda cptl1_smc+2
|
lda cptl1_smc+2
|
||||||
cptl3_smc:
|
cptl3_smc:
|
||||||
cmp #$a
|
cmp #TILEMAP_Y_COPY_SIZE
|
||||||
bne cp_tilemap_outer_loop
|
bne cp_tilemap_outer_loop
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
|
@ -37,7 +37,7 @@ laser_check_tiles:
|
||||||
sta LASER_TILE
|
sta LASER_TILE
|
||||||
|
|
||||||
ldx LASER_TILE
|
ldx LASER_TILE
|
||||||
lda TILEMAP,X
|
lda tilemap,X
|
||||||
cmp #HARD_TILES
|
cmp #HARD_TILES
|
||||||
bcs destroy_laser
|
bcs destroy_laser
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ check_item:
|
||||||
|
|
||||||
|
|
||||||
check_red_key:
|
check_red_key:
|
||||||
lda TILEMAP,X
|
lda tilemap,X
|
||||||
cmp #31 ; red key
|
cmp #31 ; red key
|
||||||
bne check_blue_key
|
bne check_blue_key
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ keen_start:
|
||||||
bit SET_GR
|
bit SET_GR
|
||||||
bit PAGE0
|
bit PAGE0
|
||||||
bit LORES
|
bit LORES
|
||||||
bit TEXTGR
|
bit FULLGR
|
||||||
|
|
||||||
jsr clear_top ; avoid grey stripes at load
|
jsr clear_top ; avoid grey stripes at load
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ keen_start:
|
||||||
lda #1
|
lda #1
|
||||||
sta FIREPOWER
|
sta FIREPOWER
|
||||||
|
|
||||||
lda #2 ; draw twice (both pages)
|
; lda #2 ; draw twice (both pages)
|
||||||
sta UPDATE_STATUS
|
; sta UPDATE_STATUS
|
||||||
|
|
||||||
lda #7
|
lda #7
|
||||||
sta HEALTH
|
sta HEALTH
|
||||||
|
@ -78,7 +78,7 @@ keen_start:
|
||||||
sta KEEN_DIRECTION
|
sta KEEN_DIRECTION
|
||||||
|
|
||||||
|
|
||||||
jsr update_status_bar
|
; jsr update_status_bar
|
||||||
|
|
||||||
;====================================
|
;====================================
|
||||||
; load level1 background
|
; load level1 background
|
||||||
|
@ -108,6 +108,12 @@ keen_start:
|
||||||
;====================================
|
;====================================
|
||||||
; copy in tilemap subset
|
; copy in tilemap subset
|
||||||
;====================================
|
;====================================
|
||||||
|
; copies local 16x10 tilemap to $bc00
|
||||||
|
; we start out assuming position is 28,0
|
||||||
|
|
||||||
|
; note 16x10 is 32*40
|
||||||
|
; if we want full screen it should be 40x48 = 20x12
|
||||||
|
|
||||||
lda #28
|
lda #28
|
||||||
sta TILEMAP_X
|
sta TILEMAP_X
|
||||||
lda #0
|
lda #0
|
||||||
|
@ -117,7 +123,7 @@ keen_start:
|
||||||
|
|
||||||
;====================================
|
;====================================
|
||||||
;====================================
|
;====================================
|
||||||
; Main LOGO loop
|
; Main loop
|
||||||
;====================================
|
;====================================
|
||||||
;====================================
|
;====================================
|
||||||
|
|
||||||
|
@ -125,7 +131,7 @@ keen_loop:
|
||||||
|
|
||||||
; copy over background
|
; copy over background
|
||||||
|
|
||||||
jsr gr_copy_to_current
|
; jsr gr_copy_to_current
|
||||||
|
|
||||||
; draw tilemap
|
; draw tilemap
|
||||||
|
|
||||||
|
@ -145,11 +151,11 @@ keen_loop:
|
||||||
|
|
||||||
; handle door opening
|
; handle door opening
|
||||||
|
|
||||||
jsr check_open_door
|
; jsr check_open_door
|
||||||
|
|
||||||
; draw a status bar
|
; draw a status bar
|
||||||
|
|
||||||
jsr draw_status_bar
|
; jsr draw_status_bar
|
||||||
|
|
||||||
jsr page_flip
|
jsr page_flip
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ keen_check_head:
|
||||||
sbc #16 ; above head is -2 rows
|
sbc #16 ; above head is -2 rows
|
||||||
tax
|
tax
|
||||||
|
|
||||||
lda TILEMAP,X
|
lda tilemap,X
|
||||||
|
|
||||||
; if tile# < HARD_TILES then we are fine
|
; if tile# < HARD_TILES then we are fine
|
||||||
cmp #HARD_TILES
|
cmp #HARD_TILES
|
||||||
|
@ -158,7 +158,7 @@ check_right_collide:
|
||||||
adc #1 ; right is one to right
|
adc #1 ; right is one to right
|
||||||
|
|
||||||
tax
|
tax
|
||||||
lda TILEMAP,X
|
lda tilemap,X
|
||||||
|
|
||||||
; if tile# < HARD_TILES then we are fine
|
; if tile# < HARD_TILES then we are fine
|
||||||
cmp #HARD_TILES
|
cmp #HARD_TILES
|
||||||
|
@ -175,7 +175,7 @@ check_left_collide:
|
||||||
sbc #2 ; left is one to left
|
sbc #2 ; left is one to left
|
||||||
; +1 fudge factor
|
; +1 fudge factor
|
||||||
tax
|
tax
|
||||||
lda TILEMAP,X
|
lda tilemap,X
|
||||||
|
|
||||||
; if tile# < HARD_TILES then we are fine
|
; if tile# < HARD_TILES then we are fine
|
||||||
cmp #HARD_TILES
|
cmp #HARD_TILES
|
||||||
|
@ -322,7 +322,7 @@ check_falling:
|
||||||
adc #16 ; underfoot is on next row (+16)
|
adc #16 ; underfoot is on next row (+16)
|
||||||
|
|
||||||
tax
|
tax
|
||||||
lda TILEMAP,X
|
lda tilemap,X
|
||||||
|
|
||||||
; if tile# < HARD_TILES then we fall
|
; if tile# < HARD_TILES then we fall
|
||||||
cmp #HARD_TILES
|
cmp #HARD_TILES
|
||||||
|
|
Loading…
Reference in New Issue