1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2025-01-09 10:30:13 +00:00

Improve error messaging yet more. Game kind of has game states now.

This commit is contained in:
Chris Pressey 2017-12-12 09:59:43 +00:00
parent 82e33ab476
commit e46c6f6c6e
2 changed files with 24 additions and 19 deletions

View File

@ -32,7 +32,7 @@ word delta
vector dispatch_game_state
inputs joy2, pos
outputs delta, pos, screen, screen1
outputs delta, pos, screen, screen1, dispatch_game_state
trashes a, x, y, c, z, n, v, ptr
//
@ -49,13 +49,13 @@ vector dispatch_game_state
vector cinv
inputs joy2, pos
outputs delta, pos, screen, screen1
outputs delta, pos, dispatch_game_state, screen, screen1
trashes a, x, y, c, z, n, v, ptr
@ 788
vector save_cinv
inputs joy2, pos
outputs delta, pos, screen, screen1
outputs delta, pos, dispatch_game_state, screen, screen1
trashes a, x, y, c, z, n, v, ptr
@ -125,7 +125,7 @@ routine clear_screen
routine game_state_play
inputs joy2, pos
outputs delta, pos, screen, screen1
outputs delta, pos, dispatch_game_state, screen, screen1
trashes a, x, y, c, z, n, v, ptr
{
call read_stick
@ -145,7 +145,7 @@ routine game_state_play
routine game_state_title_screen
inputs joy2, pos
outputs delta, pos, screen, screen1
outputs delta, pos, screen, screen1, dispatch_game_state
trashes a, x, y, c, z, n, v, ptr
{
ld y, 0
@ -162,10 +162,9 @@ routine game_state_title_screen
if c {
// call clear_screen
// jsr init_game
// FIXME various reasons we can't do this, mainly that self-reference
// is disallowed: we would need to put "outputs dispatch_game_state" in
// the signature of dispatch_game_state!
// copy game_state_play, dispatch_game_state
copy game_state_play, dispatch_game_state
} else {
copy game_state_play, dispatch_game_state
}
goto save_cinv
@ -177,7 +176,7 @@ routine game_state_title_screen
routine our_cinv
inputs joy2, pos
outputs delta, pos, screen, screen1
outputs delta, pos, dispatch_game_state, screen, screen1
trashes a, x, y, c, z, n, v, ptr
{
goto dispatch_game_state
@ -197,8 +196,7 @@ routine main
call clear_screen
copy game_state_play, dispatch_game_state
// copy game_state_title_screen, dispatch_game_state
copy game_state_title_screen, dispatch_game_state
copy word 0, pos
with interrupts off {

View File

@ -185,16 +185,23 @@ class Analyzer(object):
)
def assert_affected_within(self, name, affected, limited_to):
# We reduce the set of LocationRefs to a set of strings (their labels).
# This is necessary because currently, two LocationRefs that refer to the
# same location are not considered euqal. (But two LocationRefs with the
# same label should always be the same type.)
def format(loc):
assert isinstance(loc, LocationRef)
return loc.name
affected = set([loc.name for loc in affected])
limited_to = set([loc.name for loc in limited_to])
def loc_list(label_set):
return ', '.join(sorted(label_set))
if affected <= limited_to:
return
overage = affected - limited_to
overage_s = ', '.join(sorted([format(loc) for loc in overage]))
message = 'affected beyond %s: {%s} in %s' % (name, overage_s, self.current_routine.name)
if not overage:
return
message = 'in %s: %s are {%s} but affects {%s} which exceeds by: {%s} ' % (
self.current_routine.name, name, loc_list(limited_to), loc_list(affected), loc_list(overage)
)
raise IncompatibleConstraintsError(message)
def analyze_program(self, program):