diff --git a/tools/asm-11/tests-err/README.md b/tools/asm-11/tests-err/README.md new file mode 100644 index 00000000..6bd0fe8e --- /dev/null +++ b/tools/asm-11/tests-err/README.md @@ -0,0 +1,17 @@ +This directory holds asm-11 error response test bench files. + +This fileset tests the error response of asm-11. +All test cases expected to compile with errors. +The test bench files are self-checking and annotated with the expected +compilation result for checking with [asm-11_expect](../../bin/asm-11_expect). +The listing files have the file type `.lsterr`, the make rule for that file type +ignores the non-zero exit code of asm-11. + +The [Makefile](Makefile) provides the targets +``` + make alllda ; create all .lda files + make allcof ; create all .cof files + make alllst ; create all .lsterr files + make allexp ; check all .lsterr files with asm-11_expect + make distclean ; remove all generated files +``` diff --git a/tools/asm-11/tests-err/testerr_0040_inst.mac b/tools/asm-11/tests-err/testerr_0040_inst.mac index cb239657..dfd05be7 100644 --- a/tools/asm-11/tests-err/testerr_0040_inst.mac +++ b/tools/asm-11/tests-err/testerr_0040_inst.mac @@ -1,4 +1,4 @@ -; $Id: testerr_0040_inst.mac 1356 2023-01-26 15:10:23Z mueller $ +; $Id: testerr_0040_inst.mac 1361 2023-01-30 07:48:17Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2023- by Walter F.J. Mueller ; @@ -6,7 +6,27 @@ ; .asect . = 1000 - +; +a = 1 +v: .word 0 +r: rts pc +; +; bad operand type + jsr v,r ;;!! R + rts v ;;!! R + xor v,v ;;!! R + ash #3,v ;;!! R + ashc #3,v ;;!! R + mul #3,v ;;!! R + div #3,v ;;!! R + sob v,. ;;!! R +; +; correct syntax and operand type, but bad usage caught via truncation + spl v ;;!! T + mark v ;;!! T + emt v ;;!! T ; A in MACRO-11 + trap v ;;!! T ; A in MACRO-11 +; ; bad opcodes xxx ;;!! U ; implicit .word with unknown symbol xxx r0 ;;!! Q ; AU in MACRO-11 @@ -17,12 +37,12 @@ mov r0 ;;!! Q ; A in MACRO-11 mov r0, ;;!! Q ; A in MACRO-11 emt ;;!! Q ; ok in MACRO-11 (0 default) - jsr ;;!! Q ; A in MACRO-11 + jsr ;;!! QR ; A in MACRO-11 jsr pc ;;!! Q ; A in MACRO-11 jsr pc, ;;!! Q ; A in MACRO-11 - rts ;;!! Q ; A in MACRO-11 + rts ;;!! R ; A in MACRO-11 br ;;!! Q ; A in MACRO-11 - sob ;;!! Q ; A in MACRO-11 + sob ;;!! QR ; A in MACRO-11 sob r0 ;;!! Q ; A in MACRO-11 sob r0, ;;!! Q ; A in MACRO-11 ; @@ -31,5 +51,24 @@ clr r0 r1 ;;!! Q mov r0,r1,r2 ;;!! Q mov r0,r1 r2 ;;!! Q + halt r0 ;;!! Q + rti v ;;!! Q + rtt v ;;!! Q + wait v ;;!! Q + bpt v ;;!! Q + iot v ;;!! Q +; +; bad specifies + clr (r0 ;;!! Q + clr r0) ;;!! Q + clr +(r0) ;;!! Q ; A in MACRO-11 + clr (r0)- ;;!! Q + clr -(r0 ;;!! Q + clr @+(r0) ;;!! Q ; A in MACRO-11 + clr @(r0)- ;;!! Q + clr a( ;;!! Q ; AQ in MACRO-11 + clr a(r0 ;;!! Q + clr @a( ;;!! Q ; AQ in MACRO-11 + clr @a(r0 ;;!! Q ; .end diff --git a/tools/asm-11/tests/README.md b/tools/asm-11/tests/README.md new file mode 100644 index 00000000..69134987 --- /dev/null +++ b/tools/asm-11/tests/README.md @@ -0,0 +1,16 @@ +This directory holds asm-11 test bench files. + +The test bench files are self-checking and annotated with the expected +compilation result for checking with [asm-11_expect](../../bin/asm-11_expect). +All test cases expected to compile without errors. +The error response is tested in a separate test bench fileset located +in the [tests-err](../tests-err) directory. + +The [Makefile](Makefile) provides the targets +``` + make alllda ; create all .lda files + make allcof ; create all .cof files + make alllst ; create all .lst files + make allexp ; check all .lst files with asm-11_expect + make distclean ; remove all generated files +``` diff --git a/tools/bin/asm-11 b/tools/bin/asm-11 index 762d4bfb..478dd25e 100755 --- a/tools/bin/asm-11 +++ b/tools/bin/asm-11 @@ -1,10 +1,11 @@ #!/usr/bin/perl -w -# $Id: asm-11 1360 2023-01-29 11:51:48Z mueller $ +# $Id: asm-11 1361 2023-01-30 07:48:17Z mueller $ # SPDX-License-Identifier: GPL-3.0-or-later # Copyright 2013-2023 by Walter F.J. Mueller # # Revision History: # Date Rev Version Comment +# 2023-01-30 1361 1.2.6 use 'R' error code; fix 'S' logic # 2023-01-29 1360 1.2.5 BUFGIX: expressions: allow uop after bop operator; # proper sign handling for '/','*' and .if ge,gt,le,lt # 2023-01-27 1359 1.2.4 add minimal .list,.nlist (cnd,me,meb); add -(n)list @@ -1310,10 +1311,10 @@ sub parse_line { add_err(\%l, 'T'); } $op_cmod = 0; - $state = 'op_end'; } else { - $state = 'q'; + add_err(\%l, 'R'); } + $state = 'op_end'; } elsif ($$op_rop{typ} eq 'e') { # operand: expression push @stack, 'op_end'; $state = 'e_beg'; @@ -1780,8 +1781,10 @@ sub parse_line { die "BUGCHECK: unexpected state '$state'\n"; } } - # check that no code is generated above 160000 - if (defined $l{dot} && $l{dot} >= 0160000) { # if '.' >= 160000 + # Check that no code is generated between 160000 and 161000. + # That stops code growth into the IO page, but allows to compile + # code for a m9312 type boot PROMs which start at 165000. + if (defined $l{dot} && $l{dot} > 0160000 && $l{dot} < 0161000) { add_err(\%l, 'S'); # -> signal S (asm-11 specific) $mexit = 1; # abort .macro or .rept $end = 1; # abort file reading @@ -2729,12 +2732,12 @@ sub pass2_lst_line { print $fh $str; if (1) { while (scalar(@ow)) { - $str = ' '; + $str = ' '; for (my $i=0; $i<3; $i++) { $str .= prt76o(shift @ow); } print $fh $str . "\n"; } while (scalar(@ob)) { - $str = ' '; + $str = ' '; for (my $i=0; $i<5; $i++) { $str .= prt43o(shift @ob); } print $fh $str . "\n"; }