mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-13 22:30:49 +00:00
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
|
||||
$BD00 -- unused
|
||||
$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
|
||||
|
||||
|
23
games/keen/NOTES
Normal file
23
games/keen/NOTES
Normal file
@ -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
|
||||
open_the_wall:
|
||||
; reset smc
|
||||
lda #>BIG_TILEMAP
|
||||
lda #>big_tilemap
|
||||
sta rwr_smc1+2
|
||||
sta rwr_smc2+2
|
||||
|
||||
@ -66,12 +66,12 @@ remove_red_wall_outer:
|
||||
ldx #0
|
||||
remove_red_wall_loop:
|
||||
rwr_smc1:
|
||||
lda BIG_TILEMAP,X
|
||||
lda big_tilemap,X
|
||||
cmp #49 ; red key tile
|
||||
bne not_red_tile
|
||||
lda #2 ; lblue bg tile
|
||||
rwr_smc2:
|
||||
sta BIG_TILEMAP,X
|
||||
sta big_tilemap,X
|
||||
not_red_tile:
|
||||
inx
|
||||
bne remove_red_wall_loop
|
||||
@ -80,7 +80,7 @@ not_red_tile:
|
||||
inc rwr_smc2+2
|
||||
|
||||
lda rwr_smc1+2
|
||||
cmp #(>BIG_TILEMAP)+40
|
||||
cmp #(>big_tilemap)+40
|
||||
bne remove_red_wall_outer
|
||||
|
||||
; refresh local tilemap
|
||||
|
@ -4,7 +4,7 @@ LOAD_KEEN1 = 2
|
||||
LOAD_KEEN2 = 3
|
||||
|
||||
|
||||
TILES = $9000
|
||||
BIG_TILEMAP = $9400
|
||||
TILEMAP = $BC00
|
||||
tiles = $9000
|
||||
big_tilemap = $9400
|
||||
tilemap = $BC00
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
; draw local tilemap to screen
|
||||
;================================
|
||||
|
||||
; tilemap is 20x12 grid with 2x4 (well, 2x2) tiles
|
||||
|
||||
draw_tilemap:
|
||||
ldy #0 ; Y on screen currently drawing
|
||||
sty tiley ; we draw two at a time
|
||||
@ -13,7 +15,7 @@ draw_tilemap:
|
||||
sta tile_odd
|
||||
|
||||
tilemap_outer_loop:
|
||||
ldy tiley ; setup pointer to current Y
|
||||
ldy tiley ; setup output pointer to current Y
|
||||
lda gr_offsets,Y
|
||||
sta GBASL
|
||||
lda gr_offsets+1,Y
|
||||
@ -21,10 +23,12 @@ tilemap_outer_loop:
|
||||
adc DRAW_PAGE
|
||||
sta GBASH
|
||||
|
||||
ldy #6 ; we draw in window 6->34
|
||||
|
||||
ldy #0
|
||||
; ldy #6 ; we draw in window 6->34
|
||||
tilemap_loop:
|
||||
ldx tilemap_offset ; get actual tile
|
||||
lda TILEMAP,X
|
||||
lda tilemap,X
|
||||
|
||||
asl ; *4 ; get offset in tile
|
||||
asl
|
||||
@ -36,14 +40,14 @@ tilemap_loop:
|
||||
inx
|
||||
not_odd_line:
|
||||
|
||||
lda TILES,X ; draw two tiles
|
||||
lda tiles,X ; draw two tiles
|
||||
cmp #$AA ; transparency
|
||||
beq skip_tile1
|
||||
sta (GBASL),Y
|
||||
skip_tile1:
|
||||
|
||||
iny
|
||||
lda TILES+1,X
|
||||
lda tiles+1,X
|
||||
cmp #$AA
|
||||
beq skip_tile2
|
||||
sta (GBASL),Y
|
||||
@ -52,7 +56,8 @@ skip_tile2:
|
||||
|
||||
inc tilemap_offset
|
||||
|
||||
cpy #34 ; until done
|
||||
cpy #40 ; until done
|
||||
; cpy #34 ; until done
|
||||
bne tilemap_loop
|
||||
|
||||
; move to next line
|
||||
@ -61,6 +66,7 @@ skip_tile2:
|
||||
sta tile_odd
|
||||
bne move_to_odd_line
|
||||
|
||||
; ????
|
||||
move_to_even_line:
|
||||
lda tilemap_offset
|
||||
clc
|
||||
@ -75,12 +81,13 @@ move_to_odd_line:
|
||||
done_move_to_line:
|
||||
sta tilemap_offset
|
||||
|
||||
ldy tiley ; move to next line
|
||||
ldy tiley ; move to next output line
|
||||
iny
|
||||
iny
|
||||
sty tiley
|
||||
|
||||
cpy #40 ; check if at end
|
||||
cpy #48 ; check if at end
|
||||
; cpy #40 ; check if at end
|
||||
bne tilemap_outer_loop
|
||||
|
||||
rts
|
||||
@ -96,21 +103,33 @@ tiley: .byte $00
|
||||
;===================================
|
||||
; want to copy a 16x10 area from global tileset to local
|
||||
|
||||
; default at first we want to start at 128,88
|
||||
; which is 13, 20???
|
||||
; originally 16x10 16x10 = 160 bytes
|
||||
; 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:
|
||||
|
||||
; set start
|
||||
lda TILEMAP_Y
|
||||
clc
|
||||
adc #>BIG_TILEMAP
|
||||
clc ; set start
|
||||
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
|
||||
adc #$10
|
||||
sta cptl3_smc+1 ; set loop limit
|
||||
adc #TILEMAP_Y_COPY_SIZE
|
||||
sta cptl3_smc+1 ; set loop limit (end)
|
||||
|
||||
; reset row
|
||||
lda #<TILEMAP
|
||||
lda #<tilemap
|
||||
sta cptl2_smc+1 ; set small tilemap to row0
|
||||
|
||||
cp_tilemap_outer_loop:
|
||||
@ -125,19 +144,19 @@ cptl2_smc:
|
||||
sta $BC00,Y
|
||||
iny
|
||||
inx
|
||||
cpy #16
|
||||
cpy #TILEMAP_X_COPY_SIZE
|
||||
bne cp_tilemap_inner_loop
|
||||
|
||||
; next line
|
||||
inc cptl1_smc+2 ; incremement page
|
||||
clc
|
||||
lda cptl2_smc+1 ; increment row
|
||||
adc #$10
|
||||
adc #TILEMAP_X_COPY_SIZE
|
||||
sta cptl2_smc+1
|
||||
|
||||
lda cptl1_smc+2
|
||||
cptl3_smc:
|
||||
cmp #$a
|
||||
cmp #TILEMAP_Y_COPY_SIZE
|
||||
bne cp_tilemap_outer_loop
|
||||
|
||||
rts
|
||||
|
@ -37,7 +37,7 @@ laser_check_tiles:
|
||||
sta LASER_TILE
|
||||
|
||||
ldx LASER_TILE
|
||||
lda TILEMAP,X
|
||||
lda tilemap,X
|
||||
cmp #HARD_TILES
|
||||
bcs destroy_laser
|
||||
|
||||
|
@ -7,7 +7,7 @@ check_item:
|
||||
|
||||
|
||||
check_red_key:
|
||||
lda TILEMAP,X
|
||||
lda tilemap,X
|
||||
cmp #31 ; red key
|
||||
bne check_blue_key
|
||||
|
||||
|
@ -17,7 +17,7 @@ keen_start:
|
||||
bit SET_GR
|
||||
bit PAGE0
|
||||
bit LORES
|
||||
bit TEXTGR
|
||||
bit FULLGR
|
||||
|
||||
jsr clear_top ; avoid grey stripes at load
|
||||
|
||||
@ -61,8 +61,8 @@ keen_start:
|
||||
lda #1
|
||||
sta FIREPOWER
|
||||
|
||||
lda #2 ; draw twice (both pages)
|
||||
sta UPDATE_STATUS
|
||||
; lda #2 ; draw twice (both pages)
|
||||
; sta UPDATE_STATUS
|
||||
|
||||
lda #7
|
||||
sta HEALTH
|
||||
@ -78,7 +78,7 @@ keen_start:
|
||||
sta KEEN_DIRECTION
|
||||
|
||||
|
||||
jsr update_status_bar
|
||||
; jsr update_status_bar
|
||||
|
||||
;====================================
|
||||
; load level1 background
|
||||
@ -108,6 +108,12 @@ keen_start:
|
||||
;====================================
|
||||
; 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
|
||||
sta TILEMAP_X
|
||||
lda #0
|
||||
@ -117,7 +123,7 @@ keen_start:
|
||||
|
||||
;====================================
|
||||
;====================================
|
||||
; Main LOGO loop
|
||||
; Main loop
|
||||
;====================================
|
||||
;====================================
|
||||
|
||||
@ -125,7 +131,7 @@ keen_loop:
|
||||
|
||||
; copy over background
|
||||
|
||||
jsr gr_copy_to_current
|
||||
; jsr gr_copy_to_current
|
||||
|
||||
; draw tilemap
|
||||
|
||||
@ -145,11 +151,11 @@ keen_loop:
|
||||
|
||||
; handle door opening
|
||||
|
||||
jsr check_open_door
|
||||
; jsr check_open_door
|
||||
|
||||
; draw a status bar
|
||||
|
||||
jsr draw_status_bar
|
||||
; jsr draw_status_bar
|
||||
|
||||
jsr page_flip
|
||||
|
||||
|
@ -129,7 +129,7 @@ keen_check_head:
|
||||
sbc #16 ; above head is -2 rows
|
||||
tax
|
||||
|
||||
lda TILEMAP,X
|
||||
lda tilemap,X
|
||||
|
||||
; if tile# < HARD_TILES then we are fine
|
||||
cmp #HARD_TILES
|
||||
@ -158,7 +158,7 @@ check_right_collide:
|
||||
adc #1 ; right is one to right
|
||||
|
||||
tax
|
||||
lda TILEMAP,X
|
||||
lda tilemap,X
|
||||
|
||||
; if tile# < HARD_TILES then we are fine
|
||||
cmp #HARD_TILES
|
||||
@ -175,7 +175,7 @@ check_left_collide:
|
||||
sbc #2 ; left is one to left
|
||||
; +1 fudge factor
|
||||
tax
|
||||
lda TILEMAP,X
|
||||
lda tilemap,X
|
||||
|
||||
; if tile# < HARD_TILES then we are fine
|
||||
cmp #HARD_TILES
|
||||
@ -322,7 +322,7 @@ check_falling:
|
||||
adc #16 ; underfoot is on next row (+16)
|
||||
|
||||
tax
|
||||
lda TILEMAP,X
|
||||
lda tilemap,X
|
||||
|
||||
; if tile# < HARD_TILES then we fall
|
||||
cmp #HARD_TILES
|
||||
|
Loading…
x
Reference in New Issue
Block a user