Moved all actor* storage to page 8

This commit is contained in:
Rob McMullen 2017-07-20 15:09:45 -07:00
parent 1d8a1d8c66
commit d2fd62cd34
5 changed files with 71 additions and 24 deletions

View File

@ -10,18 +10,20 @@ player_score_h .byte 0, 0, 0, 0
;# amidar movement.
MAX_PLAYERS = 4
MAX_AMIDARS = VPATH_NUM + 1 ; # one enemy per vpath + one orbiter
MAX_ACTORS = MAX_PLAYERS + MAX_AMIDARS
;MAX_ACTORS = MAX_PLAYERS + MAX_AMIDARS
MAX_ACTORS = 16
FIRST_PLAYER = 0
FIRST_AMIDAR = MAX_PLAYERS
LAST_PLAYER = FIRST_AMIDAR - 1
LAST_AMIDAR = MAX_ACTORS - 1
LAST_AMIDAR = LAST_PLAYER + MAX_AMIDARS
PLAYER_TYPE = 0
ORBITER_TYPE = 1
AMIDAR_TYPE = 2
actor_type .byte PLAYER_TYPE, PLAYER_TYPE, PLAYER_TYPE, PLAYER_TYPE
.byte ORBITER_TYPE
.byte AMIDAR_TYPE, AMIDAR_TYPE, AMIDAR_TYPE, AMIDAR_TYPE, AMIDAR_TYPE, AMIDAR_TYPE
.byte ORBITER_TYPE, AMIDAR_TYPE, AMIDAR_TYPE, AMIDAR_TYPE
.byte AMIDAR_TYPE, AMIDAR_TYPE, AMIDAR_TYPE, AMIDAR_TYPE
.byte AMIDAR_TYPE, AMIDAR_TYPE, AMIDAR_TYPE, AMIDAR_TYPE
actor_init_func_l .byte <init_player, <init_orbiter, <init_amidar
actor_init_func_h .byte >init_player, >init_orbiter, >init_amidar
@ -33,28 +35,30 @@ actor_init_func_h .byte >init_player, >init_orbiter, >init_amidar
;
; Number of sprites must be a power of 2
actor_active .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , $ff ; 1 = active, 0 = skip
source_actor_active .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , $ff ; 1 = active, 0 = skip
actor_l
source_actor_l
.byte <APPLE_SPRITE9X11, <APPLE_SPRITE9X11, <APPLE_SPRITE9X11, <APPLE_SPRITE9X11
.byte <APPLE_SPRITE9X11, <APPLE_SPRITE9X11, <APPLE_SPRITE9X11, <APPLE_SPRITE9X11
.byte <APPLE_SPRITE9X11, <APPLE_SPRITE9X11, <APPLE_SPRITE9X11, <APPLE_SPRITE9X11
.byte <APPLE_SPRITE9X11, <APPLE_SPRITE9X11, <APPLE_SPRITE9X11, <APPLE_SPRITE9X11
actor_h
source_actor_h
.byte >APPLE_SPRITE9X11, >APPLE_SPRITE9X11, >APPLE_SPRITE9X11, >APPLE_SPRITE9X11
.byte >APPLE_SPRITE9X11, >APPLE_SPRITE9X11, >APPLE_SPRITE9X11, >APPLE_SPRITE9X11
.byte >APPLE_SPRITE9X11, >APPLE_SPRITE9X11, >APPLE_SPRITE9X11, >APPLE_SPRITE9X11
.byte >APPLE_SPRITE9X11, >APPLE_SPRITE9X11, >APPLE_SPRITE9X11, >APPLE_SPRITE9X11
actor_x
source_actor_x
.byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , $ff
actor_y
source_actor_y
.byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , $ff
source_end .byte $ff
; [i*7 for i in range(40)]
player_col_to_x .byte 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, 119, 126, 133, 140, 147, 154, 161, 168, 175, 182, 189, 196, 203, 210, 217, 224, 231, 238, 245, 252, 259, 266, 273
player_col_to_x .byte 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, 119, 126, 133, 140, 147, 154, 161, 168, 175, 182, 189, 196, 203, 210, 217, 224, 248, 248, 248, 248, 248, 248, 248, 248
; [i*8 for i in range(24)]
player_row_to_y .byte 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184
@ -94,6 +98,15 @@ add_score nop
rts
init_actors_once nop
ldx #0
?1 lda source_actor_active,x
sta actor_active,x
inx
cpx #source_end-source_actor_active
bcc ?1
rts
init_players nop
sta config_num_players
@ -118,8 +131,8 @@ init_level nop
sta actor_active,y
iny
bne ?2
lda #0
?3 cpy #MAX_PLAYERS
?3 lda #0
cpy #MAX_PLAYERS
bcs ?4
sta actor_active,y
iny

