mirror of
https://github.com/catseye/SixtyPical.git
synced 2025-02-09 01:30:50 +00:00
Fix bug raising InconsistentExitError, and type-bug in ribos2.60p.
This commit is contained in:
parent
c906ab7817
commit
c246424930
@ -50,8 +50,9 @@ byte scanline : 85 // %01010101
|
||||
// be practical. So we just jump to this location instead.
|
||||
|
||||
define pla_tay_pla_tax_pla_rti routine
|
||||
inputs a
|
||||
trashes a
|
||||
inputs border_color, vic_intr
|
||||
outputs border_color, vic_intr
|
||||
trashes a, z, n, c
|
||||
@ $EA81
|
||||
|
||||
// ----- Interrupt Handler -----
|
||||
|
@ -481,11 +481,11 @@ class Analyzer(object):
|
||||
exit_writeable = set(exit_context.each_writeable())
|
||||
for ex in self.exit_contexts[1:]:
|
||||
if set(ex.each_meaningful()) != exit_meaningful:
|
||||
raise InconsistentExitError("Exit contexts are not consistent")
|
||||
raise InconsistentExitError(routine, "Exit contexts are not consistent")
|
||||
if set(ex.each_touched()) != exit_touched:
|
||||
raise InconsistentExitError("Exit contexts are not consistent")
|
||||
raise InconsistentExitError(routine, "Exit contexts are not consistent")
|
||||
if set(ex.each_writeable()) != exit_writeable:
|
||||
raise InconsistentExitError("Exit contexts are not consistent")
|
||||
raise InconsistentExitError(routine, "Exit contexts are not consistent")
|
||||
|
||||
# We now set the main context to the (consistent) exit context
|
||||
# so that this routine is perceived as having the same effect
|
||||
|
@ -3921,7 +3921,83 @@ Here is like the above, but the two routines have different inputs, and that's O
|
||||
| }
|
||||
= ok
|
||||
|
||||
TODO: we should have a lot more test cases for the above, here.
|
||||
Another inconsistent exit test, this one based on "real" code
|
||||
(the `ribos2` demo).
|
||||
|
||||
| typedef routine
|
||||
| inputs border_color, vic_intr
|
||||
| outputs border_color, vic_intr
|
||||
| trashes a, z, n, c
|
||||
| irq_handler
|
||||
|
|
||||
| vector irq_handler cinv @ $314
|
||||
| vector irq_handler saved_irq_vec
|
||||
| byte vic_intr @ $d019
|
||||
| byte border_color @ $d020
|
||||
|
|
||||
| define pla_tay_pla_tax_pla_rti routine
|
||||
| inputs a
|
||||
| trashes a
|
||||
| @ $EA81
|
||||
|
|
||||
| define our_service_routine irq_handler
|
||||
| {
|
||||
| ld a, vic_intr
|
||||
| st a, vic_intr
|
||||
| and a, 1
|
||||
| cmp a, 1
|
||||
| if not z {
|
||||
| goto saved_irq_vec
|
||||
| } else {
|
||||
| ld a, border_color
|
||||
| xor a, $ff
|
||||
| st a, border_color
|
||||
| goto pla_tay_pla_tax_pla_rti
|
||||
| }
|
||||
| }
|
||||
|
|
||||
| define main routine
|
||||
| {
|
||||
| }
|
||||
? InconsistentExitError
|
||||
|
||||
| typedef routine
|
||||
| inputs border_color, vic_intr
|
||||
| outputs border_color, vic_intr
|
||||
| trashes a, z, n, c
|
||||
| irq_handler
|
||||
|
|
||||
| vector irq_handler cinv @ $314
|
||||
| vector irq_handler saved_irq_vec
|
||||
| byte vic_intr @ $d019
|
||||
| byte border_color @ $d020
|
||||
|
|
||||
| define pla_tay_pla_tax_pla_rti routine
|
||||
| inputs border_color, vic_intr
|
||||
| outputs border_color, vic_intr
|
||||
| trashes a, z, n, c
|
||||
| @ $EA81
|
||||
|
|
||||
| define our_service_routine irq_handler
|
||||
| {
|
||||
| ld a, vic_intr
|
||||
| st a, vic_intr
|
||||
| and a, 1
|
||||
| cmp a, 1
|
||||
| if not z {
|
||||
| goto saved_irq_vec
|
||||
| } else {
|
||||
| ld a, border_color
|
||||
| xor a, $ff
|
||||
| st a, border_color
|
||||
| goto pla_tay_pla_tax_pla_rti
|
||||
| }
|
||||
| }
|
||||
|
|
||||
| define main routine
|
||||
| {
|
||||
| }
|
||||
= ok
|
||||
|
||||
Can't `goto` a routine that outputs or trashes more than the current routine.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user