button_down is local to check_button.
Chris Pressey
4 years ago
30 | 30 | // |
31 | 31 | |
32 | 32 | typedef routine |
33 | inputs joy2, button_down, press_fire_msg, dispatch_game_state, | |
33 | inputs joy2, press_fire_msg, dispatch_game_state, | |
34 | 34 | actor_pos, actor_delta, actor_logic, |
35 | 35 | screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4 |
36 | outputs button_down, dispatch_game_state, | |
36 | outputs dispatch_game_state, | |
37 | 37 | actor_pos, actor_delta, actor_logic, |
38 | 38 | screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4 |
39 | 39 | trashes a, x, y, c, z, n, v, pos, new_pos, delta, ptr, dispatch_logic |
89 | 89 | vector (logic_routine) table[256] actor_logic |
90 | 90 | vector logic_routine dispatch_logic |
91 | 91 | |
92 | byte button_down : 0 // effectively static-local to check_button | |
93 | 92 | byte table[32] press_fire_msg: "PRESS`FIRE`TO`PLAY" |
94 | 93 | |
95 | 94 | // |
154 | 153 | // call this routine. |
155 | 154 | // Upon return, if carry is set, the button was pressed then released. |
156 | 155 | |
157 | routine check_button | |
158 | inputs joy2, button_down | |
159 | outputs c, button_down | |
156 | define check_button routine | |
157 | inputs joy2 | |
158 | outputs c | |
160 | 159 | trashes a, z, n |
160 | static byte button_down : 0 | |
161 | 161 | { |
162 | 162 | ld a, button_down |
163 | 163 | if z { |