mirror of
https://github.com/catseye/SixtyPical.git
synced 2025-02-16 15:30:26 +00:00
Even if we goto
another routine, we can't trash an output.
This commit is contained in:
parent
105534de5b
commit
a7365731ca
@ -7,6 +7,7 @@ History of SixtyPical
|
|||||||
* `copy` is now understood to trash `a`, thus `copy ..., a` is not valid.
|
* `copy` is now understood to trash `a`, thus `copy ..., a` is not valid.
|
||||||
Indirect addressing is supported in `ld`, as in `ld a, [ptr] + y`, to compensate.
|
Indirect addressing is supported in `ld`, as in `ld a, [ptr] + y`, to compensate.
|
||||||
* Implements the "union rule for trashes" when analyzing `if` blocks.
|
* Implements the "union rule for trashes" when analyzing `if` blocks.
|
||||||
|
* Even if we `goto` another routine, we can't trash an output.
|
||||||
* Fixed bug where `trash` was not marking the location as being virtually altered.
|
* Fixed bug where `trash` was not marking the location as being virtually altered.
|
||||||
|
|
||||||
0.11
|
0.11
|
||||||
|
@ -35,9 +35,9 @@ typedef routine
|
|||||||
actor_pos, actor_delta, actor_logic,
|
actor_pos, actor_delta, actor_logic,
|
||||||
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||||
outputs button_down, dispatch_game_state,
|
outputs button_down, dispatch_game_state,
|
||||||
actor_pos, pos, new_pos, actor_delta, delta, actor_logic,
|
actor_pos, actor_delta, actor_logic,
|
||||||
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||||
trashes a, x, y, c, z, n, v, ptr, save_x, compare_target, dispatch_logic
|
trashes a, x, y, c, z, n, v, pos, new_pos, delta, ptr, save_x, compare_target, dispatch_logic
|
||||||
game_state_routine
|
game_state_routine
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -402,12 +402,7 @@ define game_state_title_screen game_state_routine
|
|||||||
|
|
||||||
if c {
|
if c {
|
||||||
call clear_screen
|
call clear_screen
|
||||||
|
|
||||||
// FIXME: this seems wrong and we need to investigate it.
|
|
||||||
// init_game trashes `pos` (this is reasonable.) But pos is declared
|
|
||||||
// as an output to `game_state_routine`. This should be an error...
|
|
||||||
call init_game
|
call init_game
|
||||||
|
|
||||||
copy forward game_state_play, dispatch_game_state
|
copy forward game_state_play, dispatch_game_state
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,13 +202,31 @@ class Analyzer(object):
|
|||||||
return
|
return
|
||||||
type_ = routine.location.type
|
type_ = routine.location.type
|
||||||
context = Context(self.routines, routine, type_.inputs, type_.outputs, type_.trashes)
|
context = Context(self.routines, routine, type_.inputs, type_.outputs, type_.trashes)
|
||||||
|
|
||||||
if self.debug:
|
if self.debug:
|
||||||
print "at start of routine `{}`:".format(routine.name)
|
print "at start of routine `{}`:".format(routine.name)
|
||||||
print context
|
print context
|
||||||
|
|
||||||
self.analyze_block(routine.block, context)
|
self.analyze_block(routine.block, context)
|
||||||
|
trashed = set(context.each_touched()) - context._meaningful
|
||||||
|
|
||||||
if self.debug:
|
if self.debug:
|
||||||
print "at end of routine `{}`:".format(routine.name)
|
print "at end of routine `{}`:".format(routine.name)
|
||||||
print context
|
print context
|
||||||
|
print "trashed: ", LocationRef.format_set(trashed)
|
||||||
|
print "outputs: ", LocationRef.format_set(type_.outputs)
|
||||||
|
trashed_outputs = type_.outputs & trashed
|
||||||
|
if trashed_outputs:
|
||||||
|
print "TRASHED OUTPUTS: ", LocationRef.format_set(trashed_outputs)
|
||||||
|
print ''
|
||||||
|
print '-' * 79
|
||||||
|
print ''
|
||||||
|
|
||||||
|
# even if we goto another routine, we can't trash an output.
|
||||||
|
for ref in trashed:
|
||||||
|
if ref in type_.outputs:
|
||||||
|
raise UnmeaningfulOutputError('%s in %s' % (ref.name, routine.name))
|
||||||
|
|
||||||
if not self.has_encountered_goto:
|
if not self.has_encountered_goto:
|
||||||
for ref in type_.outputs:
|
for ref in type_.outputs:
|
||||||
context.assert_meaningful(ref, exception_class=UnmeaningfulOutputError)
|
context.assert_meaningful(ref, exception_class=UnmeaningfulOutputError)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user