mirror of
https://github.com/catseye/SixtyPical.git
synced 2025-02-17 22:30:27 +00:00
Work on game a bit. Multiple actors.
This commit is contained in:
parent
8acde175ad
commit
23185b8045
111
eg/game.60p
111
eg/game.60p
@ -29,6 +29,12 @@ reserve word compare_target
|
|||||||
reserve byte[16] actor_pos_hi
|
reserve byte[16] actor_pos_hi
|
||||||
reserve byte[16] actor_pos_lo
|
reserve byte[16] actor_pos_lo
|
||||||
|
|
||||||
|
reserve vector dispatch_state
|
||||||
|
|
||||||
|
reserve byte[18] press_fire_msg: "PRESS FIRE TO PLAY"
|
||||||
|
|
||||||
|
reserve byte save_x // TODO: SHOULD BE BLOCK LOCAL!
|
||||||
|
|
||||||
routine calculate_new_position outputs (new_position) {
|
routine calculate_new_position outputs (new_position) {
|
||||||
clc
|
clc
|
||||||
lda <position
|
lda <position
|
||||||
@ -125,49 +131,92 @@ routine read_stick {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
routine our_cinv {
|
// output is .z flag
|
||||||
ldy #0
|
routine check_fire {
|
||||||
lda actor_pos_hi, y
|
ldx joy2
|
||||||
sta >position
|
txa
|
||||||
lda actor_pos_lo, y
|
and #16
|
||||||
sta <position
|
}
|
||||||
|
|
||||||
jsr read_stick
|
routine init_game {
|
||||||
jsr calculate_new_position
|
ldy #0
|
||||||
jsr check_new_position_in_bounds
|
repeat bne {
|
||||||
if bcs {
|
lda #$04
|
||||||
lda #32
|
sta actor_pos_hi, y
|
||||||
ldy #0
|
tya
|
||||||
sta (position), y
|
sta actor_pos_lo, y
|
||||||
copy new_position position
|
iny
|
||||||
lda #81
|
cpy #8
|
||||||
ldy #0
|
}
|
||||||
sta (position), y
|
}
|
||||||
|
|
||||||
|
routine state_title_screen {
|
||||||
|
ldy #0
|
||||||
|
repeat bne {
|
||||||
|
lda press_fire_msg, y
|
||||||
|
sec
|
||||||
|
sbc #64 // yuck
|
||||||
|
sta screen, y
|
||||||
|
iny
|
||||||
|
cpy #18
|
||||||
|
}
|
||||||
|
jsr check_fire
|
||||||
|
if beq {
|
||||||
|
jsr clear_screen
|
||||||
|
jsr init_game
|
||||||
|
copy routine state_play_game to dispatch_state
|
||||||
} else { }
|
} else { }
|
||||||
|
|
||||||
ldy #0
|
|
||||||
lda >position
|
|
||||||
sta actor_pos_hi, y
|
|
||||||
lda <position
|
|
||||||
sta actor_pos_lo, y
|
|
||||||
|
|
||||||
jmp (save_cinv)
|
jmp (save_cinv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
routine state_play_game {
|
||||||
|
// reserve byte save_x
|
||||||
|
ldx #0
|
||||||
|
repeat bne {
|
||||||
|
stx save_x
|
||||||
|
|
||||||
|
lda actor_pos_hi, x
|
||||||
|
sta >position
|
||||||
|
lda actor_pos_lo, x
|
||||||
|
sta <position
|
||||||
|
|
||||||
|
jsr read_stick
|
||||||
|
jsr calculate_new_position
|
||||||
|
jsr check_new_position_in_bounds
|
||||||
|
if bcs {
|
||||||
|
lda #32
|
||||||
|
ldy #0
|
||||||
|
sta (position), y
|
||||||
|
copy new_position position
|
||||||
|
lda #81
|
||||||
|
ldy #0
|
||||||
|
sta (position), y
|
||||||
|
} else { }
|
||||||
|
|
||||||
|
ldx save_x
|
||||||
|
lda >position
|
||||||
|
sta actor_pos_hi, x
|
||||||
|
lda <position
|
||||||
|
sta actor_pos_lo, x
|
||||||
|
inx
|
||||||
|
cpx #8
|
||||||
|
}
|
||||||
|
jmp (save_cinv)
|
||||||
|
}
|
||||||
|
|
||||||
|
routine our_cinv {
|
||||||
|
jmp (dispatch_state)
|
||||||
|
}
|
||||||
|
|
||||||
routine main {
|
routine main {
|
||||||
lda #5
|
lda #5
|
||||||
sta vic_border
|
sta vic_border
|
||||||
lda #0
|
lda #0
|
||||||
sta vic_bg
|
sta vic_bg
|
||||||
// copy #$0400 position
|
|
||||||
|
|
||||||
ldy #0
|
|
||||||
lda #$04
|
|
||||||
sta actor_pos_hi, y
|
|
||||||
lda #$00
|
|
||||||
sta actor_pos_lo, y
|
|
||||||
|
|
||||||
jsr clear_screen
|
jsr clear_screen
|
||||||
|
copy routine state_title_screen to dispatch_state
|
||||||
|
|
||||||
with sei {
|
with sei {
|
||||||
copy cinv save_cinv
|
copy cinv save_cinv
|
||||||
copy routine our_cinv to cinv
|
copy routine our_cinv to cinv
|
||||||
|
Loading…
x
Reference in New Issue
Block a user