diff --git a/eg/game.60p b/eg/game.60p index 501a030..7c6ed33 100644 --- a/eg/game.60p +++ b/eg/game.60p @@ -19,6 +19,8 @@ assign vector cinv 788 reserve vector save_cinv +// these are zero-page so that we can use them as indirect addresses +// through which we write to screen memory assign word position $fb assign word new_position $fd @@ -27,6 +29,7 @@ reserve byte value reserve word compare_target reserve word[16] actor_pos +reserve word[16] actor_delta reserve vector dispatch_state reserve vector dispatch_logic @@ -43,6 +46,7 @@ routine calculate_new_position outputs (new_position) { sta >new_position } +// output is carry routine compare_new_pos { lda >new_position cmp >compare_target @@ -53,6 +57,7 @@ routine compare_new_pos { } } +// output is carry routine check_new_position_in_bounds { copy #$07e8 compare_target // just past bottom of screen jsr compare_new_pos @@ -92,7 +97,7 @@ routine clear_screen { } } -routine read_stick { +routine read_stick outputs (delta) { lda #0 sta delta @@ -145,6 +150,12 @@ routine init_game { asl .a asl .a copy .a actor_delta, y + copy #40 delta + } else { + // copy #40 delta + lda #40 + sta delta + } +} + routine logic_obstacle { - lda #0 - sta >delta - lda #1 - sta