git @ Cat's Eye Technologies SixtyPical / 5e69244
Convert remainder of routine declarations in this file. Chris Pressey 6 years ago
1 changed file(s) with 31 addition(s) and 31 deletion(s). Raw diff Collapse all Expand all
14231423 Calling an extern is just the same as calling a defined routine with the
14241424 same constraints.
14251425
1426 | routine chrout
1426 | define chrout routine
14271427 | inputs a
14281428 | trashes a
14291429 | @ 65490
14361436 | }
14371437 = ok
14381438
1439 | routine chrout
1439 | define chrout routine
14401440 | inputs a
14411441 | trashes a
14421442 | @ 65490
14481448 | }
14491449 ? UnmeaningfulReadError: a
14501450
1451 | routine chrout
1451 | define chrout routine
14521452 | inputs a
14531453 | trashes a
14541454 | @ 65490
22632263 | inc x
22642264 | }
22652265 |
2266 | routine other
2266 | define other routine
22672267 | trashes bar, a, n, z
22682268 | {
22692269 | ld a, 0
28832883
28842884 | vector routine trashes x, z, n foo
28852885 |
2886 | routine bar trashes x, z, n {
2886 | define bar routine trashes x, z, n {
28872887 | ld x, 200
28882888 | }
28892889 |
2890 | routine main outputs x, foo trashes z, n {
2890 | define main routine outputs x, foo trashes z, n {
28912891 | ld x, 0
28922892 | copy bar, foo
28932893 | call foo
28962896
28972897 `goto`, if present, must be in tail position (the final instruction in a routine.)
28982898
2899 | routine bar trashes x, z, n {
2899 | define bar routine trashes x, z, n {
29002900 | ld x, 200
29012901 | }
29022902 |
2903 | routine main trashes x, z, n {
2903 | define main routine trashes x, z, n {
29042904 | ld x, 0
29052905 | goto bar
29062906 | }
29072907 = ok
29082908
2909 | routine bar trashes x, z, n {
2909 | define bar routine trashes x, z, n {
29102910 | ld x, 200
29112911 | }
29122912 |
2913 | routine main trashes x, z, n {
2913 | define main routine trashes x, z, n {
29142914 | goto bar
29152915 | ld x, 0
29162916 | }
29172917 ? IllegalJumpError
29182918
2919 | routine bar trashes x, z, n {
2919 | define bar routine trashes x, z, n {
29202920 | ld x, 200
29212921 | }
29222922 |
2923 | routine main trashes x, z, n {
2923 | define main routine trashes x, z, n {
29242924 | ld x, 0
29252925 | if z {
29262926 | ld x, 1
29292929 | }
29302930 = ok
29312931
2932 | routine bar trashes x, z, n {
2932 | define bar routine trashes x, z, n {
29332933 | ld x, 200
29342934 | }
29352935 |
2936 | routine main trashes x, z, n {
2936 | define main routine trashes x, z, n {
29372937 | ld x, 0
29382938 | if z {
29392939 | ld x, 1
29432943 | }
29442944 ? IllegalJumpError
29452945
2946 | routine bar trashes x, z, n {
2946 | define bar routine trashes x, z, n {
29472947 | ld x, 200
29482948 | }
29492949 |
2950 | routine main trashes x, z, n {
2950 | define main routine trashes x, z, n {
29512951 | ld x, 0
29522952 | if z {
29532953 | ld x, 1
29592959 | }
29602960 = ok
29612961
2962 | routine bar trashes x, z, n {
2962 | define bar routine trashes x, z, n {
29632963 | ld x, 200
29642964 | }
29652965 |
2966 | routine main trashes x, z, n {
2966 | define main routine trashes x, z, n {
29672967 | ld x, 0
29682968 | if z {
29692969 | ld x, 1
29762976
29772977 For the purposes of `goto`, the end of a loop is never tail position.
29782978
2979 | routine bar trashes x, z, n {
2979 | define bar routine trashes x, z, n {
29802980 | ld x, 200
29812981 | }
29822982 |
2983 | routine main trashes x, z, n {
2983 | define main routine trashes x, z, n {
29842984 | ld x, 0
29852985 | repeat {
29862986 | inc x
29912991
29922992 Can't `goto` a routine that outputs or trashes more than the current routine.
29932993
2994 | routine bar trashes x, y, z, n {
2994 | define bar routine trashes x, y, z, n {
29952995 | ld x, 200
29962996 | ld y, 200
29972997 | }
29982998 |
2999 | routine main trashes x, z, n {
2999 | define main routine trashes x, z, n {
30003000 | ld x, 0
30013001 | goto bar
30023002 | }
30033003 ? IncompatibleConstraintsError
30043004
3005 | routine bar outputs y trashes z, n {
3005 | define bar routine outputs y trashes z, n {
30063006 | ld y, 200
30073007 | }
30083008 |
3009 | routine main trashes x, z, n {
3009 | define main routine trashes x, z, n {
30103010 | ld x, 0
30113011 | goto bar
30123012 | }
30143014
30153015 Can `goto` a routine that outputs or trashes less than the current routine.
30163016
3017 | routine bar trashes x, z, n {
3017 | define bar routine trashes x, z, n {
30183018 | ld x, 1
30193019 | }
30203020 |
3021 | routine main trashes a, x, z, n {
3021 | define main routine trashes a, x, z, n {
30223022 | ld a, 0
30233023 | ld x, 0
30243024 | goto bar
30293029
30303030 | vector routine outputs x trashes a, z, n foo
30313031 |
3032 | routine bar outputs x trashes a, z, n {
3032 | define bar routine outputs x trashes a, z, n {
30333033 | ld x, 200
30343034 | }
30353035 |
3036 | routine main outputs x trashes foo, a, z, n {
3036 | define main routine outputs x trashes foo, a, z, n {
30373037 | copy bar, foo
30383038 | goto foo
30393039 | }
30463046 | trashes a, x, z, n
30473047 | foo
30483048 |
3049 | routine bar
3049 | define bar routine
30503050 | trashes a, x, z, n {
30513051 | ld x, 200
30523052 | }
30533053 |
3054 | routine sub
3054 | define sub routine
30553055 | trashes foo, a, x, z, n {
30563056 | ld x, 0
30573057 | copy bar, foo
30583058 | goto foo
30593059 | }
30603060 |
3061 | routine main
3061 | define main routine
30623062 | outputs a
30633063 | trashes foo, x, z, n {
30643064 | call sub