diff --git a/constants.s b/constants.s index 089f248..133b36e 100644 --- a/constants.s +++ b/constants.s @@ -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 diff --git a/fujirun-v1.dsk b/fujirun-v1.dsk index 5010e79..fceeafb 100644 Binary files a/fujirun-v1.dsk and b/fujirun-v1.dsk differ diff --git a/logic.s b/logic.s index 1ec95dc..8c5e602 100644 --- a/logic.s +++ b/logic.s @@ -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): diff --git a/main.s b/main.s index 4ce192b..cdc394e 100644 --- a/main.s +++ b/main.s @@ -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 diff --git a/platform-apple2.s b/platform-apple2.s index 50f568d..28f483a 100644 --- a/platform-apple2.s +++ b/platform-apple2.s @@ -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