Save a few bytes in the demo game by using a `for` loop.
Chris Pressey
7 years ago
89 | 89 | vector logic_routine table[256] actor_logic |
90 | 90 | vector logic_routine dispatch_logic |
91 | 91 | |
92 | byte table[32] press_fire_msg: "PRESS`FIRE`TO`PLAY" | |
92 | byte table[18] press_fire_msg: "PRESS`FIRE`TO`PLAY" | |
93 | 93 | |
94 | 94 | // |
95 | 95 | // Points to the routine that implements the current game state. |
383 | 383 | define game_state_title_screen game_state_routine |
384 | 384 | { |
385 | 385 | ld y, 0 |
386 | repeat { | |
387 | ||
388 | // First we "clip" the index to 0-31 to ensure we don't | |
389 | // read outside the bounds of the table: | |
390 | ld a, y | |
391 | and a, 31 | |
392 | ld y, a | |
393 | ||
386 | for y up to 17 { | |
394 | 387 | ld a, press_fire_msg + y |
395 | 388 | |
396 | 389 | st on, c |
397 | 390 | sub a, 64 // yuck. oh well |
398 | 391 | |
399 | 392 | st a, screen1 + y |
400 | inc y | |
401 | cmp y, 18 | |
402 | } until z | |
393 | } | |
403 | 394 | |
404 | 395 | st off, c |
405 | 396 | call check_button |