1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2025-08-09 15:25:01 +00:00

Work on game a bit. Multiple actors.

This commit is contained in:
Cat's Eye Technologies
2014-04-12 21:20:45 +01:00
parent 8acde175ad
commit 23185b8045

View File

@@ -29,6 +29,12 @@ reserve word compare_target
reserve byte[16] actor_pos_hi
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) {
clc
lda <position
@@ -125,11 +131,53 @@ routine read_stick {
}
}
routine our_cinv {
// output is .z flag
routine check_fire {
ldx joy2
txa
and #16
}
routine init_game {
ldy #0
lda actor_pos_hi, y
repeat bne {
lda #$04
sta actor_pos_hi, y
tya
sta actor_pos_lo, y
iny
cpy #8
}
}
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 { }
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, y
lda actor_pos_lo, x
sta <position
jsr read_stick
@@ -145,29 +193,30 @@ routine our_cinv {
sta (position), y
} else { }
ldy #0
ldx save_x
lda >position
sta actor_pos_hi, y
sta actor_pos_hi, x
lda <position
sta actor_pos_lo, y
sta actor_pos_lo, x
inx
cpx #8
}
jmp (save_cinv)
}
routine our_cinv {
jmp (dispatch_state)
}
routine main {
lda #5
sta vic_border
lda #0
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
copy routine state_title_screen to dispatch_state
with sei {
copy cinv save_cinv
copy routine our_cinv to cinv