Added ACTOR_FLAG to set high bit on text page at enemy location

This commit is contained in:
Rob McMullen 2018-07-20 18:31:56 -07:00
parent 4b0c7ead49
commit 4da5a2631e
5 changed files with 32 additions and 4 deletions

View File

@ -52,6 +52,8 @@ TILE_HORZ = TILE_LEFT|TILE_RIGHT
TILE_VERT = TILE_UP|TILE_DOWN
DIR_MASK = $0f
TILE_DOT = $10
ACTOR_FLAG = $80
ACTOR_FLAG_MASK = $7f
CLEAR_TILE_DOT = $ef ;%11101111
LEFT_TILE = TILE_DOT|TILE_RIGHT

Binary file not shown.

22
logic.s
View File

@ -108,6 +108,28 @@ has_dot nop
and #TILE_DOT
rts
clear_actor_flag nop
lda actor_row,x
tay
jsr mazerow
lda actor_col,x
tay
lda (mazeaddr),y
and #ACTOR_FLAG_MASK
sta (mazeaddr),y
rts
set_actor_flag nop
lda actor_row,x
tay
jsr mazerow
lda actor_col,x
tay
lda (mazeaddr),y
ora #ACTOR_FLAG
sta (mazeaddr),y
rts
; # Determine the tile location given the direction of the actor's movement
; def get_next_tile(r, c, dir):

2
main.s
View File

@ -230,7 +230,9 @@ game_loop nop
lda actor_active,x
bmi ?player ; negative = end
beq ?enemy ; zero = skip
jsr clear_actor_flag
jsr move_enemy
jsr set_actor_flag
jmp ?enemy
?player lda #0

View File

@ -460,13 +460,14 @@ draw_to_page2 lda #$60
; image with tile 15 when necessary
fastfont nop
cmp #12
bne fastfont_smc
bne ?2
txa
and #1
bne ?1
lda #15
bne fastfont_smc
bne ?2
?1 lda #12
?2 and #ACTOR_FLAG_MASK
fastfont_smc jmp $ffff
; restore a horizontal segment from the text page to the current screen
@ -481,13 +482,14 @@ fasttiles ldx param_col
sta fasttiles_row_smc+1
fasttiles_row_smc lda $ffff,x
cmp #12
bne fasttiles_smc
bne ?2
txa
and #1
bne ?1
lda #15
bne fasttiles_smc
bne ?2
?1 lda #12
?2 and #ACTOR_FLAG_MASK
fasttiles_smc jsr $ffff
inx
dec param_count