diff --git a/emtest/Makefile b/emtest/Makefile new file mode 100644 index 000000000..77ce23fe7 --- /dev/null +++ b/emtest/Makefile @@ -0,0 +1,19 @@ +tested: last + set -x ;\ + for i in `awk '{for(i=\$$1;i<=127;i++)print i}' last ` ;\ + do \ + echo $$i; \ + echo $$i >last; \ + select $$i tests > test.e; \ + ack test.e; \ + a.out \ + : ok; \ + done + rm -f test.e a.out + >tested + +last: tests test.h select + echo 0 >last + +select: select.c + cc -O -n -o select select.c diff --git a/emtest/READ_ME b/emtest/READ_ME new file mode 100644 index 000000000..e447e4afd --- /dev/null +++ b/emtest/READ_ME @@ -0,0 +1,132 @@ +This directory contains test programs for EM implementations. +The test programs are all part of the file "tests". +Each individual test program looks like: + + TEST 004: test ... + ... ; data declarations etc. + MAIN nlocal + ... ; part of the body of MAIN + PROC + ... ; subroutines used by this test + +The PROC part is optional, so the smallest test program looks like: + + TEST 000: null test + MAIN 0 + +The keywords used by "select", like TEST, MAIN, PROC, HOL, OK and ERRLAB, +all consist of upper case letters and start in column one. +A convention for test numbers is to use 3 digit numbers, possibly left +padded with zero's. + +A program, called "select", is provided to combine a range of tests +into a single test program. +"Select" expects a range as argument, like 0-127, or -127, or 0-. +Tests that have a TEST number in that range are included. + +To prevent name clashes, some rules must be obeyed: + - data label names, procedure names and instruction label numbers + must be unique over all tests. A good habit is to use the + three digit test number as suffix. + - only keyword of "select" may start with uppercase letters in column + one, to allow for expansion in the future. + - because only a single 'hol' pseudo is allowed, "select" must + generate the 'hol' pseudo. An individual test may request + some 'hol' space by a special HOL line, starting in column one + and followed by a single number, the number of bytes needed. + This number must consists of digits only, no constant symbols, + because "select" must compute the maximum, so before the + preprocessor has replaced the constant symbols by their values. + - a similar problem is caused by the number of bytes of local + storage for 'main'. An individual test may specify the number + of bytes it needs as parameter to the MAIN line. + Again, the number must consist of digits only. + +Test programs print a sequence of integers greater than 1. +This sequence is terminated by the number 1 as soon as an error is detected. +If all tests are performed correctedly the number 0 is printed. + +To allow test programs to print integers without the full machinery of +conversion and i/o routines, the EM instruction 'nop' is used. +Each time this instruction is executed, the current line number as +maintained by the 'lin' instruction must be printed, followed by a +newline, at least during debugging. + +The following abbrevation may be used in test programs: + + OK -> lin n + nop + +Numbers are automatically assigned in order of static appearance. +As soon as an error is detected you must branch to label 1, by instructions +like 'bra *1' and 'zne *1'. +Label 1 is automatically provided in the main routine. +If you jump to label 1 in a subroutine, then that subroutine must +end with ERRLAB, like in: + + PROC + pro $test,0 + ... + bra *1 + ... + ret 0 + ERRLAB + end + +An option to "select" is to generate 'fil' instructions whenever a +new test starts. +This is useful if 'nop' prints the 'fil' string as well as the 'lin' number. +This 'f' option is on by default, off if a '-f' flag is given. + +The EM file generated by "select" includes "test.h". +"Emtest.h" may contain definitions of the following symbols: + W2S: the size of double precision integers, if implemented. + FS: the size of single precision floats, if implemented. + F2S: the size of double precision floats, if implemented. +The value of these symbols, if defined, must be the size of the object involved. + +Two other symbols are used: + EM_PSIZE: pointer size + EM_WSIZE: word size +The machine dependent translation program, like 8086 and vax2, give +definitions of these symbols while calling the EM encode program. +Because these size names occur quite often, they may be abbreviated: + WS -> EM_WSIZE + PS -> EM_PSIZE + +Before running the tests in the file "tests", it is wise to test +the necessary basic functions with some simple tests like + + TEST 000: null + MAIN 0 +and + TEST 001: ok + MAIN 0 + OK +and + TEST 998: error + MAIN 0 + bra *1 +and + TEST 999: test lni + MAIN 0 + lin 1 + lni + loe 0 + loc 2 + bne *1 + OK +The first two of these are part of "tests" as well. The last two are +not included in "tests" intensionally, because they would fail. +The last tests fails because it references the ABS block which is +inaccessable after an 'hol' pseudo. +Proceed as follows for each of these basic tests: + - make a file called 'basic' containing the test + - run select: + select basic >basic.e + - compile by + machine basic.e + - and load and run + + where machine should be replaced by the name of program + used to compile EM programs for the current machine. diff --git a/emtest/last b/emtest/last new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/emtest/last @@ -0,0 +1 @@ +0 diff --git a/emtest/ok b/emtest/ok new file mode 100755 index 000000000..1eca33bb9 --- /dev/null +++ b/emtest/ok @@ -0,0 +1,10 @@ +trap "" 1 2 + +while read x +do + case $x in + 0) exit 0;; + bad) exit 1;; + esac +done +exit 1 diff --git a/emtest/select.c b/emtest/select.c new file mode 100644 index 000000000..9be038ada --- /dev/null +++ b/emtest/select.c @@ -0,0 +1,249 @@ +/* + * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands. + * + * This product is part of the Amsterdam Compiler Kit. + * + * Permission to use, sell, duplicate or disclose this software must be + * obtained in writing. Requests for such permissions may be sent to + * + * Dr. Andrew S. Tanenbaum + * Wiskundig Seminarium + * Vrije Universiteit + * Postbox 7161 + * 1007 MC Amsterdam + * The Netherlands + * + */ + +#include +#include +#include + +#define LINSIZ 100 + +int sigs[] = { + SIGHUP, + SIGINT, + SIGQUIT, + SIGTERM, + 0 +}; + +char *prog; +char line[LINSIZ]; +int nlocals = 0; +int nhol = 0; +int nerrors = 0; +int oknum = 2; +int fflag = 1; +int low = 0; +int high = 999; + +FILE *file1; +FILE *file2; +FILE *file3; +char name1[] = "/usr/tmp/f1XXXXXX"; +char name2[] = "/usr/tmp/f2XXXXXX"; +char name3[] = "/usr/tmp/f3XXXXXX"; + +stop() { + unlink(name1); + unlink(name2); + unlink(name3); + exit(nerrors); +} + +main(argc,argv) char **argv; { + register *p; + register char *s; + + prog = *argv++; --argc; + mktemp(name1); + mktemp(name2); + mktemp(name3); + for (p = sigs; *p; p++) + if (signal(*p, stop) == SIG_IGN) + signal(*p, SIG_IGN); + while (argc > 0 && argv[0][0] == '-') { + switch (argv[0][1]) { + case 'f': + fflag ^= 1; + break; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + high = atoi(&argv[0][1]); + break; + default: + usage(); + break; + } + argc--; + argv++; + } + if (argc > 0 && argv[0][0] >= '0' && argv[0][0] <= '9') { + s = argv[0]; + do + low = low*10 + *s++ - '0'; + while (*s >= '0' && *s <= '9'); + if (*s == 0) + high = low; + else if (*s++ == '-') { + high = atoi(s); + if (high == 0) + high = 999; + } else + fatal("bad range %s", argv[0]); + argc--; + argv++; + } + if (argc > 1) + usage(); + if (argc == 1 && freopen(argv[0], "r", stdin) == NULL) + fatal("cannot open %s", argv[0]); + if ((file1 = fopen(name1, "w")) == NULL) + fatal("cannot create %s", name1); + if ((file2 = fopen(name2, "w")) == NULL) + fatal("cannot create %s", name2); + if ((file3 = fopen(name3, "w")) == NULL) + fatal("cannot create %s", name3); + if (getline()) + while (select()) + ; + fclose(file1); + fclose(file2); + fclose(file3); + combine(); + stop(); +} + +select() { + register FILE *f; + int i; + + if (sscanf(line, "TEST %d", &i) != 1) + fatal("bad test identification(%s)", line); + if (i < low || i > high) { + while (getline()) + if (line[0] == 'T') + return(1); + return(0); + } + fprintf(file2, "; %s\n", line); + if (fflag) { + fprintf(file1, ".%03d\n", i); + fprintf(file1, " con \"tst%03d\"\n", i); + fprintf(file2, " fil .%03d\n", i); + } + f = file1; + while (getline()) { + switch (line[0]) { + case 'T': + return(1); + case 'M': + if (sscanf(line, "MAIN%d", &i) != 1 || i%4 != 0) + break; + if (i > nlocals) + nlocals = i; + f = file2; + continue; + case 'P': + if (strcmp(line, "PROC") != 0) + break; + f = file3; + continue; + case 'H': + if (f != file1 || + sscanf(line, "HOL%d", &i) != 1 || + i%4 != 0) + break; + if (i > nhol) + nhol = i; + continue; + case 'O': + if (strcmp(line, "OK") != 0) + break; + fprintf(f, " lin %d\n nop\n", oknum++); + continue; + case 'E': + if (f != file3 || strcmp(line, "ERRLAB") != 0) + break; + fprintf(f, "1\n lin 1\n nop\n loc 1\n loc 1\n mon\n"); + continue; + default: + putline(f); + continue; + } + fatal("bad line (%s)", line); + } + return(0); +} + +combine() { + + printf("#define WS EM_WSIZE\n"); + printf("#define PS EM_PSIZE\n"); + printf("#include \"test.h\"\n"); + printf(" mes 2,WS,PS\n"); + printf(" mes 1\n"); + printf(" mes 4,300\n"); + if (nhol) + printf(" hol %d,0,0\n", nhol); + copy(name1); + printf(" exp $m_a_i_n\n"); + printf(" pro $m_a_i_n,%d\n", nlocals); + printf(" loc 123\n"); + printf(" loc -98\n"); + copy(name2); + printf(" loc -98\n"); + printf(" bne *1\n"); + printf(" loc 123\n"); + printf(" bne *1\n"); + printf(" lin 0\n"); + printf(" nop\n"); + printf(" loc 0\n"); + printf(" ret WS\n"); + printf("1\n"); + printf(" lin 1\n"); + printf(" nop\n"); + printf(" loc 1\n"); + printf(" ret WS\n"); + printf(" end\n"); + copy(name3); +} + +copy(s) char *s; { + if (freopen(s, "r", stdin) == NULL) + fatal("cannot reopen %s", s); + while (getline()) + putline(stdout); +} + +getline() { + register len; + + if (fgets(line, LINSIZ, stdin) == NULL) + return(0); + len = strlen(line); + if (line[len-1] != '\n') + fatal("line too long(%s)", line); + line[len-1] = 0; + return(1); +} + +putline(f) FILE *f; { + fprintf(f, "%s\n", line); +} + +fatal(s, a1, a2, a3, a4) char *s; { + fprintf(stderr, "%s: ", prog); + fprintf(stderr, s, a1, a2, a3, a4); + fprintf(stderr, " (fatal)\n"); + nerrors++; + stop(); +} + +usage() { + fprintf(stderr, "usage: %s -f [[low]-[high]] [testcollection]\n", prog); + nerrors++; + stop(); +} diff --git a/emtest/test.e b/emtest/test.e new file mode 100644 index 000000000..7f26cf5f5 --- /dev/null +++ b/emtest/test.e @@ -0,0 +1,28 @@ +#define WS EM_WSIZE +#define PS EM_PSIZE +#include "test.h" + mes 2,WS,PS + mes 1 + mes 4,300 +.000 + con "tst000" + exp $m_a_i_n + pro $m_a_i_n,0 + loc 123 + loc -98 +; TEST 000: empty + fil .000 + loc -98 + bne *1 + loc 123 + bne *1 + lin 0 + nop + loc 0 + ret WS +1 + lin 1 + nop + loc 1 + ret WS + end diff --git a/emtest/test.h b/emtest/test.h new file mode 100644 index 000000000..aabfc611e --- /dev/null +++ b/emtest/test.h @@ -0,0 +1 @@ +#define W2S 2*EM_WSIZE diff --git a/emtest/tests b/emtest/tests new file mode 100644 index 000000000..685c1f8ca --- /dev/null +++ b/emtest/tests @@ -0,0 +1,3590 @@ +TEST 000: empty +MAIN 0 +TEST 001: OK +MAIN 0 +OK +TEST 002: test loc, bne +MAIN 0 + loc 0 + loc 0 + bne *1 +OK + loc 1 + loc 1 + bne *1 +OK + loc -1 + loc -1 + bne *1 +OK + loc 127 + loc 127 + bne *1 +OK + loc -127 + loc -127 + bne *1 +OK + loc -128 + loc -128 + bne *1 +OK +#if WS > 1 + loc 255 + loc 255 + bne *1 +OK + loc 256 + loc 256 + bne *1 +OK + loc 257 + loc 257 + bne *1 +OK + loc 32767 + loc 32767 + bne *1 +OK + loc -32767 + loc -32767 + bne *1 +OK + loc -32768 + loc -32768 + bne *1 +OK +#endif WS > 1 +#if WS > 2 + loc 65535 + loc 65535 + bne *1 +OK + loc 65536 + loc 65536 + bne *1 +OK + loc 65537 + loc 65537 + bne *1 +OK + loc 2147483647 + loc 2147483647 + bne *1 +OK + loc -2147483647 + loc -2147483647 + bne *1 +OK + loc -2147483648 + loc -2147483648 + bne *1 +OK +#endif WS > 2 +TEST 003: test signed and unsigned loc +MAIN 0 +#if WS == 1 + loc 128 + loc -128 + bne *1 +OK + loc 129 + loc -127 + bne *1 +OK + loc 255 + loc -1 + bne *1 +OK +#endif +#if WS == 2 + loc 32768 + loc -32768 + bne *1 +OK + loc 32769 + loc -32767 + bne *1 +OK + loc 65535 + loc -1 + bne *1 +OK +#endif +#if WS == 4 + loc 2147483648 + loc -2147483648 + bne *1 +OK + loc 2147483649 + loc -2147483647 + bne *1 +OK + loc 4294967295 + loc -1 + bne *1 +OK +#endif +TEST 004: test lol, stl +MAIN 8 + loc 95 + stl -4 + lol -4 + loc 95 + bne *1 +OK + lol 0 + stl -4 + loc 125 + stl -8 + loc 125 + lol -8 + bne *1 +OK + lol 0 + lol -4 + bne *1 +OK +TEST 005: test loe, ste +HOL 8 +MAIN 0 + loc 95 + ste 4 + loe 4 + loc 95 + bne *1 +OK + loc 125 + ste 0 + loc 125 + loe 0 + bne *1 +OK + loc 95 + ste 0 + loe 4 + loe 0 + bne *1 +OK +TEST 006: test named global data: con, rom, bss +a006 + bss 4,0,0 +b006 + con 35 +c006 + bss 4,0,1 +d006 + bss 4,35,1 +e006 + rom 57 +MAIN 0 + loc 0 + loe c006 + bne *1 +OK + loe b006 + ste a006 + loe d006 + loe a006 + bne *1 +OK + loe e006 + ste b006 + loc 57 + loe b006 + bne *1 +OK +TEST 007: test lal, lil +MAIN 12 + lal -8 +#if WS == PS + stl -4 +#endif +#if WS*2 == PS + sdl -4 +#endif + loc 117 + stl -8 + lil -4 + loc 117 + bne *1 +OK +TEST 008: test sil +MAIN 12 + loc 29 + stl -8 + lal -8 +#if WS == PS + stl -4 +#endif +#if WS*2 == PS + sdl -4 +#endif + loc 110 + sil -4 + lol -8 + loc 110 + bne *1 +OK +TEST 009: test lof +MAIN 20 + lal -16 + loc 120 + stl -12 + lof 4 + loc 120 + bne *1 +OK +TEST 010: test stf +MAIN 20 + loc 180 + lal -16 + stf 8 + lol -8 + loc 180 + bne *1 +OK +TEST 011: test loi WS +MAIN 20 + loc 140 + stl -12 + lal -12 + loi WS + loc 140 + bne *1 +OK +TEST 012: test loi 1, sti 1 +MAIN 20 +#if WS > 1 + loc 519 + lal -10 + sti 1 + lal -10 + loi 1 + loc 7 + bne *1 +OK +#endif +TEST 013: test loi 2*WS +MAIN 20 + loc 77 + stl -12 + loc 119 + stl -12+WS + lal -12 + loi 2*WS + loc 77 + bne *1 + loc 119 + bne *1 +OK +TEST 014: test loi 4*WS +MAIN 20 + loc 150 + stl -16+(3*WS) + loc 152 + stl -16+(2*WS) + loc 154 + stl -16+WS + loc 156 + stl -16 + lal -16 + loi 4*WS + loc 156 + bne *1 + loc 154 + bne *1 + loc 152 + bne *1 + loc 150 + bne *1 +OK +TEST 015: test los WS with 1 +MAIN 20 + loc 7 + lal -10 + sti 1 + lal -10 + loc 1 + los WS + loc 7 + bne *1 +OK +TEST 016: test los WS with 2 +MAIN 20 +#if WS == 1 + loc 77 + loc 78 + stl -12 + stl -11 + lal -12 + loc 2 + los WS + loc 78 + bne *1 + loc 77 + bne *1 +#endif +#if WS > 1 + loc 777 + stl -12 + lal -12 + loc 2 + los WS + loc 777 + bne *1 +#endif +OK +TEST 017: test los WS with 4 +MAIN 20 +#if WS == 1 + loc 14 + loc 15 + loc 16 + loc 17 + lal -12 + sti 4 + lal -12 + loc 4 + los WS + loc 17 + bne *1 + loc 16 + bne *1 + loc 15 + bne *1 + loc 14 + bne *1 +#endif +#if WS == 2 + loc 3001 + loc 3002 + stl -12 + stl -10 + lal -12 + loc 4 + los WS + loc 3002 + bne *1 + loc 3001 + bne *1 +#endif +#if WS > 2 + loc 123001 + stl -12 + lal -12 + loc 4 + los WS + loc 123001 + bne *1 +#endif +OK +TEST 018: test ldl +MAIN 20 + loc 77 + stl -12 + loc 123 + stl -12+WS + ldl -12 + loc 77 + bne *1 + loc 123 + bne *1 +OK +TEST 019: test lde +HOL 20 +MAIN 0 + loc 70 + ste 12 + loc 71 + ste 12+WS + lde 12 + loc 70 + bne *1 + loc 71 + bne *1 +OK +TEST 020: test ldf +MAIN 20 + loc 123 + loc 77 + sdl -4 + lal -9 + ldf 5 + loc 77 + bne *1 + loc 123 + bne *1 +OK +TEST 021: test ldf +MAIN 20 + loc 75 + stl -12 + loc 77 + stl -12+WS + lal -20 + ldf 8 + loc 75 + bne *1 + loc 77 + bne *1 +OK +TEST 022: test sdl +MAIN 20 + loc 30 + loc 31 + sdl -12 + lol -12+WS + loc 30 + bne *1 + lol -12 + loc 31 + bne *1 +OK +TEST 023: test sde +HOL 20 +MAIN 0 + loc 40 + loc 41 + sde 16 + loe 16 + loc 41 + bne *1 + loe 16+WS + loc 40 + bne *1 +OK +TEST 024: test sdf +HOL 20 +MAIN 0 + loc 51 + loc 50 + lae 6 + sdf 10 + loe 16 + loc 50 + bne *1 + loc 51 + loe 16+WS + bne *1 +OK +TEST 025: test sti 1 +MAIN 20 + loc 4136 + lal -11 + sti 1 + loc 1034 + lal -10 + sti 1 + lal -10 + loi 1 + loc 10 + bne *1 + lal -11 + loi 1 + loc 40 + bne *1 +OK +TEST 026: test sti 1 and lol +MAIN 0 + loc 257 + stl -12+WS + loc 514 + stl -12-WS + loc 50 + lal -12 + sti 1 +#if WS > 1 + loc -50 + lal -11 + sti 1 +#endif +#if WS > 2 + loc 49 + lal -10 + sti 1 + loc -49 + lal -9 + sti 1 +#endif + loc 257 + lol -12+WS + bne *1 + loc 514 + lol -12-WS + bne *1 +OK +TEST 027: test sti 2 +MAIN 20 +#if WS == 1 + loc 89 +#endif + loc 90 + lal -12 + sti 2 + lol -12 + loc 90 + bne *1 +OK +TEST 028: test sti 4 +MAIN 20 +#if WS == 1 + loc 100 + loc 101 +#endif +#if WS <= 2 + loc 102 +#endif + loc 103 + lal -14 + sti 4 + lol -14 + loc 103 + bne *1 +OK +TEST 029: test sts WS with 1 +MAIN 20 + loc 57 + lal -13 + sti 1 + loc 123 + lal -11 + sti 1 + loc 20 + lal -12 + loc 1 + sts WS + lal -12 + loi 1 + loc 20 + bne *1 + lal -11 + loi 1 + loc 123 + bne *1 + lal -13 + loi 1 + loc 57 + bne *1 +OK +TEST 030: test sts WS with WS +MAIN 20 + loc 210 + lal -12 + loc WS + sts WS + lol -12 + loc 210 + bne *1 +OK +TEST 031: test sts WS with 4 +MAIN 20 +#if WS == 1 + loc 100 + loc 101 +#endif +#if WS <= 2 + loc 102 +#endif + loc 103 + lal -14 + loc 4 + sts WS + lol -14 + loc 103 + bne *1 +OK +TEST 032: test adi WS +MAIN 0 + loc 1 + loc 1 + adi WS + loc 2 + bne *1 +OK + loc 5 + loc -6 + adi WS + loc -1 + bne *1 +OK +#if WS >= 2 + loc -1007 + loc +999 + adi WS + loc -8 + bne *1 +OK + loc -1300 + loc +1405 + adi WS + loc 105 + bne *1 +OK + loc -30000 + loc -20 + adi WS + loc -30020 + bne *1 +OK +#endif +#if WS >= 4 + loc -100007 + loc +99999 + adi WS + loc -8 + bne *1 +OK + loc -1300 + loc +140567 + adi WS + loc 139267 + bne *1 +OK + loc -30000000 + loc -20 + adi WS + loc -30000020 + bne *1 +OK +#endif +TEST 033: test sbi WS +MAIN 0 + loc 1 + loc 1 + sbi WS + loc 0 + bne *1 +OK + loc 5 + loc -6 + sbi WS + loc +11 + bne *1 +OK +#if WS >= 2 + loc -1007 + loc +999 + sbi WS + loc -2006 + bne *1 +OK + loc -1300 + loc +1405 + sbi WS + loc -2705 + bne *1 +OK + loc -30000 + loc -20 + sbi WS + loc -29980 + bne *1 +OK +#endif +#if WS >= 4 + loc -100007 + loc +99999 + sbi WS + loc -200006 + bne *1 +OK + loc -1300 + loc +140567 + sbi WS + loc -141867 + bne *1 +OK + loc -30000000 + loc -20 + sbi WS + loc -29999980 + bne *1 +OK +#endif +TEST 034: test mli WS +MAIN 0 + loc 5 + loc 9 + mli WS + loc 45 + bne *1 +OK + loc 0 + loc 10 + mli WS + loc 0 + bne *1 +OK +#if WS > 1 + loc -99 + loc 7 + mli WS + loc -693 + bne *1 +OK + loc -100 + loc -90 + mli WS + loc 9000 + bne *1 +OK +#endif +#if WS > 2 + loc 123456 + loc 200 + mli WS + loc 24691200 + bne *1 +OK +#endif +TEST 035: test dvi WS +MAIN 0 + loc 15 + loc 5 + dvi WS + loc 3 + bne *1 +OK + loc 100 + loc -7 + dvi WS + loc -14 + bne *1 +OK + loc -100 + loc 7 + dvi WS + loc -14 + bne *1 +OK +#if WS >= 2 + loc -1000 + loc -201 + dvi WS + loc 4 + bne *1 +OK +#endif +#if WS >= 4 + loc 1234567 + loc -100 + dvi WS + loc -12345 + bne *1 +OK +#endif +TEST 036: test rmi WS +MAIN 0 + loc 100 + loc 7 + rmi WS + loc 2 + bne *1 +OK + loc -100 + loc 7 + rmi WS + loc -2 + bne *1 +OK + loc 100 + loc -7 + rmi WS + loc 2 + bne *1 +OK + loc -100 + loc -7 + rmi WS + loc -2 + bne *1 +OK +#if WS >= 2 + loc -1000 + loc -201 + rmi WS + loc -196 + bne *1 +OK +#endif +#if WS >= 4 + loc 1234567 + loc -100 + rmi WS + loc 67 + bne *1 +OK +#endif +TEST 037: test ngi WS +MAIN 0 + loc 100 + ngi WS + loc -100 + bne *1 +OK + loc -100 + ngi WS + loc 100 + bne *1 +OK +TEST 038: test sli,slu WS +MAIN 0 + loc 5 + loc 3 + sli WS + loc 40 + bne *1 +OK + loc -2 + loc 4 + sli WS + loc -32 + bne *1 +OK + loc 5 + loc 3 + slu WS + loc 40 + bne *1 +OK + loc -2 + loc 4 + slu WS + loc -32 + bne *1 +OK +TEST 039: test sri,sru WS +MAIN 0 + loc 64 + loc 5 + sri WS + loc 2 + bne *1 +OK + loc -3 + loc 2 + sri WS + loc -1 + bne *1 +OK + loc -16 + loc 3 + sri WS + loc -2 + bne *1 +OK + loc 64 + loc 5 + sru WS + loc 2 + bne *1 +OK + loc -3 + loc 2 + sru WS +#if WS == 1 + loc 63 +#endif +#if WS == 2 + loc 16383 +#endif +#if WS == 4 + loc 1073741823 +#endif + bne *1 +OK +TEST 040: test rol WS +MAIN 0 + loc 1 + loc 3 + rol WS + loc 8 + bne *1 +OK +#if WS > 1 + loc 16384 + loc 15 + rol WS + loc 8192 + bne *1 +OK + loc -2 + loc 15 + rol WS + loc 32767 + bne *1 +OK + loc -28671 + loc 0 + rol WS + loc -28671 + bne *1 +OK +#endif +TEST 041: test ror WS +MAIN 0 + loc 4 + loc 5 + ror WS +#if WS == 1 + loc 32 +#endif +#if WS == 2 + loc 8192 +#endif +#if WS == 4 + loc 536870912 +#endif + bne *1 +OK +#if WS == 2 + loc 32767 + loc 15 + ror WS + loc -2 + bne *1 +OK +#endif + loc -28 + loc 0 + ror WS + loc -28 + bne *1 +OK +TEST 042: test inc +MAIN 0 + loc 20 + inc + loc 21 + bne *1 +OK + loc -50 + inc + loc -49 + bne *1 +OK +TEST 043: test dec +MAIN 0 + loc 66 + dec + loc 65 + bne *1 +OK + loc -44 + dec + loc -45 + bne *1 +OK +TEST 044: test adp +MAIN 20 + lal -10 + adp -2 + lal -12 + cmp + zne *1 +OK + loc 519 + lal -11 + sti 1 + lal -12 + adp 1 + loi 1 + loc 7 + bne *1 +OK +TEST 045: test inn WS +MAIN 0 + loc 8 + loc 3 + inn WS + loc 1 + bne *1 +OK + loc 8 + loc 4 + inn WS + loc 0 + bne *1 +OK + loc 2 + loc -5 + inn WS + loc 0 + bne *1 +OK + loc -5 + loc 3 + inn WS + loc 1 + bne *1 +OK +TEST 046: test inn ? +MAIN 0 + loc 8 + loc 3 + loc WS + inn ? + loc 1 + bne *1 +OK + loc 8 + loc 4 + loc WS + inn ? + loc 0 + bne *1 +OK + loc 2 + loc -5 + loc WS + inn ? + loc 0 + bne *1 +OK + loc -5 + loc 3 + loc WS + inn ? + loc 1 + bne *1 +OK +TEST 047: test set +MAIN 0 + loc 3 + set WS + loc 8 + bne *1 +OK + loc 6 + set 2*WS + loc 64 + bne *1 + loc 0 + bne *1 +OK + loc 0 + set 4*WS + loc 1 + bne *1 + loc 0 + bne *1 + loc 0 + bne *1 + loc 0 + bne *1 +OK +TEST 048: test set ? +MAIN 0 + loc 3 + loc WS + set ? + loc 8 + bne *1 +OK + loc 6 + loc 2*WS + set ? + loc 64 + bne *1 + loc 0 + bne *1 +OK + loc 0 + loc 4*WS + set ? + loc 1 + bne *1 + loc 0 + bne *1 + loc 0 + bne *1 + loc 0 + bne *1 +OK +TEST 049: test aar +a049 + rom 5,2,4 +b049 + con 5,2,1 +MAIN 20 + lal -12 + loc 5 + lae a049 + aar WS + lal -12 + cmp + zne *1 +OK + lal -11 + loc 7 + lae b049 + aar WS + lal -9 + cmp + zne *1 +OK +TEST 050: test aar ? +a050 + rom 5,2,4 +b050 + con 5,2,1 +MAIN 20 + lal -12 + loc 5 + lae a050 + loc WS + aar ? + lal -12 + cmp + zne *1 +OK + lal -11 + loc 7 + lae b050 + loc WS + aar ? + lal -9 + cmp + zne *1 +OK +TEST 051: test lar +a051 + rom 5,2,2*WS +b051 + con 5,2,1 +MAIN 20 + loc 40 + loc 41 + sdl -12+(2*WS) + lal -12 + loc 6 + lae a051 + lar WS + loc 41 + bne *1 + loc 40 + bne *1 +OK + loc 42 + lal -9 + sti 1 + lal -11 + loc 7 + lae b051 + lar WS + lal -9 + loi 1 + bne *1 +OK +TEST 052: test lar ? +a052 + rom 5,2,2*WS +b052 + con 5,2,1 +MAIN 20 + loc 40 + loc 41 + sdl -12+(2*WS) + lal -12 + loc 6 + lae a052 + loc WS + lar ? + loc 41 + bne *1 + loc 40 + bne *1 +OK + loc 42 + lal -9 + sti 1 + lal -11 + loc 7 + lae b052 + loc WS + lar ? + lal -9 + loi 1 + bne *1 +OK +TEST 053: test sar +a053 + rom 5,2,3*WS +b053 + con 5,2,1 +MAIN 20 + loc 39 + loc 40 + loc 41 + lal -12 + loc 6 + lae a053 + sar WS + lal -12+(3*WS) + loi 3*WS + loc 41 + bne *1 + loc 40 + bne *1 + loc 39 + bne *1 +OK + loc -2 + lal -11 + loc 7 + lae b053 + sar WS + lal -9 + loi 1 + loc 254 + bne *1 +OK +TEST 054: test sar ? +a054 + rom 5,2,3*WS +b054 + con 5,2,1 +MAIN 20 + loc 39 + loc 40 + loc 41 + lal -12 + loc 6 + lae a054 + loc WS + sar ? + lal -12+(3*WS) + loi 3*WS + loc 41 + bne *1 + loc 40 + bne *1 + loc 39 + bne *1 +OK + loc -2 + lal -11 + loc 7 + lae b054 + loc WS + sar ? + lal -9 + loi 1 + loc 254 + bne *1 +OK +TEST 055: test tlt +MAIN 0 + loc 1 + tlt + loc 0 + bne *1 +OK + loc 0 + tlt + loc 0 + bne *1 +OK + loc -3 + tlt + loc 1 + bne *1 +OK +TEST 056: test tle +MAIN 0 + loc 8 + tle + loc 0 + bne *1 +OK + loc 0 + tle + loc 1 + bne *1 +OK + loc -19 + tle + loc 1 + bne *1 +OK +TEST 057: test teq +MAIN 0 + loc 17 + teq + loc 0 + bne *1 +OK + loc 0 + teq + loc 1 + bne *1 +OK + loc -100 + teq + loc 0 + bne *1 +OK +TEST 058: test tne +MAIN 0 + loc 76 + tne + loc 1 + bne *1 +OK + loc 0 + tne + loc 0 + bne *1 +OK + loc -99 + tne + loc 1 + bne *1 +OK +TEST 059: test tge +MAIN 0 + loc 14 + tge + loc 1 + bne *1 +OK + loc 0 + tge + loc 1 + bne *1 +OK + loc -76 + tge + loc 0 + bne *1 +OK +TEST 060: test tgt +MAIN 0 + loc 20 + tgt + loc 1 + bne *1 +OK + loc 0 + tgt + loc 0 + bne *1 +OK + loc -66 + tgt + loc 0 + bne *1 +OK +TEST 061: test cmi WS +MAIN 0 + loc 10 + loc 20 + cmi WS + tlt + loc 1 + bne *1 +OK + loc 20 + loc 10 + cmi WS + tgt + loc 1 + bne *1 +OK + loc 44 + loc 44 + cmi WS + loc 0 + bne *1 +OK +TEST 062: test cmp, adp, cmu +MAIN 20 + lal -5 + lal -2 + cmp + tlt + loc 1 + bne *1 +OK + lal -2 + lal -5 + cmp + tle + loc 0 + bne *1 +OK + lal -2 + lal -2 + cmp + loc 0 + bne *1 +OK + lal -5 + adp 3 + lal -2 + cmp + loc 0 + bne *1 +OK + lal -5 + adp 4 + lal -2 + cmp + tge + loc 1 + bne *1 +OK + loc 6 + loc 6 + cmu WS + loc 0 + bne *1 +OK + loc 17 + loc 27 + cmu WS + tlt + loc 1 + bne *1 +OK + loc 17 + loc 6 + loc 27 + loc 6 + cmu 2*WS + tlt + loc 1 + bne *1 +OK + loc 6 + loc 27 + loc 6 + loc 17 + cmu 2*WS + tgt + loc 1 + bne *1 +OK +TEST 063: test cms +MAIN 0 + loc 6 + loc -10 + loc -125 + loc 30 + loc 6 + loc -10 + loc -126 + loc 30 + loc 4*WS + cms + tne + loc 1 + bne *1 +OK +TEST 064: test blt +MAIN 0 + loc 3 + loc 4 + blt *1064 + bra *1 +1064 + loc 4 + loc 3 + blt *1 + loc -5 + loc -4 + blt *2064 + bra *1 +2064 + loc -4 + loc -5 + blt *1 + loc 4 + loc 4 + blt *1 +OK +TEST 065: test ble +MAIN 0 + loc 3 + loc 4 + ble *1065 + bra *1 +1065 + loc 4 + loc 3 + ble *1 + loc -99 + loc -5 + ble *2065 + bra *1 +2065 + loc -99 + loc -99 + ble *3065 + bra *1 +3065 + loc 100 + loc -100 + ble *1 +OK +TEST 066: test beq +MAIN 0 + loc 3 + loc 3 + beq *1066 + bra *1 +1066 + loc 3 + loc 4 + beq *1 + loc -18 + loc -17 + beq *1 + loc 0 + loc 0 + beq *2066 + bra *1 +2066 +OK +TEST 067: test bne +MAIN 0 + loc 50 + loc 50 + bne *1 + loc 50 + loc 51 + bne *1067 + bra *1 +1067 + loc 0 + loc 0 + bne *1 +OK +TEST 068: test bge +MAIN 0 + loc 100 + loc 101 + bge *1 + loc 101 + loc 100 + bge *1068 + bra *1 +1068 + loc -100 + loc -99 + bge *1 + loc -100 + loc 100 + bge *1 + loc 0 + loc 0 + bge *2068 + bra *1 +2068 + loc 50 + loc 50 + bge *3068 + bra *1 +3068 +OK +TEST 069: test bgt +MAIN 0 + loc 3 + loc 10 + bgt *1 + loc 10 + loc 3 + bgt *1069 + bra *1 +1069 + loc -100 + loc -50 + bgt *1 + loc -100 + loc 50 + bgt *1 + loc 5 + loc 5 + bgt *1 +OK +TEST 070: test zlt +MAIN 0 + loc 4 + zlt *1 + loc -4 + zlt *1070 + bra *1 +1070 + loc 0 + zlt *1 +OK +TEST 071: test zle +MAIN 0 + loc 4 + zle *1 + loc -4 + zlt *1071 + bra *1 +1071 + loc 0 + zle *2071 + bra *1 +2071 +OK +TEST 072: test zeq +MAIN 0 + loc 4 + zeq *1 + loc -4 + zeq *1 + loc 0 + zeq *1072 + bra *1 +1072 +OK +TEST 073: test zne +MAIN 0 + loc 4 + zne *1073 + bra *1 +1073 + loc -4 + zne *2073 + bra *1 +2073 + loc 0 + zne *1 +OK +TEST 074: test zge +MAIN 0 + loc 4 + zge *1074 + bra *1 +1074 + loc -4 + zge *1 + loc 0 + zge *2074 + bra *1 +2074 +OK +TEST 075: test zgt +MAIN 0 + loc 4 + zgt *1075 + bra *1 +1075 + loc -4 + zgt *1 + loc 0 + zgt *1 +OK +TEST 076: test asp +MAIN 12 + loc 104 + loc 4 + loc 5 + loc 6 + asp 2*WS + stl -4 + loc 104 + bne *1 +OK +TEST 077: test cal +HOL 12 +MAIN 0 + cal $p077 + loe 4 + loc 34 + bne *1 +OK +PROC + pro $p077,0 + loc 34 + ste 4 + ret 0 + end +TEST 078: test cai +HOL 12 +MAIN 0 + lpi $p078 + cai + loe 4 + loc 34 + bne *1 +OK +PROC + pro $p078,0 + loc 34 + ste 4 + ret 0 + end +TEST 079: test ads WS +MAIN 20 + lal -6 + loc -2 + ads WS + lal -8 + cmp + zne *1 +OK + lal -6 + loc 2 + ads WS + lal -4 + cmp + zne *1 +OK +; test adp + lal -5 + adp 1 + lal -4 + cmp + zne *1 +OK +TEST 080: test sbs +HOL 12 +MAIN 20 + lal -4 + lal -6 + sbs WS + loc 2 + bne *1 +OK + lae 7 + lae 10 + sbs WS + loc -3 + bne *1 +OK +TEST 081: test lor +#define LB 0 +#define SP 1 +MAIN 20 + lor LB + lxl 0 + cmp + zne *1 +OK + loc 31 + lor SP + loi WS + bne *1 +OK + lor SP + lal -12 + sti PS + asp -4 + lor SP + lal -8 + sti PS + asp 4 + lal -12 + loi PS + lal -8 + loi PS + sbs WS + loc 4 + bne *1 +OK +TEST 082: test ass WS +#define SP 1 +MAIN 20 + loc 104 + loc 50 + loc 60 + loc 2*WS + ass WS + loc 104 + bne *1 +OK + lor SP + lal -8 + sti PS + loc -18 + ass WS + lor SP + lal -4 + sti PS + loc 18 + ass WS + lal -8 + loi PS + lal -4 + loi PS + sbs WS + loc 18 + bne *1 +OK +TEST 083: test blm +HOL 40 +MAIN 32 + loc 61 + ste 12 + loc 0 + stl -4 + lae 12 + lal -4 + blm WS + lol -4 + loc 61 + bne *1 +OK + loc 44 + loc 43 + loc 42 + loc 41 + lal -20 + sti 4*WS + lal -20 + lae 8 + blm 4*WS + loe 8 + loc 41 + bne *1 + loe 8+WS + loc 42 + bne *1 + loe 8+(2*WS) + loc 43 + bne *1 + loe 8+(3*WS) + loc 44 + bne *1 +OK +TEST 084: test bls WS +HOL 40 +MAIN 32 + loc 55 + stl -8+WS + loc 56 + stl -8 + lal -8 + lae 20 + loc 2*WS + bls WS + loe 20 + loc 56 + bne *1 + loe 20+WS + loc 55 + bne *1 +OK +TEST 085: test dup +MAIN 0 + loc 199 + dup WS + bne *1 +OK + loc 130 + loc 150 + dup 2*WS + loc 150 + bne *1 + loc 130 + bne *1 + loc 150 + bne *1 + loc 130 + bne *1 +OK +; test dus WS + loc 400 + loc 399 + loc 2*WS + dus WS + loc 399 + bne *1 + loc 400 + bne *1 + loc 399 + bne *1 + loc 400 + bne *1 +OK +TEST 087: test rck +a087 + con 10,14 +MAIN 12 + loc 10 + lae a087 + rck WS + inc + lae a087 + rck WS + inc + lae a087 + rck WS + inc + lae a087 + rck WS + inc + lae a087 + rck WS + stl -4 +OK +TEST 088: test csa +MAIN 20 +a088 + con *1088,4,2,*3088,*2088,*4088 + zrl -8 + loc 4 +5088 + inc + dup WS + lae a088 + csa WS + bra *1 +3088 + bra *1 +2088 + lol -8 + loc 3 + adi WS + stl -8 + bra *5088 +1088 + inl -8 + bra *6088 +4088 + lol -8 + loc 2 + adi WS + stl -8 + bra *5088 +6088 + loc 7 + bne *1 +OK + lol -8 + loc 6 + bne *1 +OK +TEST 089: test csb +MAIN 20 +b089 + rom *1089,3,-1,*3089,0,*2089,1,*4089 + loc -1 + zrl -12 +5089 + inc + dup WS + lae b089 + csb WS + bra *1 +3089 + bra *1 +2089 + lol -12 + loc 3 + adi WS + stl -12 + bra *5089 +1089 + inl -12 + bra *6089 +4089 + lol -12 + loc 2 + adi WS + stl -12 + bra *5089 +6089 + loc 2 + bne *1 +OK + lol -12 + loc 6 + bne *1 +OK +TEST 090: now test loi again, because it is so tricky +MAIN 20 + loc 256 + lal -3 + sti 1 + loc 1 + lal -4 + sti 1 + loc 517 + lal -5 + sti 1 + loc 2 + lal -6 + sti 1 + loc 1030 + lal -8 + sti WS + loc 4 + lal -9 + sti 1 + lal -3 + loi 1 + loc 0 + bne *1 +OK + lal -3 + adp -1 + loi 1 + loc 1 + bne *1 +OK + lal -3 + adp -2 + loi 1 + loc 5 + bne *1 +OK + lal -3 + adp -3 + loi 1 + loc 2 + bne *1 +OK + lal -4 + adp -4 + loi WS + loc 1030 + bne *1 +OK + lal -6 + adp -3 + loi 1 + loc 4 + bne *1 +OK +TEST 091: now test sti 1 again +MAIN 12 + loc 3 + loc 2 + loc 1 + loc 7 + loc 8 + loc 10 + lal -4 + sti 1 + lal -4 + adp -1 + sti 1 + lal -4 + adp -2 + sti 1 + lal -4 + adp -3 + sti 1 + lal -4 + adp -4 + sti 1 + lal -4 + adp -5 + sti 1 + lal -4 + loi 1 + loc 10 + bne *1 +OK + lal -6 + loi 1 + loc 7 + bne *1 +OK + lal -8 + loi 1 + loc 2 + bne *1 +OK +TEST 092: test ldc and cii +MAIN 0 +#ifdef W2S + ldc 0 + bne *1 +OK + ldc 1 + loc 1 + loc WS + loc W2S + cii + cmi W2S + zne *1 +OK + ldc -1 + loc -1 + loc WS + loc W2S + cii + cmi W2S + zne *1 +OK + loc -1 + ldc -1 + loc W2S + loc WS + cii + cmi WS + zne *1 +OK +#if WS == 1 + ldc -128 + loc -128 +#endif +#if WS == 2 + ldc -32768 + loc -32768 +#endif +#if WS == 4 + ldc -2147483648 + loc -2147483648 +#endif + loc WS + loc W2S + cii + cmi W2S + zne *1 +OK + ldc -1 + loc -1 + bne *1 +OK + loc -1 + bne *1 +OK + ldc 1 + zeq *1092 +; low order part on top of stack + loc 0 + bne *1 +OK + bra *2092 +; high order part on top of stack +1092 + loc 1 + bne *1 +OK +2092 +#endif +TEST 093: test cii +MAIN 0 + loc 123 + dup WS + loc WS + dup WS + cii + bne *1 +OK +#ifdef W2S + loc 0 + loc WS + loc W2S + cii + loc 0 + bne *1 + loc 0 + bne *1 +OK +; dynamically determine format of doubles + loc 1 + loc WS + loc W2S + cii + zeq *1093 +; low order part on top of stack + loc 0 + bne *1 +OK + loc -3 + loc WS + loc W2S + cii + loc -3 + bne *1 + loc -1 + bne *1 +OK + bra *2093 +; high order part on top of stack +1093 + loc 1 + bne *1 +OK + loc -3 + loc WS + loc W2S + cii + loc -1 + bne *1 + loc -3 + bne *1 +OK +2093 +#endif +TEST 094: test adi W2S +MAIN 0 +#ifdef W2S + ldc 1 + ldc 1 + adi W2S + ldc 2 + cmi W2S + zne *1 +OK + ldc 5 + ldc -6 + adi W2S + ldc -1 + cmi W2S + zne *1 +OK + ldc -1007 + ldc +999 + adi W2S + ldc -8 + cmi W2S + zne *1 +OK + ldc -1300 + ldc +1405 + adi W2S + ldc 105 + cmi W2S + zne *1 +OK + ldc -30000 + ldc -20 + adi W2S + ldc -30020 + cmi W2S + zne *1 +OK +#if WS >= 2 + ldc -100007 + ldc +99999 + adi W2S + ldc -8 + cmi W2S + zne *1 +OK + ldc -1300 + ldc +140567 + adi W2S + ldc 139267 + cmi W2S + zne *1 +OK + ldc -30000000 + ldc -20 + adi W2S + ldc -30000020 + cmi W2S + zne *1 +OK +#endif +#endif +TEST 095: test sbi W2S +MAIN 0 +#ifdef W2S + ldc 1 + ldc 1 + sbi W2S + ldc 0 + cmi W2S + zne *1 +OK + ldc 5 + ldc -6 + sbi W2S + ldc +11 + cmi W2S + zne *1 +OK + ldc -1007 + ldc +999 + sbi W2S + ldc -2006 + cmi W2S + zne *1 +OK + ldc -1300 + ldc +1405 + sbi W2S + ldc -2705 + cmi W2S + zne *1 +OK + ldc -30000 + ldc -20 + sbi W2S + ldc -29980 + cmi W2S + zne *1 +OK +#if WS >= 2 + ldc -100007 + ldc +99999 + sbi W2S + ldc -200006 + cmi W2S + zne *1 +OK + ldc -1300 + ldc +140567 + sbi W2S + ldc -141867 + cmi W2S + zne *1 +OK + ldc -30000000 + ldc -20 + sbi W2S + ldc -29999980 + cmi W2S + zne *1 +OK +#endif +#endif +TEST 096: test mli W2S +MAIN 0 +#ifdef W2S + ldc 5 + ldc 9 + mli W2S + ldc 45 + cmi W2S + zne *1 +OK + ldc 0 + ldc 10 + mli W2S + ldc 0 + cmi W2S + zne *1 +OK + ldc -99 + ldc 7 + mli W2S + ldc -693 + cmi W2S + zne *1 +OK + ldc -100 + ldc -90 + mli W2S + ldc 9000 + cmi W2S + zne *1 +OK +#if WS >= 2 + ldc 123456 + ldc 200 + mli W2S + ldc 24691200 + cmi W2S + zne *1 +OK +#endif +#endif +TEST 097: test dvi W2S +MAIN 0 +#ifdef W2S + ldc 15 + ldc 5 + dvi W2S + ldc 3 + cmi W2S + zne *1 +OK + ldc 100 + ldc -7 + dvi W2S + ldc -14 + cmi W2S + zne *1 +OK + ldc -100 + ldc 7 + dvi W2S + ldc -14 + cmi W2S + zne *1 +OK + ldc -1000 + ldc -201 + dvi W2S + ldc 4 + cmi W2S + zne *1 +OK +#if WS >= 2 + ldc 1234567 + ldc -100 + dvi W2S + ldc -12345 + cmi W2S + zne *1 +OK +#endif +#endif +TEST 098: test rmi W2S +MAIN 0 +#ifdef W2S + ldc 100 + ldc 7 + rmi W2S + ldc 2 + cmi W2S + zne *1 +OK + ldc -100 + ldc 7 + rmi W2S + ldc -2 + cmi W2S + zne *1 +OK + ldc 100 + ldc -7 + rmi W2S + ldc 2 + cmi W2S + zne *1 +OK + ldc -100 + ldc -7 + rmi W2S + ldc -2 + cmi W2S + zne *1 +OK + ldc -1000 + ldc -201 + rmi W2S + ldc -196 + cmi W2S + zne *1 +OK +#if WS >= 4 + ldc 1234567 + ldc -100 + rmi W2S + ldc 67 + cmi W2S + zne *1 +OK +#endif +#endif +TEST 099: test and +MAIN 0 + loc 68 + loc 65 + and WS + loc 64 + bne *1 +OK + loc 17 + loc 34 + loc 3 + loc 36 + and 2*WS + loc 32 + bne *1 + loc 1 + bne *1 +OK + loc 17 + loc 34 + loc 68 + loc -120 + loc 1 + loc 37 + loc 12 + loc -127 + and 4*WS + loc -128 + bne *1 + loc 4 + bne *1 + loc 32 + bne *1 + loc 1 + bne *1 +OK +TEST 100: test ior +MAIN 0 + loc 68 + loc 65 + ior WS + loc 69 + bne *1 +OK + loc 17 + loc 34 + loc 3 + loc 36 + ior 2*WS + loc 38 + bne *1 + loc 19 + bne *1 +OK + loc 17 + loc 34 + loc 68 + loc -120 + loc 1 + loc 37 + loc 12 + loc -127 + ior 4*WS + loc -119 + bne *1 + loc 76 + bne *1 + loc 39 + bne *1 + loc 17 + bne *1 +OK +TEST 101: test xor +MAIN 0 + loc 68 + loc 65 + xor WS + loc 5 + bne *1 +OK + loc 17 + loc 34 + loc 3 + loc 36 + xor 2*WS + loc 6 + bne *1 + loc 18 + bne *1 +OK + loc 17 + loc 34 + loc 68 + loc -120 + loc 1 + loc 37 + loc 12 + loc -127 + xor 4*WS + loc 9 + bne *1 + loc 72 + bne *1 + loc 7 + bne *1 + loc 16 + bne *1 +OK +TEST 102: test com +MAIN 0 + loc 68 + com WS + loc -69 + bne *1 +OK + loc 17 + loc 34 + com 2*WS + loc -35 + bne *1 + loc -18 + bne *1 +OK + loc 17 + loc 34 + loc 68 + loc -120 + com 4*WS + loc 119 + bne *1 + loc -69 + bne *1 + loc -35 + bne *1 + loc -18 + bne *1 +OK +TEST 103: test sli,slu W2S +MAIN 0 +#ifdef W2S + ldc 5 + loc 3 + sli W2S + ldc 40 + cmi W2S + zne *1 +OK + ldc -2 + loc 4 + sli W2S + ldc -32 + cmi W2S + zne *1 +OK + ldc 5 + loc 3 + slu W2S + ldc 40 + cmi W2S + zne *1 +OK + ldc -2 + loc 4 + slu W2S + ldc -32 + cmi W2S + zne *1 +OK +#endif +TEST 104: test sri,sru W2S +MAIN 0 +#ifdef W2S + ldc 64 + loc 5 + sri W2S + ldc 2 + cmi W2S + zne *1 +OK + ldc -3 + loc 2 + sri W2S + ldc -1 + cmi W2S + zne *1 +OK + ldc -16 + loc 3 + sri W2S + ldc -2 + cmi W2S + zne *1 +OK + ldc 64 + loc 5 + sru W2S + ldc 2 + cmi W2S + zne *1 +OK + ldc -3 + loc 2 + sru W2S +#if W2S == 2 + ldc 16383 +#endif +#if W2S == 4 + ldc 1073741823 +#endif + cmi W2S + zne *1 +OK +#endif +TEST 105: common test of double arithmetic +MAIN 0 +#ifdef W2S + ldc 1000 + ldc 10 + mli W2S + ldc 4 + dvi W2S + ldc 1500 + adi W2S + ldc 2856 + sbi W2S + ldc 100 + rmi W2S + ldc 44 + cmi W2S + zne *1 +OK +#endif +TEST 106: test cmi W2S +MAIN 0 +#if W2S==2 + ldc 64 + ldc 4 + mli W2S + ldc 63 + ldc 4 + mli W2S + cmi W2S + tge + loc 1 + bne *1 +OK +#endif +#if W2S==4 + ldc 16384 + ldc 4 + mli W2S + ldc 16383 + ldc 4 + mli W2S + cmi W2S + tge + loc 1 + bne *1 +OK +#endif +TEST 107: test cii W2S -> WS +MAIN 0 +#ifdef W2S + ldc 100 + loc W2S + loc WS + cii + loc 100 + bne *1 +OK + ldc 5000 + ldc -6 + mli W2S + ldc 1000 + dvi W2S + loc W2S + loc WS + cii + loc -30 + bne *1 +OK +#endif +TEST 108: test cif, cfi, adf FS +MAIN 0 +#ifdef FS + loc 100 + loc WS + loc FS + cif + loc 44 + loc WS + loc FS + cif + adf FS + loc FS + loc WS + cfi + loc 144 + bne *1 +OK + loc 65 + loc WS + loc FS + cif + loc -65 + loc WS + loc FS + cif + adf FS + loc FS + loc WS + cfi + loc 0 + bne *1 +OK +#endif +TEST 109: test cdf, cfd +MAIN 0 +#ifdef FS +#ifdef W2S + loc 55 + loc WS + loc W2S + cii + loc W2S + loc FS + cif + loc 55 + loc WS + loc FS + cif + cmf FS + zne *1 +OK + loc 24 + loc WS + loc FS + cif + loc FS + loc W2S + cfi + loc W2S + loc WS + cii + loc 24 + bne *1 +OK + loc 57 + loc WS + loc FS + cif + loc FS + loc W2S + cfi + loc W2S + loc WS + cii + loc 57 + bne *1 +OK + loc 40 + loc WS + loc W2S + cii + loc W2S + loc FS + cif + loc FS + loc WS + cfi + loc 40 + bne *1 +OK +#endif +#endif +TEST 110: test sbf FS +MAIN 0 +#ifdef FS + loc 100 + loc WS + loc FS + cif + loc 50 + loc WS + loc FS + cif + sbf FS + loc FS + loc WS + cfi + loc 50 + bne *1 +OK + loc 32 + loc WS + loc FS + cif + loc 101 + loc WS + loc FS + cif + sbf FS + loc -69 + loc WS + loc FS + cif + cmf FS + zne *1 +OK +#endif +TEST 111: test mlf FS +MAIN 0 +#ifdef FS + loc 4 + loc WS + loc FS + cif + loc 20 + loc WS + loc FS + cif + mlf FS + loc FS + loc WS + cfi + loc 80 + bne *1 +OK + loc -12 + loc WS + loc FS + cif + loc -9 + loc WS + loc FS + cif + mlf FS + loc FS + loc WS + cfi + loc 108 + bne *1 +OK +#endif +TEST 112: test dvf FS +MAIN 0 +#ifdef FS + loc 45 + loc WS + loc FS + cif + loc 9 + loc WS + loc FS + cif + dvf FS + loc 5 + loc WS + loc FS + cif + cmf FS + zne *1 +OK + loc -60 + loc WS + loc FS + cif + loc 7 + loc WS + loc FS + cif + dvf FS + loc FS + loc WS + cfi + loc -8 + bne *1 +OK +#endif +TEST 113: test fractions using FS floating arithmetic +MAIN 0 +#ifdef FS + loc 7 + loc WS + loc FS + cif + loc 2 + loc WS + loc FS + cif + dvf FS + loc FS + loc WS + cfi + loc 3 + bne *1 +OK + loc -7 + loc WS + loc FS + cif + loc 2 + loc WS + loc FS + cif + dvf FS + loc FS + loc WS + cfi + loc -3 + bne *1 +OK + loc 11 + loc WS + loc FS + cif + loc 2 + loc WS + loc FS + cif + dvf FS + loc 5 + loc WS + loc FS + cif + mlf FS + loc 4 + loc WS + loc FS + cif + mlf FS + loc 110 + loc WS + loc FS + cif + cmf FS + zne *1 +OK +#endif +TEST 114: test cif, cfi, adf F2S +MAIN 0 +#ifdef F2S + loc 10 + loc WS + loc F2S + cif + loc 44 + loc WS + loc F2S + cif + adf F2S + loc F2S + loc WS + cfi + loc 54 + bne *1 +OK + loc 65 + loc WS + loc F2S + cif + loc -65 + loc WS + loc F2S + cif + adf F2S + loc F2S + loc WS + cfi + loc 0 + bne *1 +OK +#endif +TEST 115: test cif, cfi W2S F2S +MAIN 0 +#ifdef F2S +#ifdef W2S + loc 55 + loc WS + loc W2S + cii + loc W2S + loc F2S + cif + loc 55 + loc WS + loc F2S + cif + cmf F2S + zne *1 +OK + loc 24 + loc WS + loc F2S + cif + loc F2S + loc W2S + cfi + loc W2S + loc WS + cii + loc 24 + bne *1 +OK + loc 57 + loc WS + loc F2S + cif + loc F2S + loc W2S + cfi + loc W2S + loc WS + cii + loc 57 + bne *1 +OK + loc 41 + loc WS + loc W2S + cii + loc W2S + loc F2S + cif + loc F2S + loc WS + cfi + loc 41 + bne *1 +OK +#endif +#endif +TEST 116: test sbf F2S +MAIN 0 +#ifdef F2S + loc 100 + loc WS + loc F2S + cif + loc 50 + loc WS + loc F2S + cif + sbf F2S + loc F2S + loc WS + cfi + loc 50 + bne *1 +OK + loc 32 + loc WS + loc F2S + cif + loc 101 + loc WS + loc F2S + cif + sbf F2S + loc -69 + loc WS + loc F2S + cif + cmf F2S + zne *1 +OK +#endif +TEST 117: test fmu F2S +MAIN 0 +#ifdef F2S + loc 4 + loc WS + loc F2S + cif + loc 20 + loc WS + loc F2S + cif + mlf F2S + loc F2S + loc WS + cfi + loc 80 + bne *1 +OK + loc -20 + loc WS + loc F2S + cif + loc -6 + loc WS + loc F2S + cif + mlf F2S + loc F2S + loc WS + cfi + loc 120 + bne *1 +OK +#endif +TEST 118: test dvf F2S +MAIN 0 +#ifdef F2S + loc 45 + loc WS + loc F2S + cif + loc 9 + loc WS + loc F2S + cif + dvf F2S + loc 5 + loc WS + loc F2S + cif + cmf F2S + zne *1 +OK + loc -60 + loc WS + loc F2S + cif + loc 7 + loc WS + loc F2S + cif + dvf F2S + loc F2S + loc WS + cfi + loc -8 + bne *1 +OK +#endif +TEST 119: test fractions using F2S floating arithmetic +MAIN 0 +#ifdef F2S + loc 7 + loc WS + loc F2S + cif + loc 2 + loc WS + loc F2S + cif + dvf F2S + loc F2S + loc WS + cfi + loc 3 + bne *1 +OK + loc -7 + loc WS + loc F2S + cif + loc 2 + loc WS + loc F2S + cif + dvf F2S + loc F2S + loc WS + cfi + loc -3 + bne *1 +OK + loc 11 + loc WS + loc F2S + cif + loc 2 + loc WS + loc F2S + cif + dvf F2S + loc 5 + loc WS + loc F2S + cif + mlf F2S + loc 4 + loc WS + loc F2S + cif + mlf F2S + loc 110 + loc WS + loc F2S + cif + cmf F2S + zne *1 +OK +#endif +TEST 120: test cal +HOL 12 +MAIN 0 + loc 0 + ste 4 + cal $p120 + loe 4 + loc 34 + bne *1 +OK +PROC + pro $p120,0 + loc 34 + ste 4 + ret 0 + end +TEST 121: test cal +MAIN 0 + cal $p121 + lfr WS + loc 7 + bne *1 +OK +PROC + pro $p121,0 + loc 7 + ret WS + end +TEST 122: test cal +MAIN 0 + loc 7 + cal $p122 + asp WS + lfr WS + loc 7 + bne *1 +OK +PROC + pro $p122,0 + lol 0 + ret WS + end +TEST 123: test cal +MAIN 4 + loc 7 + stl -4 + lor 0 + cal $p123 + asp PS + lfr WS + loc 7 + bne *1 +OK + lxl 0 + cal $p123 + asp PS + lfr WS + loc 7 + bne *1 +OK +PROC + pro $p123,0 + lxl 1 + lof -4 + ret WS + end +TEST 124: test cal +MAIN 0 + loc 7 + cal $p124 + asp WS +PROC + pro $p124,0 + lol 0 + loc 7 + bne *1 +OK + ret 0 +ERRLAB + end +TEST 125: test cal +MAIN 4 + loc 10 + stl -WS + loc 90 + lxl 0 + cal $p1125 + asp PS+WS +OK +PROC + pro $p1125,WS + lol PS + loc 90 + bne *1 +OK + loc 11 + stl -WS + loc 21 + loc 91 + lxl 0 + cal $p2125 + asp PS+WS + lfr WS +OK + loc 82 + bne *1 +OK + loc 21 + bne *1 +OK + ret 0 +ERRLAB + end + pro $p2125,0 + lol PS + loc 91 + bne *1 +OK + loc 12 + loc 92 + lxl 0 + cal $p3125 + asp PS+WS + lfr WS+WS +OK + loc 86 + bne *1 + loc 83 + bne *1 +OK + loc 12 + bne *1 +OK + lal PS + loi WS + loc 91 + bne *1 +OK + loc 82 + ret WS +ERRLAB + end + pro $p3125,WS + lol PS + loc 92 + bne *1 +OK + loc 13 + stl -WS + lxa 0 + adp PS + loi WS + loc 92 + bne *1 +OK + lxa 1 + adp PS + loi WS + loc 91 + bne *1 +OK + lxa 2 + adp PS + loi WS + loc 90 + bne *1 +OK + lxl 2 + lof -WS + loc 11 + bne *1 +OK + lxl 3 + adp -WS + loi WS + loc 10 + bne *1 +OK + loc 83 + lxl 1 + cal $p4125 + asp PS + lxl 2 + cal $p5125 + asp PS + lxl 3 + cal $p6125 + asp PS + lfr WS + ret WS+WS +ERRLAB + end + pro $p4125,0 + lxa 1 + adp PS + loi WS + loc 91 + bne *1 +OK + ret 0 +ERRLAB + end + pro $p5125,0 + lxa 1 + adp PS + loi WS + loc 90 + bne *1 +OK + ret 0 +ERRLAB + end + pro $p6125,0 + lxl 1 + adp -WS + loi WS + loc 10 + bne *1 +OK + loc 86 + ret WS +ERRLAB + end +TEST 126: test bra +MAIN 0 + bra *0126 + bra *1 +9126 + bra *8126 +0126 + bra *6126 + bra *1 +1126 + bra *5126 + bra *1 +2126 + bra *4126 + bra *1 +3126 + bra *7126 + bra *1 +4126 + bra *3126 + bra *1 +5126 + bra *2126 + bra *1 +6126 + bra *1126 + bra *1 +7126 + bra *9126 + bra *1 +8126 +OK +TEST 127: test ret and lfr +a127 + bss 4,0,0 +MAIN 0 +; return nothing + loc 123 + cal $retw0 + loc 123 + bne *1 +OK +; return single word + cal $retw1 + lfr WS + loc 45 + bne *1 +OK +; return single pointer + cal $retp1 + lfr PS + lae a127 + cmp + zne *1 +OK +; return procedure instance identifier (two pointers) +; this value may not be disturbed by ASP + lxl 0 + cal $retp2 + asp PS + lfr 2*PS + lpi $retp2 + cmp + zne *1 + lxl 0 + cmp + zne *1 +OK +; same as above but with ASS instead of ASP + lxl 0 + cal $retp2 + loc PS + ass WS + lfr 2*PS + lpi $retp2 + cmp + zne *1 + lxl 0 + cmp + zne *1 +OK +PROC + pro $retw0,0 + ret 0 + end + pro $retw1,0 + loc 45 + ret WS + end + pro $retp1,0 + lae a127 + ret PS + end + pro $retp2,0 + lxl 1 + lpi $retp2 + ret 2*PS + end