52 Commits

Author SHA1 Message Date
Olaf Seibert
0e373a8570 Make operand parsing error messages more helpful
and add a test that is supposed to exercise them all.
2021-03-14 20:19:15 +01:00
Olaf Seibert
6369384e25 Add some missing instructions.
- to tests: MFPT, MTPS, MFPS
- also to opcode set: CSM, TSTSET, WRTLCK
2021-03-13 22:55:04 +01:00
Olaf Seibert
6280a4416e Add test file with all opcodes. 2021-03-13 16:49:16 +01:00
Olaf Seibert
54b73f7f9c Attempt bracketing checking.
Too bad we can't issue a diagnostic here now; we just return failure
and the caller will probably next try a whitespace delimited string
next.
2021-02-18 22:49:52 +01:00
Stephen Casner
05fc94ce90 Extend left-shift operator
- Negative shift values are right-shift
- Optimize shift of 0 or more than 15
- Allow shifting symbols by complex relocation
2021-02-15 19:48:16 +01:00
Stephen Casner
dcdbc02b2e Add binary operator '_' for left shift
If the command line option yus to allow the underscore character in
symbols is NOT selected, then interpret underscore as a new binary
operator meaning to do a left shift of the left side value by the
number of bit positions indicated by the right side value.  As for the
arithmetic operators, both values must be literal (numeric constants
or symbols equated to a numeric constant).
2021-02-14 14:33:42 +01:00
Olaf Seibert
1d799534bb Add Commercial Instruction Set.
I haven't done much compatibility testing with MACRO11 to check
weirdnesses, but the original functionality is very limied: none
of the mnemonics has operands.
2021-01-27 16:31:45 +01:00
Olaf Seibert
e3042c9175 Remove dubious workaround in parse_unary().
The comment "eat first char of illegal label, else endless loop on
implied .WORD" was no longer true. It did reveal some other small
gotchas, which are corrected now as well.
2021-01-23 21:30:52 +01:00
Olaf Seibert
c587587f49 Fix/work around a bug in parse_expr().
There was an obscure bug in parse_expr(), used to evaluate 'if df',
where it could skip past the end of the line marker.

If this happened inside an expanded macro, then after that was the
next line...
In other cases it might be worse.

Now that this is fixed, another check for line end junk can be enabled.
2021-01-23 20:09:32 +01:00
Olaf Seibert
40b41c3087 Here is another. 2021-01-23 17:23:29 +01:00
Olaf Seibert
af0cf5f7bc Here is the "Junk at end of line" case that I wanted to catch. 2021-01-23 17:18:08 +01:00
Olaf Seibert
015c8bee23 Prepent register label values with a % in symbol table.
This changes the layout of all the regression test listings...
2021-01-23 16:37:15 +01:00
Olaf Seibert
0e3d596daf Allow implicit floating point immediate for FPP instructions
which have an general (source) argument and an AC destination.
There are no FPP instrs which have 1 general source arg;
only with 1 general destination (even TSTF).
2021-01-23 16:11:51 +01:00
Olaf Seibert
a25a509ca5 Add some more test cases. 2021-01-21 20:56:22 +01:00
Olaf Seibert
3ef63b592e Add test for .MCALL (LIB)MACRO. 2021-01-20 21:33:13 +01:00
Olaf Seibert
90943eaf49 Add some more tests; rounding of 56-bit mantissa now works. 2021-01-20 19:48:56 +01:00
Olaf Seibert
8aea1498c5 For now, solve the precision problem with brute force,
by using long double where available.
Unfortunately, it won't be available everywhere, so a better solution
would still be nice.
Also, sometimes rounding of smaller sizes doesn't work right yet.
2021-01-19 09:39:02 +01:00
Olaf Seibert
37abe35427 Add some test cases; some are failing so far. 2021-01-18 21:42:18 +01:00
Bjoren Davis
6f7e7963bc small (1 and 2 word) floating point literals not parsed correctly
Fix gitlab issue #5.

The parse_float() function has several bugs:

    1. For 1- and 2-word floats it will always write all 4 bytes if the value is
       exactly 0.
    2. It incorrectly rounds and normalizes 1- and 2-word floats.

To see the issue easily try the following inputs:

     .flt2  1.0
     .flt4  1.0

These will assemble as '040100 000000' and '040200 000000 000000 000000'.
They should both begin '040200'.

In fact the test file test/test-prec.mac is incorrect in its only floating point value:
	.word	^f 1.5		; 040140
should actually assemble as 040300, not 040140 (040140 is actually ^F0.875).
I confirmed this on RT-11 running MACRO V05.06.

I fixed the problem with the following deltas:

[the patch]

The most crucial change is the very last one. 0x200000000000 is actually (1 << 45)
and because ufrac is normalized it means that it will always downshift ufrac by 1.
2021-01-18 20:22:34 +01:00
Olaf Seibert
07ee904c38 Extend test with a case that failed before a24e3ba3eaa70ab56346423a6156ac239737175e 2020-11-10 10:22:55 +01:00
Olaf Seibert
d7a98b8d4a Add another little macro-defined-within-macro test. 2020-08-22 15:45:52 +02:00
Olaf Seibert
890daab687 Add .PAGE as no-op, and give errors for misplaced .ENDR .ENDM. 2020-03-08 16:50:51 +01:00
Olaf Seibert
cdef7047eb Make that .enabl ama does not affect the next pass. 2020-03-07 18:43:45 +01:00
Olaf Seibert
c4221e0b4b Sometimes pc-relative addressing needs no relocation record.
In this case, in an absolute section refering to an absolute symbol.
Use test cases from Johnny Billquist.
2020-03-07 17:34:45 +01:00
Olaf Seibert
88d33fd913 Adjust 2.11BSD-m11-lout.lst.ok.
Because of this corrected sequence:

      575        000000                  lctbas  =       .
      576 000000                                genlct  seq
        1        000001                  lc.seq=        1
