From a8a53e2ca9baa56a33a4fe55ee1b3a396f7ec885 Mon Sep 17 00:00:00 2001 From: Chris Pressey Date: Mon, 26 Mar 2018 13:23:36 +0100 Subject: [PATCH] Save a few bytes in the demo game by using a `for` loop. --- eg/c64/demo-game/demo-game.60p | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/eg/c64/demo-game/demo-game.60p b/eg/c64/demo-game/demo-game.60p index afcda06..8ac0215 100644 --- a/eg/c64/demo-game/demo-game.60p +++ b/eg/c64/demo-game/demo-game.60p @@ -90,7 +90,7 @@ word delta vector logic_routine table[256] actor_logic vector logic_routine dispatch_logic -byte table[32] press_fire_msg: "PRESS`FIRE`TO`PLAY" +byte table[18] press_fire_msg: "PRESS`FIRE`TO`PLAY" // // Points to the routine that implements the current game state. @@ -384,23 +384,14 @@ define enemy_logic logic_routine define game_state_title_screen game_state_routine { ld y, 0 - repeat { - - // First we "clip" the index to 0-31 to ensure we don't - // read outside the bounds of the table: - ld a, y - and a, 31 - ld y, a - + for y up to 17 { ld a, press_fire_msg + y st on, c sub a, 64 // yuck. oh well st a, screen1 + y - inc y - cmp y, 18 - } until z + } st off, c call check_button