1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-11-25 07:32:16 +00:00

Use save block (and a for loop) in the flagship demo game source.

This commit is contained in:
Chris Pressey 2018-05-08 12:39:21 +01:00
parent 8091c45a9a
commit c3a1bdb4cc

View File

@ -406,15 +406,18 @@ define game_state_title_screen game_state_routine
}
define game_state_play game_state_routine
static byte save_x : 0
{
ld x, 0
repeat {
for x up to 15 {
copy actor_pos + x, pos
copy actor_delta + x, delta
st x, save_x
//
// Save our loop counter on the stack temporarily. This means that routines
// like `dispatch_logic` and `clear_screen` are allowed to do whatever they
// want with the `x` register; we will restore it at the end of this block.
//
save x {
copy actor_logic + x, dispatch_logic
call dispatch_logic
@ -423,14 +426,11 @@ static byte save_x : 0
call clear_screen
copy game_state_game_over, dispatch_game_state
}
ld x, save_x
}
copy pos, actor_pos + x
copy delta, actor_delta + x
inc x
cmp x, 16
} until z
}
goto save_cinv
}