1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-06-06 15:29:30 +00:00

Confirm constraint on saveing a.

This commit is contained in:
Chris Pressey 2018-09-07 11:33:24 +01:00
parent 19461bc205
commit e7674c44ce
2 changed files with 16 additions and 1 deletions

View File

@ -785,7 +785,8 @@ class Analyzer(object):
baton = batons.pop()
context.re_introduce(baton)
# FIXME check if A needs to be the outer thing that is saved, I think it does.
# We do this check outside the loop, because A is only preserved
# if it is the outermost thing being `save`d.
if location == REG_A:
pass
else:

View File

@ -2121,6 +2121,20 @@ There is a shortcut syntax for a nested series of `save`s.
| }
= ok
`a` is only preserved if it is the outermost thing `save`d.
| routine main
| inputs a
| outputs a
| trashes z, n
| {
| save x, a {
| ld a, 0
| ld x, 1
| }
| }
? UnmeaningfulOutputError: a
Not just registers, but also user-defined locations can be saved.
| byte foo