Begin using static in the demo game.
Chris Pressey
4 years ago
8 | 8 |
as `ld a, [ptr] + y` and `st a, [ptr] + y`.
|
9 | 9 |
* Implements the "union rule for trashes" when analyzing `if` blocks.
|
10 | 10 |
* Even if we `goto` another routine, we can't trash an output.
|
|
11 |
* `static` storage locations local to routines can now be defined within routines.
|
11 | 12 |
* Fixed bug where `trash` was not marking the location as being virtually altered.
|
12 | 13 |
|
13 | 14 |
0.11
|
58 | 58 |
Range-checking buffers might be too difficult. Range checking tables will be easier.
|
59 | 59 |
If a value is ANDed with 15, its range must be 0-15, etc.
|
60 | 60 |
|
61 | |
### Routine-local static memory locations
|
62 | |
|
63 | |
These would not need to appear in the inputs/outputs/trashes sets of the routines
|
64 | |
that call this routine.
|
65 | |
|
66 | |
These might be forced to specify an initial value so that they can always be
|
67 | |
assumed to be meaningful.
|
68 | |
|
69 | 61 |
### Re-order routines and optimize tail-calls to fallthroughs
|
70 | 62 |
|
71 | 63 |
Not because it saves 3 bytes, but because it's a neat trick. Doing it optimally
|
36 | 36 |
outputs button_down, dispatch_game_state,
|
37 | 37 |
actor_pos, actor_delta, actor_logic,
|
38 | 38 |
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
39 | |
trashes a, x, y, c, z, n, v, pos, new_pos, delta, ptr, save_x, compare_target, dispatch_logic
|
|
39 |
trashes a, x, y, c, z, n, v, pos, new_pos, delta, ptr, compare_target, dispatch_logic
|
40 | 40 |
game_state_routine
|
41 | 41 |
|
42 | 42 |
//
|
|
92 | 92 |
byte button_down : 0 // effectively static-local to check_button
|
93 | 93 |
byte table[32] press_fire_msg: "PRESS`FIRE`TO`PLAY"
|
94 | 94 |
|
95 | |
byte save_x
|
96 | 95 |
word compare_target
|
97 | 96 |
|
98 | 97 |
//
|
|
409 | 408 |
}
|
410 | 409 |
|
411 | 410 |
define game_state_play game_state_routine
|
|
411 |
static byte save_x : 0
|
412 | 412 |
{
|
413 | 413 |
ld x, 0
|
414 | 414 |
repeat {
|