20
debug.s
View File

@ -42,32 +42,42 @@ printstr ; X = column, Y = row, scratch_ptr is text (null terminated)
?exit rts
debug_player nop
lda #22
sta scratch_row
ldx #0
lda actor_input_dir,x
ldx #35
ldy #23
ldy scratch_row
jsr printhex
ldx #0
lda actor_dir,x
ldx #38
ldy scratch_row
jsr printhex
dec scratch_row
ldx #0
lda actor_x,x
ldx #35
ldy #22
ldy scratch_row
jsr printhex
ldx #0
lda actor_y,x
ldx #38
ldy #22
ldy scratch_row
jsr printhex
dec scratch_row
ldx #0
lda actor_col,x
ldx #35
ldy #21
ldy scratch_row
jsr printhex
ldx #0
lda actor_row,x
ldx #38
ldy #21
ldy scratch_row
jsr printhex
rts

View File

@ -137,6 +137,22 @@ wipe2to1_wait nop
bcc wipe2to1_loop
rts
copy2to1 lda #$40
sta ?source+2
lda #$20
sta ?dest+2
?outer ldy #0
?source lda $ff00,y
?dest sta $ff00,y
iny
bne ?source
inc ?source+2
inc ?dest+2
lda ?dest+2
cmp #$40
bcc ?outer
rts
copytexthgr nop
ldy #0 ; y is rows

15
vars.s
View File

@ -1,14 +1,12 @@
*= $800
amidar_start_col .ds VPATH_NUM
round_robin_up .ds VPATH_NUM
round_robin_down .ds VPATH_NUM
actor_col .ds MAX_ACTORS ; # current tile column
actor_x .ds MAX_ACTORS
actor_row .ds MAX_ACTORS ; # current tile row
actor_y .ds MAX_ACTORS
actor_xpixel .ds MAX_ACTORS ; # current pixel offset in col
actor_xfrac .ds MAX_ACTORS ; # current fractional pixel
actor_xspeed .ds MAX_ACTORS ; # current speed (affects fractional)
actor_row .ds MAX_ACTORS ; # current tile row
actor_ypixel .ds MAX_ACTORS ; # current pixel offset in row
actor_yfrac .ds MAX_ACTORS ; # current fractional pixel
actor_yspeed .ds MAX_ACTORS ; # current speed (affects fractional)
@ -18,9 +16,16 @@ actor_target_col .ds MAX_ACTORS ; # target column at bot or top T
actor_status .ds MAX_ACTORS ; # alive, exploding, dead, regenerating, invulnerable, ???
actor_frame_counter .ds MAX_ACTORS ; # frame counter for sprite changes
actor_input_dir .ds MAX_ACTORS ; # current joystick input direction
actor_active .ds MAX_ACTORS ; 1 = active, 0 = skip, $ff = end
actor_l .ds MAX_ACTORS
actor_h .ds MAX_ACTORS
dot_eaten_row .ds 4 ; # dot eaten by player
dot_eaten_col .ds 4
player_score .ds 4
player_next_target_score .ds 4
player_lives .ds 4 ; # lives remaining
amidar_start_col .ds VPATH_NUM
round_robin_up .ds VPATH_NUM
round_robin_down .ds VPATH_NUM

View File

@ -119,6 +119,7 @@ start nop
jsr clrscr
jsr init_screen_once
jsr init_actors_once
jsr title_screen
jsr init_game
jsr game_loop
@ -175,8 +176,10 @@ initbackground nop
jsr show_page1
jsr init_maze
jsr copytexthgr ; page2 becomes the source
jsr wipeclear1
jsr wipe2to1
; jsr wipeclear1
; jsr wipe2to1
jsr copy2to1
rts
game_loop nop
inc frame_count