Added some debug hex printing and better player init

This commit is contained in:
Rob McMullen 2017-07-20 13:43:49 -07:00
parent fcafd74f17
commit 1d8a1d8c66
5 changed files with 119 additions and 11 deletions

View File

@ -35,7 +35,7 @@ titles.dsk: cpbg.xex player-missile.hgr partycrasher-software.hgr kansasfest-hac
working-sprite-driver.s: $(BWSPRITE) fatfont128.dat
quicksprite.py -a mac65 -p 6502 -s hgrbw -m -k -d -g -f fatfont128.dat -o working $(BWSPRITE)
working.xex: working.s rand.s maze.s working-sprite-driver.s vars.s debug.s
working.xex: working.s rand.s maze.s working-sprite-driver.s vars.s debug.s actors.s background.s screen.s logic.s
rm -f working.xex
atasm -mae -oworking.xex working.s -Lworking.var -gworking.lst

View File

@ -33,7 +33,7 @@ actor_init_func_h .byte >init_player, >init_orbiter, >init_amidar
;
; Number of sprites must be a power of 2
actor_active .byte 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 , $ff ; 1 = active, 0 = skip
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
.byte <APPLE_SPRITE9X11, <APPLE_SPRITE9X11, <APPLE_SPRITE9X11, <APPLE_SPRITE9X11
@ -94,15 +94,37 @@ add_score nop
rts
init_players nop
sta config_num_players
; level number in X, clobbers
;
init_level nop
stx level
ldx level
lda level_enemies,x
clc
adc #FIRST_AMIDAR
sta last_enemy
tay
lda #$ff
sta actor_active+FIRST_AMIDAR,y
lda #1
?1 sta actor_active+FIRST_AMIDAR-1,y
dey
bne ?1
; clear active players
ldy #0
lda #1
?2 cpy config_num_players
bcs ?3
sta actor_active,y
iny
bne ?2
lda #0
?3 cpy #MAX_PLAYERS
bcs ?4
sta actor_active,y
iny
bne ?3
?4 rts
;

42
debug.s
View File

@ -29,3 +29,45 @@ printhex ; A = hex byte, X = column, Y = row; A is clobbered, X&Y are not
rts
hexdigit .byte "0123456789ABCDEF"
printstr ; X = column, Y = row, scratch_ptr is text (null terminated)
sty param_y
ldy #0
?next lda (scratch_ptr),y
beq ?exit
ldy param_y
jsr fastfont
inx
bne ?next
?exit rts
debug_player nop
ldx #0
lda actor_input_dir,x
ldx #35
ldy #23
jsr printhex
ldx #0
lda actor_x,x
ldx #35
ldy #22
jsr printhex
ldx #0
lda actor_y,x
ldx #38
ldy #22
jsr printhex
ldx #0
lda actor_col,x
ldx #35
ldy #21
jsr printhex
ldx #0
lda actor_row,x
ldx #38
ldy #21
jsr printhex
rts

View File

@ -46,6 +46,33 @@ text_put_col nop
sta $07d0,x ; row 23
rts
text_put_col2 nop
sta $0800,x ; row 0
sta $0880,x ; row 1
sta $0900,x ; row 2
sta $0980,x ; row 3
sta $0a00,x ; row 4
sta $0a80,x ; row 5
sta $0b00,x ; row 6
sta $0b80,x ; row 7
sta $0828,x ; row 8
sta $08a8,x ; row 9
sta $0928,x ; row 10
sta $09a8,x ; row 11
sta $0a28,x ; row 12
sta $0aa8,x ; row 13
sta $0b28,x ; row 14
sta $0ba8,x ; row 15
sta $0850,x ; row 16
sta $08d0,x ; row 17
sta $0950,x ; row 18
sta $09d0,x ; row 19
sta $0a50,x ; row 20
sta $0ad0,x ; row 21
sta $0b50,x ; row 22
sta $0bd0,x ; row 23
rts
; maze is text screen 1
textrows_l .byte $00, $80, $00, $80, $00, $80, $00, $80
.byte $28, $a8, $28, $a8, $28, $a8, $28, $a8

View File

@ -119,6 +119,7 @@ start nop
jsr clrscr
jsr init_screen_once
jsr title_screen
jsr init_game
jsr game_loop
@ -141,14 +142,27 @@ clr1
ldx clr1+2
cpx #$40
bcc clr1
lda #0
ldx #39
?1 jsr text_put_col ; text page 1
jsr text_put_col2 ; text page 2
dex
bpl ?1
rts
title_screen nop
lda #1
sta config_num_players
lda #0
sta config_quit
lda #1
sta level
rts
init_game nop
jsr initbackground
lda #1
jsr init_level
lda #1
sta config_num_players
jsr init_actors
lda #0
sta frame_count
@ -169,6 +183,9 @@ game_loop nop
bne ?1
inc frame_count+1
?1 jsr userinput
jsr debug_player
lda config_quit
beq ?2
rts
@ -266,7 +283,7 @@ userinput
lda KEYBOARD
pha
ldx #38
ldy #22
ldy #23
jsr printhex
pla
bpl input_not_movement ; stop movement of player if no direction input