Convert all tests to new syntax.
Chris Pressey
4 years ago
12 | 12 | |
13 | 13 | Null program. |
14 | 14 | |
15 | | routine main | |
15 | | define main routine | |
16 | 16 | | { |
17 | 17 | | } |
18 | 18 | = $080D RTS |
19 | 19 | |
20 | 20 | `nop` program. |
21 | 21 | |
22 | | routine main | |
22 | | define main routine | |
23 | 23 | | { |
24 | 24 | | nop |
25 | 25 | | } |
28 | 28 | |
29 | 29 | Rudimentary program. |
30 | 30 | |
31 | | routine main | |
31 | | define main routine | |
32 | 32 | | inputs a |
33 | 33 | | outputs a |
34 | 34 | | trashes c, z, n, v |
42 | 42 | |
43 | 43 | Call extern. |
44 | 44 | |
45 | | routine chrout | |
45 | | define chrout routine | |
46 | 46 | | inputs a |
47 | 47 | | trashes a |
48 | 48 | | @ 65490 |
49 | 49 | | |
50 | | routine main | |
50 | | define main routine | |
51 | 51 | | inputs a |
52 | 52 | | trashes a, z, n |
53 | 53 | | { |
60 | 60 | |
61 | 61 | Call defined routine. |
62 | 62 | |
63 | | routine foo | |
63 | | define foo routine | |
64 | 64 | | outputs a, x, y |
65 | 65 | | trashes z, n |
66 | 66 | | { |
69 | 69 | | ld y, 0 |
70 | 70 | | } |
71 | 71 | | |
72 | | routine main | |
72 | | define main routine | |
73 | 73 | | trashes a, x, y, z, n |
74 | 74 | | { |
75 | 75 | | call foo |
85 | 85 | |
86 | 86 | | byte foo |
87 | 87 | | |
88 | | routine main | |
88 | | define main routine | |
89 | 89 | | trashes a, y, z, n, foo |
90 | 90 | | { |
91 | 91 | | ld y, 0 |
101 | 101 | |
102 | 102 | | byte screen @ 1024 |
103 | 103 | | |
104 | | routine main | |
104 | | define main routine | |
105 | 105 | | trashes a, z, n, screen |
106 | 106 | | { |
107 | 107 | | ld a, 100 |
117 | 117 | | byte zp @ $00 |
118 | 118 | | byte screen @ 100 |
119 | 119 | | |
120 | | routine main | |
120 | | define main routine | |
121 | 121 | | inputs screen, zp |
122 | 122 | | outputs screen, zp |
123 | 123 | | trashes a, z, n |
143 | 143 | |
144 | 144 | | byte lives : 3 |
145 | 145 | | |
146 | | routine main | |
146 | | define main routine | |
147 | 147 | | inputs lives |
148 | 148 | | trashes a, z, n |
149 | 149 | | { |
158 | 158 | | word w1 @ 60001 |
159 | 159 | | word w2 : 3003 |
160 | 160 | | |
161 | | routine main | |
161 | | define main routine | |
162 | 162 | | inputs w1 |
163 | 163 | | outputs w2 |
164 | 164 | | trashes a, z, n |
177 | 177 | |
178 | 178 | | byte table[8] message : "WHAT?" |
179 | 179 | | |
180 | | routine main | |
180 | | define main routine | |
181 | 181 | | inputs message |
182 | 182 | | outputs x, a, z, n |
183 | 183 | | { |
199 | 199 | |
200 | 200 | | byte table[8] message : 255, 0, 129, 128, 127 |
201 | 201 | | |
202 | | routine main | |
202 | | define main routine | |
203 | 203 | | inputs message |
204 | 204 | | outputs x, a, z, n |
205 | 205 | | { |
221 | 221 | |
222 | 222 | | word table[4] message : 65535, 0, 127, 127 |
223 | 223 | | |
224 | | routine main | |
224 | | define main routine | |
225 | 225 | | { |
226 | 226 | | } |
227 | 227 | = $080D RTS |
238 | 238 | |
239 | 239 | | byte foo |
240 | 240 | | |
241 | | routine main | |
241 | | define main routine | |
242 | 242 | | trashes a, x, y, z, n, c, v, foo |
243 | 243 | | { |
244 | 244 | | ld a, 0 |
316 | 316 | |
317 | 317 | | byte table[256] many |
318 | 318 | | |
319 | | routine main | |
319 | | define main routine | |
320 | 320 | | inputs many |
321 | 321 | | outputs many |
322 | 322 | | trashes a, x, c, n, z, v |
340 | 340 | |
341 | 341 | | byte table[256] many |
342 | 342 | | |
343 | | routine main | |
343 | | define main routine | |
344 | 344 | | inputs many |
345 | 345 | | outputs many |
346 | 346 | | trashes a, x, c, n, z |
362 | 362 | |
363 | 363 | | byte table[256] many |
364 | 364 | | |
365 | | routine main | |
365 | | define main routine | |
366 | 366 | | inputs many |
367 | 367 | | outputs many |
368 | 368 | | trashes a, x, c, n, z |
386 | 386 | |
387 | 387 | Compiling `if`. |
388 | 388 | |
389 | | routine main | |
389 | | define main routine | |
390 | 390 | | trashes a, x, y, z, n, c, v |
391 | 391 | | { |
392 | 392 | | ld a, 0 |
405 | 405 | |
406 | 406 | Compiling `if not`. |
407 | 407 | |
408 | | routine main | |
408 | | define main routine | |
409 | 409 | | trashes a, x, y, z, n, c, v |
410 | 410 | | { |
411 | 411 | | ld a, 0 |
424 | 424 | |
425 | 425 | Compiling `if` without `else`. |
426 | 426 | |
427 | | routine main | |
427 | | define main routine | |
428 | 428 | | trashes a, x, y, z, n, c, v |
429 | 429 | | { |
430 | 430 | | ld a, 0 |
441 | 441 | |
442 | 442 | Compiling `repeat ... until z`. |
443 | 443 | |
444 | | routine main | |
444 | | define main routine | |
445 | 445 | | trashes a, y, z, n, c |
446 | 446 | | { |
447 | 447 | | ld y, 65 |
460 | 460 | |
461 | 461 | Compiling `repeat ... until not z`. |
462 | 462 | |
463 | | routine main | |
463 | | define main routine | |
464 | 464 | | trashes a, y, z, n, c |
465 | 465 | | { |
466 | 466 | | ld y, 65 |
479 | 479 | |
480 | 480 | Compiling `repeat ... until n`. |
481 | 481 | |
482 | | routine main | |
482 | | define main routine | |
483 | 483 | | trashes a, y, z, n, c |
484 | 484 | | { |
485 | 485 | | ld y, 65 |
496 | 496 | |
497 | 497 | Compiling `repeat ... until not n`. |
498 | 498 | |
499 | | routine main | |
499 | | define main routine | |
500 | 500 | | trashes a, y, z, n, c |
501 | 501 | | { |
502 | 502 | | ld y, 199 |
513 | 513 | |
514 | 514 | Compiling `repeat forever`. |
515 | 515 | |
516 | | routine main | |
516 | | define main routine | |
517 | 517 | | trashes a, y, z, n, c |
518 | 518 | | { |
519 | 519 | | ld y, 65 |
528 | 528 | |
529 | 529 | The body of `repeat forever` can be empty. |
530 | 530 | |
531 | | routine main | |
531 | | define main routine | |
532 | 532 | | { |
533 | 533 | | repeat { |
534 | 534 | | } forever |
578 | 578 | |
579 | 579 | Compiling `save`. |
580 | 580 | |
581 | | routine main | |
581 | | define main routine | |
582 | 582 | | inputs a |
583 | 583 | | outputs a |
584 | 584 | | trashes z, n |
602 | 602 | |
603 | 603 | Compiling `save` with shortcut syntax. |
604 | 604 | |
605 | | routine main | |
605 | | define main routine | |
606 | 606 | | inputs a |
607 | 607 | | outputs a |
608 | 608 | | trashes z, n |
625 | 625 | Compiling `save` on a user-defined location. |
626 | 626 | |
627 | 627 | | byte foo |
628 | | routine main | |
628 | | define main routine | |
629 | 629 | | trashes a, z, n |
630 | 630 | | { |
631 | 631 | | save foo { |
646 | 646 | | byte one |
647 | 647 | | byte table[256] many |
648 | 648 | | |
649 | | routine main | |
649 | | define main routine | |
650 | 650 | | outputs many |
651 | 651 | | trashes a, x, n, z |
652 | 652 | | { |
666 | 666 | | byte table[256] tab1 |
667 | 667 | | byte table[256] tab2 |
668 | 668 | | |
669 | | routine main | |
669 | | define main routine | |
670 | 670 | | inputs tab1 |
671 | 671 | | outputs tab2 |
672 | 672 | | trashes a, x, n, z |
685 | 685 | | byte one |
686 | 686 | | byte two |
687 | 687 | | |
688 | | routine main | |
688 | | define main routine | |
689 | 689 | | outputs one, two |
690 | 690 | | trashes a, x, n, z |
691 | 691 | | { |
703 | 703 | | byte bar |
704 | 704 | | byte baz |
705 | 705 | | |
706 | | routine main | |
706 | | define main routine | |
707 | 707 | | inputs baz |
708 | 708 | | outputs bar |
709 | 709 | | trashes a, n, z |
719 | 719 | | word bar |
720 | 720 | | word baz |
721 | 721 | | |
722 | | routine main | |
722 | | define main routine | |
723 | 723 | | inputs baz |
724 | 724 | | outputs bar |
725 | 725 | | trashes a, n, z |
736 | 736 | |
737 | 737 | | word bar |
738 | 738 | | |
739 | | routine main | |
739 | | define main routine | |
740 | 740 | | outputs bar |
741 | 741 | | trashes a, n, z |
742 | 742 | | { |
752 | 752 | |
753 | 753 | | word table[256] many |
754 | 754 | | |
755 | | routine main | |
755 | | define main routine | |
756 | 756 | | inputs many |
757 | 757 | | outputs many |
758 | 758 | | trashes a, x, n, z |
772 | 772 | | vector routine bar |
773 | 773 | | vector routine baz |
774 | 774 | | |
775 | | routine main | |
775 | | define main routine | |
776 | 776 | | inputs baz |
777 | 777 | | outputs bar |
778 | 778 | | trashes a, n, z |
793 | 793 | | trashes z, n |
794 | 794 | | bar |
795 | 795 | | |
796 | | routine foo | |
796 | | define foo routine | |
797 | 797 | | inputs x |
798 | 798 | | outputs x |
799 | 799 | | trashes z, n |
801 | 801 | | inc x |
802 | 802 | | } |
803 | 803 | | |
804 | | routine main | |
804 | | define main routine | |
805 | 805 | | outputs bar |
806 | 806 | | trashes a, n, z |
807 | 807 | | { |
827 | 827 | | trashes z, n |
828 | 828 | | bar |
829 | 829 | | |
830 | | routine main | |
830 | | define main routine | |
831 | 831 | | outputs bar |
832 | 832 | | trashes a, n, z |
833 | 833 | | { |
834 | 834 | | copy foo, bar |
835 | 835 | | } |
836 | 836 | | |
837 | | routine foo | |
837 | | define foo routine | |
838 | 838 | | inputs x |
839 | 839 | | outputs x |
840 | 840 | | trashes z, n |
854 | 854 | | word one |
855 | 855 | | word table[256] many |
856 | 856 | | |
857 | | routine main | |
857 | | define main routine | |
858 | 858 | | inputs one, many |
859 | 859 | | outputs one, many |
860 | 860 | | trashes a, x, y, n, z |
898 | 898 | | trashes z, n |
899 | 899 | | foo |
900 | 900 | | |
901 | | routine bar | |
901 | | define bar routine | |
902 | 902 | | outputs x |
903 | 903 | | trashes z, n |
904 | 904 | | { |
905 | 905 | | ld x, 200 |
906 | 906 | | } |
907 | 907 | | |
908 | | routine main | |
908 | | define main routine | |
909 | 909 | | outputs x, foo |
910 | 910 | | trashes a, z, n |
911 | 911 | | { |
925 | 925 | |
926 | 926 | Compiling `goto`. Note that no `RTS` is emitted after the `JMP`. |
927 | 927 | |
928 | | routine bar | |
928 | | define bar routine | |
929 | 929 | | inputs y |
930 | 930 | | outputs x, y |
931 | 931 | | trashes z, n |
933 | 933 | | ld x, 200 |
934 | 934 | | } |
935 | 935 | | |
936 | | routine main | |
936 | | define main routine | |
937 | 937 | | outputs x, y |
938 | 938 | | trashes a, z, n |
939 | 939 | | { |
958 | 958 | | trashes a, z, n |
959 | 959 | | table[256] many |
960 | 960 | | |
961 | | routine bar outputs x trashes a, z, n { | |
961 | | define bar routine outputs x trashes a, z, n { | |
962 | 962 | | ld x, 200 |
963 | 963 | | } |
964 | 964 | | |
965 | | routine main | |
965 | | define main routine | |
966 | 966 | | inputs one, many |
967 | 967 | | outputs one, many |
968 | 968 | | trashes a, x, n, z |
1003 | 1003 | Adding a constant word to a word memory location. |
1004 | 1004 | |
1005 | 1005 | | word score |
1006 | | routine main | |
1006 | | define main routine | |
1007 | 1007 | | inputs score |
1008 | 1008 | | outputs score |
1009 | 1009 | | trashes a, c, z, v, n |
1024 | 1024 | |
1025 | 1025 | | word score |
1026 | 1026 | | word delta |
1027 | | routine main | |
1027 | | define main routine | |
1028 | 1028 | | inputs score, delta |
1029 | 1029 | | outputs score |
1030 | 1030 | | trashes a, c, z, v, n |
1044 | 1044 | Subtracting a constant word from a word memory location. |
1045 | 1045 | |
1046 | 1046 | | word score |
1047 | | routine main | |
1047 | | define main routine | |
1048 | 1048 | | inputs score |
1049 | 1049 | | outputs score |
1050 | 1050 | | trashes a, c, z, v, n |
1065 | 1065 | |
1066 | 1066 | | word score |
1067 | 1067 | | word delta |
1068 | | routine main | |
1068 | | define main routine | |
1069 | 1069 | | inputs score, delta |
1070 | 1070 | | outputs score |
1071 | 1071 | | trashes a, c, z, v, n |
1089 | 1089 | | buffer[2048] buf |
1090 | 1090 | | pointer ptr @ 254 |
1091 | 1091 | | |
1092 | | routine main | |
1092 | | define main routine | |
1093 | 1093 | | inputs buf |
1094 | 1094 | | outputs buf, y |
1095 | 1095 | | trashes a, z, n, ptr |
1109 | 1109 | | buffer[2048] buf |
1110 | 1110 | | pointer ptr @ 254 |
1111 | 1111 | | |
1112 | | routine main | |
1112 | | define main routine | |
1113 | 1113 | | inputs buf |
1114 | 1114 | | outputs buf, y |
1115 | 1115 | | trashes a, z, n, ptr |
1133 | 1133 | | pointer ptr @ 254 |
1134 | 1134 | | byte foo |
1135 | 1135 | | |
1136 | | routine main | |
1136 | | define main routine | |
1137 | 1137 | | inputs foo, buf |
1138 | 1138 | | outputs y, buf |
1139 | 1139 | | trashes a, z, n, ptr |
1157 | 1157 | | pointer ptr @ 254 |
1158 | 1158 | | byte foo |
1159 | 1159 | | |
1160 | | routine main | |
1160 | | define main routine | |
1161 | 1161 | | inputs buf |
1162 | 1162 | | outputs y, foo |
1163 | 1163 | | trashes a, z, n, ptr |
1183 | 1183 | | pointer ptra @ 252 |
1184 | 1184 | | pointer ptrb @ 254 |
1185 | 1185 | | |
1186 | | routine main | |
1186 | | define main routine | |
1187 | 1187 | | inputs buf |
1188 | 1188 | | outputs buf |
1189 | 1189 | | trashes a, y, z, n, ptra, ptrb |
1212 | 1212 | | pointer ptr @ 254 |
1213 | 1213 | | byte foo |
1214 | 1214 | | |
1215 | | routine main | |
1215 | | define main routine | |
1216 | 1216 | | inputs buf |
1217 | 1217 | | outputs buf |
1218 | 1218 | | trashes a, y, z, n, ptr |
1239 | 1239 | | byte foo |
1240 | 1240 | | word delta |
1241 | 1241 | | |
1242 | | routine main | |
1242 | | define main routine | |
1243 | 1243 | | inputs buf |
1244 | 1244 | | outputs y, foo, delta |
1245 | 1245 | | trashes a, c, v, z, n, ptr |
1282 | 1282 | |
1283 | 1283 | Trash does nothing except indicate that we do not care about the value anymore. |
1284 | 1284 | |
1285 | | routine main | |
1285 | | define main routine | |
1286 | 1286 | | inputs a |
1287 | 1287 | | outputs x |
1288 | 1288 | | trashes a, z, n |