-       2                                       .rept   <.-lctbas>/2
+       2        000000                         .rept   <.-lctbas>/2
        3                                lc.seq=        lc.seq+lc.seq
        4                                       .endm
-       1        000002                  lc.seq=        lc.seq+lc.seq
        5 000000 073631                         .rad50  /seq/
        6                                       .if nb  <>
        7                                       lcinit= lcinit+lc.seq
        8                                       .endc

The repeat count is 0. lc.seq previously incorrectly had a value of 2
but now it has the correct value of 1.
This has a knock-on effect on various other expressions throughout, so there
are various changes.
2020-03-06 22:08:02 +01:00
Olaf Seibert
2349d80ec8 Fix .REPT 0 to not repeat the code block at all.
Also, now list the calculated repeat count for reference.
This occurred a few times in the regression tests to fix the expected
outcome.
2020-03-06 21:58:53 +01:00
Olaf Seibert
c80c87b2d4 Test another weird delimiter: .ASCIZ && 2018-11-10 17:12:21 +01:00
Olaf Seibert
2920e9f2f9 Test a few error message with .IIF. 2018-11-10 17:12:21 +01:00
Olaf Seibert
2dbf80388e Add tests for (N)'DF foo!bar' and (N)'DF foo&bar'. 2018-11-10 17:12:21 +01:00
Olaf Seibert
a42b49f73b Bug: '.iif conf, label: foo' didn't work. 2018-11-10 17:12:21 +01:00
Olaf Seibert
877400f236 Fix error message for .odd with argument. 2017-12-18 14:50:17 +01:00
Olaf Seibert
d98c1e54d0 Initial Travis CI config.
Try to get Travis' gmake to run ./make-git-info in before compiling macro11.c.
In RunTests, reflect differences in exit status, for automated testing.
2017-12-18 14:30:30 +01:00
Olaf Seibert
ea5ef8587f Add .ENABL LCM. Its default setting was incorrect. 2017-05-06 17:53:15 +02:00
Olaf Seibert
f3af0d060f Adjust tests: .ENABL LC can now be removed.
This changes all the 2.11 listings.
2017-05-06 17:15:20 +02:00
Olaf Seibert
6be865911c Each pass starts implicitly with .ENABL LC. 2017-05-06 17:11:56 +02:00
Olaf Seibert
203a812664 Add 2.11BSD's m11 sources as regression tests. 2017-05-06 15:49:18 +02:00
Olaf Seibert
f5e1227317 Add some tests for .if etc. Fix a sign bit. 2017-05-04 23:00:43 +02:00
Olaf Seibert
4916b699fa Add ^pl and ^ph expressions from 2.11BSD's m11.
I hope I understood what this is doing!
2017-04-28 23:02:06 +02:00
Olaf Seibert
d61cad6bb4 Add some tests for .BLKB .BLKW .ODD .EVEN
.BLKB and .BLKW should have an argument, but if missing it is 1.
.ODD and .EVEN are not allowed to have an argument.
2017-04-27 21:56:02 +02:00
Olaf Seibert
eb60cfe315 Very simple .LIST and .NLIST implementation.
Thanks to Don North. Also added a simple test.
Fixes #3.
2017-04-23 18:25:17 +02:00
Olaf Seibert
c771c875cb Fix a use-after-free. Found by Don North.
Also adjust test case to include this code.
Fixes #2.
2017-04-23 18:24:38 +02:00
Olaf Seibert
b8a955792c Fix operand check for XOR which is shared with JSR.
Fixes issue #1.
2016-07-11 22:10:15 +02:00
Olaf Seibert
d76e294b06 Add some tests for operators and their (lack of) precedence. 2015-11-09 21:24:10 +01:00
Olaf Seibert
82f68e0d60 Implement .RAD50 <CHR> syntax, and tests. 2015-11-09 21:17:57 +01:00
Olaf Seibert
e148471a19 Extension .ascii ^/.../ conflicts with .ascii ^...^
so I removed it.
2015-11-09 21:11:41 +01:00
Olaf Seibert
09717c3a5a Add comparison files for tests. 2015-11-08 17:41:46 +01:00
Olaf Seibert
137a9db671 More tests. Refine string delimiter test for .ASCII a bit.
Make the delimiters for .INCLUDE and .LIBRARY accept the same
delimiters (= is not disallowed, it just makes the line look like
an assignment).
2015-06-04 12:11:14 +02:00
Olaf Seibert
c423ee346a Handle invalid expressions in .WORD directives with a message.
This is most relevant in implied .WORD directives which are caused by an
attempt to call a macro (which happens to be undefined) with arguments
that don't parse as valid expressions.
2015-06-01 23:30:16 +02:00
Olaf Seibert
ff5179743c Add addressing mode check for JSR, and a test. 2015-06-01 00:28:49 +02:00
Olaf Seibert
a24e3ba3ea Fix check for JMP Rn (which is illegal). 2015-05-31 23:34:05 +02:00