2015-10-16 08:38:38 +00:00
|
|
|
SixtyPical Analysis
|
2015-10-16 08:30:24 +00:00
|
|
|
===================
|
|
|
|
|
2015-10-16 08:38:38 +00:00
|
|
|
This is a test suite, written in [Falderal][] format, for the SixtyPical
|
2015-10-16 08:30:24 +00:00
|
|
|
static analysis rules.
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
This file mostly contains tests for operations.
|
|
|
|
For rudiments and storage, see [SixtyPical Storage](SixtyPical%20Storage.md).
|
|
|
|
For control flow, see [SixtyPical Control Flow](SixtyPical%20Control%20Flow.md).
|
|
|
|
|
2015-10-16 08:30:24 +00:00
|
|
|
[Falderal]: http://catseye.tc/node/Falderal
|
|
|
|
|
2015-10-16 08:38:38 +00:00
|
|
|
-> Tests for functionality "Analyze SixtyPical program"
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
### add ###
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
Can't `add` from or to a memory location that isn't initialized.
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| define main routine
|
2015-10-16 08:30:24 +00:00
|
|
|
| inputs a
|
|
|
|
| outputs a
|
|
|
|
| trashes c, z, v, n
|
|
|
|
| {
|
|
|
|
| st off, c
|
2019-05-14 07:56:35 +00:00
|
|
|
| add a, 0
|
2015-10-16 08:30:24 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| byte lives
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a
|
2015-10-16 08:30:24 +00:00
|
|
|
| outputs a
|
2019-05-14 07:56:35 +00:00
|
|
|
| trashes c, z, v, n
|
2015-10-16 08:30:24 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| add a, lives
|
2015-10-16 08:30:24 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulReadError: lives
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| byte lives
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs lives
|
2015-10-16 08:30:24 +00:00
|
|
|
| outputs a
|
2019-05-14 07:56:35 +00:00
|
|
|
| trashes c, z, v, n
|
2015-10-16 08:30:24 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| add a, lives
|
2015-10-16 08:30:24 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulReadError: a
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
Can't `add` to a memory location that isn't writeable.
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a
|
|
|
|
| trashes c
|
2015-10-16 08:30:24 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| add a, 0
|
2015-10-16 08:30:24 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: a
|
|
|
|
|
|
|
|
You can `add` a byte constant to a byte memory location.
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| byte lives
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a, lives
|
|
|
|
| outputs lives
|
|
|
|
| trashes a, c, z, v, n
|
2015-10-16 08:30:24 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| add lives, 3
|
2015-10-16 08:30:24 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
`add`ing a byte constant to a byte memory location trashes `a`.
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| byte lives
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a, lives
|
|
|
|
| outputs a, lives
|
|
|
|
| trashes c, z, v, n
|
2015-10-16 08:30:24 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| add lives, 3
|
2015-10-16 08:30:24 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulOutputError: a
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
You can `add` a byte memory location to another byte memory location.
|
|
|
|
This trashes `a`.
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| byte lives
|
|
|
|
| byte extra
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a, lives, extra
|
|
|
|
| outputs lives
|
|
|
|
| trashes a, c, z, v, n
|
2015-10-16 08:30:24 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| add lives, extra
|
2015-10-16 08:30:24 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| byte lives
|
|
|
|
| byte extra
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a, lives, extra
|
|
|
|
| outputs a, lives
|
|
|
|
| trashes c, z, v, n
|
2018-02-08 13:34:03 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| add lives, extra
|
2018-02-08 13:34:03 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulOutputError: a
|
2018-02-08 13:34:03 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
You can `add` a word constant to a word memory location.
|
2018-02-08 13:34:03 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word score
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a, score
|
|
|
|
| outputs score
|
|
|
|
| trashes a, c, z, v, n
|
2018-02-08 13:34:03 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| add score, 1999
|
2018-02-08 13:34:03 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
`add`ing a word constant to a word memory location trashes `a`.
|
2018-02-08 13:34:03 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word score
|
|
|
|
| define main routine
|
|
|
|
| inputs a, score
|
|
|
|
| outputs score, a
|
|
|
|
| trashes c, z, v, n
|
2018-02-08 13:34:03 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| add score, 1999
|
2018-02-08 13:34:03 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulOutputError: a
|
2018-02-08 13:34:03 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
To be sure, `add`ing a word constant to a word memory location trashes `a`.
|
2018-02-08 13:34:03 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word score
|
|
|
|
| define main routine
|
|
|
|
| inputs score
|
|
|
|
| outputs score
|
|
|
|
| trashes c, z, v, n
|
2018-02-08 13:34:03 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| add score, 1999
|
2018-02-08 13:34:03 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: a
|
2018-02-08 13:34:03 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
You can `add` a word memory location to another word memory location.
|
2018-02-08 13:34:03 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word score
|
|
|
|
| word delta
|
|
|
|
| define main routine
|
|
|
|
| inputs score, delta
|
|
|
|
| outputs score
|
|
|
|
| trashes a, c, z, v, n
|
2018-02-08 13:34:03 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| add score, delta
|
2018-02-08 13:34:03 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
`add`ing a word memory location to a word memory location trashes `a`.
|
2018-02-08 13:34:03 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word score
|
|
|
|
| word delta
|
|
|
|
| define main routine
|
|
|
|
| inputs score, delta
|
|
|
|
| outputs score
|
|
|
|
| trashes c, z, v, n
|
2018-02-08 13:34:03 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| add score, delta
|
2018-02-08 13:34:03 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: a
|
2018-02-08 13:34:03 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
You can `add` a word memory location, or a constant, to a pointer.
|
2017-12-12 15:34:51 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| pointer ptr
|
|
|
|
| word delta
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs ptr, delta
|
|
|
|
| outputs ptr
|
|
|
|
| trashes a, c, z, v, n
|
2017-12-12 15:34:51 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| add ptr, delta
|
|
|
|
| add ptr, word 1
|
2017-12-12 15:34:51 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
`add`ing a word memory location, or a constant, to a pointer, trashes `a`.
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| pointer ptr
|
|
|
|
| word delta
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs ptr, delta
|
|
|
|
| outputs ptr
|
|
|
|
| trashes c, z, v, n
|
2015-10-16 08:30:24 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| add ptr, delta
|
|
|
|
| add ptr, word 1
|
2015-10-16 08:30:24 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: a
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
### sub ###
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
Can't `sub` from or to a memory location that isn't initialized.
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a
|
|
|
|
| outputs a
|
|
|
|
| trashes c, z, v, n
|
2015-10-16 08:30:24 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| sub a, 0
|
2015-10-16 08:30:24 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| byte lives
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a
|
2015-10-16 08:30:24 +00:00
|
|
|
| outputs a
|
2019-05-14 07:56:35 +00:00
|
|
|
| trashes c, z, v, n
|
2015-10-16 08:30:24 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| sub a, lives
|
2015-10-16 08:30:24 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulReadError: lives
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| byte lives
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs lives
|
|
|
|
| outputs a
|
|
|
|
| trashes c, z, v, n
|
2015-10-16 08:30:24 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| sub a, lives
|
2015-10-16 08:30:24 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulReadError: a
|
|
|
|
|
|
|
|
Can't `sub` to a memory location that isn't writeable.
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a
|
|
|
|
| trashes c
|
2015-10-16 08:30:24 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| sub a, 0
|
2015-10-16 08:30:24 +00:00
|
|
|
| }
|
2018-03-06 14:39:47 +00:00
|
|
|
? ForbiddenWriteError: a
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
You can `sub` a byte constant from a byte memory location.
|
|
|
|
|
|
|
|
| byte lives
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a, lives
|
|
|
|
| outputs lives
|
|
|
|
| trashes a, c, z, v, n
|
2015-10-16 08:30:24 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st on, c
|
|
|
|
| sub lives, 3
|
2015-10-16 08:30:24 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
= ok
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
`sub`ing a byte constant from a byte memory location trashes `a`.
|
2016-06-16 16:08:57 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| byte lives
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a, lives
|
|
|
|
| outputs a, lives
|
|
|
|
| trashes c, z, v, n
|
2016-06-16 16:08:57 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st on, c
|
|
|
|
| sub lives, 3
|
2016-06-16 16:08:57 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulOutputError: a
|
2015-10-16 08:30:24 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
You can `sub` a byte memory location from another byte memory location.
|
|
|
|
This trashes `a`.
|
2015-10-16 08:30:24 +00:00
|
|
|
|
|
|
|
| byte lives
|
2019-05-14 07:56:35 +00:00
|
|
|
| byte extra
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a, lives, extra
|
|
|
|
| outputs lives
|
|
|
|
| trashes a, c, z, v, n
|
2015-10-16 08:30:24 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st on, c
|
|
|
|
| sub lives, extra
|
2015-10-16 08:30:24 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
|
|
|
| byte lives
|
2019-05-14 07:56:35 +00:00
|
|
|
| byte extra
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a, lives, extra
|
|
|
|
| outputs a, lives
|
|
|
|
| trashes c, z, v, n
|
2015-10-18 17:12:47 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st on, c
|
|
|
|
| sub lives, extra
|
2015-10-18 17:12:47 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulOutputError: a
|
2015-10-18 17:12:47 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
You can `sub` a word constant from a word memory location.
|
2015-10-18 17:12:47 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word score
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a, score
|
|
|
|
| outputs score
|
|
|
|
| trashes a, c, z, v, n
|
2015-10-18 17:12:47 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st on, c
|
|
|
|
| sub score, 1999
|
2015-10-18 17:12:47 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
`sub`ing a word constant from a word memory location trashes `a`.
|
2018-02-05 12:35:19 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word score
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a, score
|
|
|
|
| outputs score, a
|
|
|
|
| trashes c, z, v, n
|
2018-02-05 12:35:19 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st on, c
|
|
|
|
| sub score, 1999
|
2018-02-05 12:35:19 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulOutputError: a
|
2018-02-05 12:35:19 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
You can `sub` a word memory location from another word memory location.
|
2015-10-18 17:12:47 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word score
|
|
|
|
| word delta
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs score, delta
|
|
|
|
| outputs score
|
|
|
|
| trashes a, c, z, v, n
|
2015-10-18 17:12:47 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| sub score, delta
|
2015-10-18 17:12:47 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
`sub`ing a word memory location from a word memory location trashes `a`.
|
2015-10-18 17:12:47 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word score
|
|
|
|
| word delta
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs score, delta
|
|
|
|
| outputs score
|
|
|
|
| trashes c, z, v, n
|
2015-10-18 17:12:47 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| st off, c
|
|
|
|
| sub score, delta
|
2015-10-18 17:12:47 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: a
|
2015-10-18 17:12:47 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
### inc ###
|
2018-02-05 12:35:19 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
Location must be initialized and writeable.
|
2018-02-05 12:35:19 +00:00
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| outputs x
|
|
|
|
| trashes z, n
|
2018-02-05 12:35:19 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| inc x
|
2018-02-05 12:35:19 +00:00
|
|
|
| }
|
|
|
|
? UnmeaningfulReadError: x
|
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs x
|
|
|
|
| trashes z, n
|
2018-04-18 13:21:03 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| inc x
|
2018-04-18 14:45:47 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: x
|
2018-04-18 14:45:47 +00:00
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs x
|
|
|
|
| outputs x
|
|
|
|
| trashes z, n
|
2018-04-18 14:45:47 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| inc x
|
2018-04-18 14:45:47 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
Can't `inc` a `word` type.
|
2018-04-18 14:45:47 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word foo
|
2018-04-18 14:45:47 +00:00
|
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs foo
|
|
|
|
| outputs foo
|
|
|
|
| trashes z, n
|
2018-04-18 14:45:47 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| inc foo
|
2018-04-18 13:21:03 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? TypeMismatchError: foo
|
2018-04-18 13:21:03 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
### dec ###
|
2016-06-16 16:08:57 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
Location must be initialized and writeable.
|
2017-12-08 13:41:48 +00:00
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| outputs x
|
|
|
|
| trashes z, n
|
2017-12-08 13:41:48 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| dec x
|
2017-12-08 13:41:48 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulReadError: x
|
2017-12-08 13:41:48 +00:00
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs x
|
|
|
|
| trashes z, n
|
2017-12-08 13:41:48 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| dec x
|
2017-12-08 13:41:48 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: x
|
2017-12-12 16:04:59 +00:00
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs x
|
|
|
|
| outputs x
|
|
|
|
| trashes z, n
|
2017-12-12 16:04:59 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| dec x
|
2017-12-12 16:04:59 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
Can't `dec` a `word` type.
|
2019-04-08 10:50:54 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word foo
|
2019-04-08 10:50:54 +00:00
|
|
|
|
|
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs foo
|
|
|
|
| outputs foo
|
|
|
|
| trashes z, n
|
2019-04-08 10:50:54 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| dec foo
|
2019-04-08 10:50:54 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? TypeMismatchError: foo
|
2019-04-08 10:50:54 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
### cmp ###
|
2018-02-16 12:28:11 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
Some rudimentary tests for `cmp`.
|
2018-02-14 13:41:48 +00:00
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a
|
|
|
|
| trashes z, c, n
|
2018-02-14 13:41:48 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| cmp a, 4
|
2018-02-14 13:41:48 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2019-04-08 10:50:54 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a
|
|
|
|
| trashes z, n
|
2019-04-08 10:50:54 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| cmp a, 4
|
2019-04-08 10:50:54 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: c
|
2019-04-08 10:50:54 +00:00
|
|
|
|
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| trashes z, c, n
|
2019-04-08 10:50:54 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| cmp a, 4
|
2019-04-08 10:50:54 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulReadError: a
|
2019-04-08 10:50:54 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
`cmp` can work on words. In this case, it trashes `a`.
|
2018-02-16 12:28:11 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word za
|
|
|
|
| word zb
|
2018-02-16 12:28:11 +00:00
|
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs za, zb
|
|
|
|
| trashes a, z, c, n
|
2018-02-16 12:28:11 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| cmp za, zb
|
2018-02-16 12:28:11 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word za
|
|
|
|
| word zb
|
2019-04-08 10:50:54 +00:00
|
|
|
|
|
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs za, zb
|
|
|
|
| trashes a, z, n
|
2019-04-08 10:50:54 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| cmp za, zb
|
2019-04-08 10:50:54 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: c
|
2018-03-06 15:42:12 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word za
|
|
|
|
| word zb
|
2018-03-06 15:42:12 +00:00
|
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs za, zb
|
|
|
|
| trashes z, c, n
|
2018-03-06 15:42:12 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| cmp za, zb
|
2018-03-06 15:42:12 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: a
|
2018-03-06 15:42:12 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word za
|
|
|
|
| word zb
|
2018-03-06 15:42:12 +00:00
|
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs za
|
|
|
|
| trashes z, c, n
|
2018-11-27 16:59:16 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| cmp za, zb
|
2018-11-27 16:59:16 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulReadError: zb
|
2018-11-27 14:52:59 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
`cmp` can compare against a literal word.
|
2018-11-27 17:40:25 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| word za
|
2018-11-27 17:40:25 +00:00
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| define main routine
|
|
|
|
| inputs za
|
|
|
|
| trashes a, z, c, n
|
2018-11-27 17:40:25 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| cmp za, 4000
|
2018-11-27 17:40:25 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
= ok
|
|
|
|
|
|
|
|
| word za
|
2018-11-27 17:40:25 +00:00
|
|
|
|
|
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs za
|
|
|
|
| trashes z, c, n
|
2018-11-27 17:40:25 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| cmp za, 4000
|
2018-11-27 17:40:25 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: a
|
2018-11-27 17:40:25 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
### and ###
|
2018-11-27 17:40:25 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
Some rudimentary tests for `and`.
|
|
|
|
|
|
|
|
| define main routine
|
|
|
|
| inputs a
|
|
|
|
| outputs a, z, n
|
2018-11-27 17:40:25 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| and a, 4
|
2018-11-27 17:40:25 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
= ok
|
|
|
|
|
|
|
|
| define main routine
|
|
|
|
| inputs a
|
|
|
|
| trashes z, n
|
2018-11-27 17:40:25 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| and a, 4
|
2018-11-27 17:40:25 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: a
|
|
|
|
|
2018-11-27 17:40:25 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| trashes z, n
|
2018-11-27 17:40:25 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| and a, 4
|
2018-11-27 17:40:25 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulReadError: a
|
2018-11-27 17:40:25 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
### or ###
|
2018-11-27 17:40:25 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
Some rudimentary tests for `or`.
|
|
|
|
|
|
|
|
| define main routine
|
|
|
|
| inputs a
|
|
|
|
| outputs a, z, n
|
2018-11-27 17:40:25 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| or a, 4
|
2018-11-27 17:40:25 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
= ok
|
|
|
|
|
|
|
|
| define main routine
|
|
|
|
| inputs a
|
|
|
|
| trashes z, n
|
2018-11-27 17:40:25 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| or a, 4
|
2018-11-27 17:40:25 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: a
|
|
|
|
|
2018-11-27 17:40:25 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| trashes z, n
|
2018-11-27 17:40:25 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| or a, 4
|
2018-11-27 17:40:25 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulReadError: a
|
2018-11-27 17:40:25 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
### xor ###
|
2019-04-15 16:35:17 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
Some rudimentary tests for `xor`.
|
|
|
|
|
|
|
|
| define main routine
|
2019-04-15 16:35:17 +00:00
|
|
|
| inputs a
|
2019-05-14 07:56:35 +00:00
|
|
|
| outputs a, z, n
|
2019-04-15 16:35:17 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| xor a, 4
|
2019-04-15 16:35:17 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
= ok
|
|
|
|
|
2019-04-15 16:35:17 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a
|
|
|
|
| trashes z, n
|
2019-04-15 16:35:17 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| xor a, 4
|
2019-04-15 16:35:17 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: a
|
2019-04-15 16:35:17 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| define main routine
|
|
|
|
| trashes z, n
|
2019-04-15 16:35:17 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| xor a, 4
|
2019-04-15 16:35:17 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulReadError: a
|
|
|
|
|
|
|
|
### shl ###
|
|
|
|
|
|
|
|
Some rudimentary tests for `shl`.
|
|
|
|
|
|
|
|
| byte foo
|
2019-04-15 16:35:17 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs foo, a, c
|
|
|
|
| outputs foo, a, c, z, n
|
2019-04-15 16:35:17 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| shl a
|
|
|
|
| shl foo
|
2019-04-15 16:35:17 +00:00
|
|
|
| }
|
|
|
|
= ok
|
2018-11-27 14:52:59 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| define main routine
|
|
|
|
| inputs a, c
|
|
|
|
| outputs c, z, n
|
|
|
|
| {
|
|
|
|
| shl a
|
2015-10-21 10:41:52 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: a
|
2015-10-21 10:41:52 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| define main routine
|
|
|
|
| inputs a
|
|
|
|
| outputs a, c, z, n
|
|
|
|
| {
|
|
|
|
| shl a
|
2015-10-21 10:41:52 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulReadError: c
|
2015-10-21 16:05:49 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
### shr ###
|
2015-10-21 16:05:49 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
Some rudimentary tests for `shr`.
|
2015-10-21 16:05:49 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| byte foo
|
|
|
|
| define main routine
|
|
|
|
| inputs foo, a, c
|
|
|
|
| outputs foo, a, c, z, n
|
|
|
|
| {
|
|
|
|
| shr a
|
|
|
|
| shr foo
|
2015-10-21 16:05:49 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2018-09-07 21:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a, c
|
|
|
|
| outputs c, z, n
|
|
|
|
| {
|
|
|
|
| shr a
|
2015-10-22 08:48:26 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? ForbiddenWriteError: a
|
2015-10-21 16:05:49 +00:00
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs a
|
|
|
|
| outputs a, c, z, n
|
|
|
|
| {
|
|
|
|
| shr a
|
2015-10-22 08:54:11 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? UnmeaningfulReadError: c
|
2018-02-02 17:45:07 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
### nop ###
|
2018-02-02 17:45:07 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
Some rudimentary tests for `nop`.
|
2018-02-02 17:45:07 +00:00
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2018-02-02 17:45:07 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| nop
|
2018-02-05 12:04:28 +00:00
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
### with interrupts ###
|
2018-02-05 12:04:28 +00:00
|
|
|
|
2018-02-05 17:01:25 +00:00
|
|
|
| vector routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| inputs x
|
2018-02-05 12:04:28 +00:00
|
|
|
| outputs x
|
2019-05-14 07:56:35 +00:00
|
|
|
| trashes z, n
|
|
|
|
| bar
|
2018-02-05 12:04:28 +00:00
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| define foo routine
|
|
|
|
| inputs x
|
|
|
|
| outputs x
|
|
|
|
| trashes z, n
|
|
|
|
| {
|
|
|
|
| inc x
|
2018-02-05 12:04:28 +00:00
|
|
|
| }
|
|
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| outputs bar
|
|
|
|
| trashes a, n, z
|
2018-02-05 12:04:28 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| with interrupts off {
|
|
|
|
| copy foo, bar
|
|
|
|
| }
|
2018-02-02 17:45:07 +00:00
|
|
|
| }
|
|
|
|
= ok
|
2018-02-05 12:04:28 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
A `goto` cannot appear within a `with interrupts` block.
|
2018-02-05 12:04:28 +00:00
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| vector routine
|
|
|
|
| inputs x
|
|
|
|
| outputs x
|
|
|
|
| trashes z, n
|
|
|
|
| bar
|
2018-02-05 12:04:28 +00:00
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| define foo routine
|
|
|
|
| inputs x
|
|
|
|
| outputs x
|
|
|
|
| trashes z, n
|
2018-02-05 12:04:28 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| inc x
|
2018-02-05 12:04:28 +00:00
|
|
|
| }
|
|
|
|
|
|
2019-05-14 07:56:35 +00:00
|
|
|
| define other routine
|
|
|
|
| trashes bar, a, n, z
|
|
|
|
| {
|
|
|
|
| ld a, 0
|
2018-02-05 12:04:28 +00:00
|
|
|
| }
|
|
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2019-05-14 07:56:35 +00:00
|
|
|
| trashes bar, a, n, z
|
2018-02-05 12:04:28 +00:00
|
|
|
| {
|
2019-05-14 07:56:35 +00:00
|
|
|
| with interrupts off {
|
|
|
|
| copy foo, bar
|
|
|
|
| goto other
|
|
|
|
| }
|
2018-02-05 12:04:28 +00:00
|
|
|
| }
|
2019-05-14 07:56:35 +00:00
|
|
|
? IllegalJumpError
|
2018-02-06 10:05:56 +00:00
|
|
|
|
2019-05-14 14:01:10 +00:00
|
|
|
A `call` cannot appear within a `with interrupts` block.
|
|
|
|
|
|
|
|
| vector routine
|
|
|
|
| inputs x
|
|
|
|
| outputs x
|
|
|
|
| trashes z, n
|
|
|
|
| bar
|
|
|
|
|
|
|
|
|
| define foo routine
|
|
|
|
| inputs x
|
|
|
|
| outputs x
|
|
|
|
| trashes z, n
|
|
|
|
| {
|
|
|
|
| inc x
|
|
|
|
| }
|
|
|
|
|
|
|
|
|
| define other routine
|
|
|
|
| trashes bar, a, n, z
|
|
|
|
| {
|
|
|
|
| ld a, 0
|
|
|
|
| }
|
|
|
|
|
|
|
|
|
| define main routine
|
|
|
|
| trashes bar, a, n, z
|
|
|
|
| {
|
|
|
|
| with interrupts off {
|
|
|
|
| copy foo, bar
|
|
|
|
| call other
|
|
|
|
| }
|
|
|
|
| }
|
|
|
|
? IllegalJumpError
|
|
|
|
|
|
|
|
A `with interrupts` block cannot appear within a `with interrupts` block.
|
|
|
|
|
|
|
|
| vector routine
|
|
|
|
| inputs x
|
|
|
|
| outputs x
|
|
|
|
| trashes z, n
|
|
|
|
| bar
|
|
|
|
|
|
|
|
|
| define foo routine
|
|
|
|
| inputs x
|
|
|
|
| outputs x
|
|
|
|
| trashes z, n
|
|
|
|
| {
|
|
|
|
| inc x
|
|
|
|
| }
|
|
|
|
|
|
|
|
|
| define main routine
|
|
|
|
| trashes bar, a, n, z
|
|
|
|
| {
|
|
|
|
| with interrupts off {
|
|
|
|
| copy foo, bar
|
|
|
|
| with interrupts off {
|
|
|
|
| copy foo, bar
|
|
|
|
| }
|
|
|
|
| }
|
|
|
|
| }
|
|
|
|
? IllegalJumpError
|
|
|
|
|
2018-02-06 10:05:56 +00:00
|
|
|
### typedef ###
|
|
|
|
|
|
|
|
A typedef is a more-readable alias for a type. "Alias" means
|
|
|
|
that types have structural equivalence, not name equivalence.
|
|
|
|
|
|
|
|
| typedef routine
|
|
|
|
| inputs x
|
|
|
|
| outputs x
|
|
|
|
| trashes z, n
|
|
|
|
| routine_type
|
|
|
|
|
|
|
|
|
| vector routine_type vec
|
|
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define foo routine
|
2018-02-06 10:05:56 +00:00
|
|
|
| inputs x
|
|
|
|
| outputs x
|
|
|
|
| trashes z, n
|
|
|
|
| {
|
|
|
|
| inc x
|
|
|
|
| }
|
|
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2018-02-06 10:05:56 +00:00
|
|
|
| outputs vec
|
|
|
|
| trashes a, z, n
|
|
|
|
| {
|
|
|
|
| copy foo, vec
|
|
|
|
| }
|
|
|
|
= ok
|
|
|
|
|
|
|
|
The new style routine definitions support typedefs.
|
|
|
|
|
|
|
|
| typedef routine
|
|
|
|
| inputs x
|
|
|
|
| outputs x
|
|
|
|
| trashes z, n
|
|
|
|
| routine_type
|
|
|
|
|
|
|
|
|
| vector routine_type vec
|
|
|
|
|
|
|
|
|
| define foo routine_type
|
|
|
|
| {
|
|
|
|
| inc x
|
|
|
|
| }
|
|
|
|
|
|
2018-09-07 17:49:39 +00:00
|
|
|
| define main routine
|
2018-02-06 10:05:56 +00:00
|
|
|
| outputs vec
|
|
|
|
| trashes a, z, n
|
|
|
|
| {
|
|
|
|
| copy foo, vec
|
|
|
|
| }
|
|
|
|
= ok
|