81 Commits

Author SHA1 Message Date
Paul Koning
7354aadbfc Allow expression (with constant value) in .RADIX
Also add a test file for it.
2022-06-28 09:32:34 -04:00
Olaf Seibert
08912623a9 Comments in playground. 2022-06-27 21:12:30 +02:00
Paul Koning
21f21b9799 Fix macro calls with omitted argument that has a default value,
followed by additional (not omitted) arguments.
2022-06-26 13:41:37 -04:00
Paul Koning
aa8d5fdfef Always list lines that have an error 2022-06-26 13:40:00 -04:00
Paul Koning
43d7b493fb Allow TRAP without argument, or with non-literal argument 2022-06-26 13:13:49 -04:00
Olaf Seibert
3eb7274625 Add some FP test cases, including some parse errors.
Adjust the parsing a bit, and generate 0 values for bad syntax
like the reference version does.
2022-06-19 16:16:31 +02:00
Olaf Seibert
3109f40bd5 Parse floats using integers (64 bits) only.
The algorithm is close to what the reference version is doing.
2022-06-19 14:56:14 +02:00
Olaf Seibert
bb56fc33f1 Add floating point parsing playground. 2022-06-19 14:49:41 +02:00
Olaf Seibert
ff183c0e36 Improve parsing of symbols.
In particular, don't confuse `4..` with a symbol.
2022-06-04 21:31:06 +02:00
Olaf Seibert
29cd179ff6 Remove outdated comment in test. 2021-11-30 21:56:45 +01:00
Olaf Seibert
3a9d809b75 Optimize the previous version.
Fold the functionality of pull_up_reg() into evaluate_rec().
pull_up_reg() essentially returned a flag (EX_REG at the top, or not)
which can be represented with the outgoing flags word.
The check for recursion depth is made unneeded by doing the
"exceptional" case outside the recursion; luckily it is actually the
common case.
2021-11-15 21:35:37 +01:00
Olaf Seibert
1067b63043 Add the test with the weird expressions with registers.
Now that we have some code that seems to do pretty much what we want.
2021-11-15 19:28:19 +01:00
Olaf Seibert
c29dc7d7af Work in progress...
Make expressions work where the % operator isn't (only) at the top
level.
2021-11-15 19:28:19 +01:00
Olaf Seibert
21e9410571 Add evaluation of %+unary expressions.
This is a first step towards expressions like <%1>+1 and even later R1+1.
2021-11-15 18:31:15 +01:00
Olaf Seibert
16b884a744 Add some more abusive test cases. 2021-11-14 23:09:35 +01:00
Olaf Seibert
3c858fe45d Make sure immediate operands #R0 etc are output as absolute values.
Previously it was generated as relocatable.
2021-11-14 23:05:20 +01:00
Olaf Seibert
1c37223977 Make sure .word R0 etc are output as absolute values.
Previously it was generated as relocatable.
2021-11-14 22:49:44 +01:00
Olaf Seibert
3342090916 More silly %-register tests. 2021-11-14 17:09:29 +01:00
Olaf Seibert
652c047711 Better error message for .globl 1$
Local labels can't be exported (or imported).
2021-05-30 13:19:39 +02:00
Olaf Seibert
0ab2a4fa16 Add consistency checking for symbol flags
while also adding some consistency.
All listings now list . (dot) as defined so they need updating.
2021-05-30 13:19:39 +02:00
Olaf Seibert
7bbcbba5f5 Include undefined symbols in the symbol table for listing purposes.
MACRO11 V05.05 does this:

```
.MAIN.  MACRO V05.05  Sunday 18-APR-2021 16:29  Page 1

      1
      2 000000  012700  000000G                 mov #lab1,r0
      3
      4                                         .dsabl gbl
      5
U     6 000004  012700  000000                  mov #lab2,r0
      7
      8         000001                          .end

.MAIN.  MACRO V05.05  Sunday 18-APR-2021 16:29  Page 1-1
Symbol table

LAB1  = ****** GX       LAB2  = ******

. ABS.  000000    000   (RW,I,GBL,ABS,OVR)
        000010    001   (RW,I,LCL,REL,CON)
Errors detected:  1

*** Assembler statistics

Work  file  reads: 0
Work  file writes: 0
Size of work file: 34 Words  ( 1 Pages)
Size of core pool: 9260 Words  ( 35 Pages)
Operating  system: RSX-11M/M-PLUS

Elapsed time: 00:00:00.01
GBL,GBL/-SP=GBL
```
2021-05-30 13:19:39 +02:00
Olaf Seibert
877248f94e More detailed error messages about bad addressing modes
because of gitlab issue #10.
2021-05-28 19:02:31 +02:00
Olaf Seibert
e21f390722 Adjust tests with new error message. 2021-05-28 17:18:55 +02:00
Olaf Seibert
cb8103d112 Run tests in both RSX11 and RT11 format.
This is possible since our reference files are output from dumpobj,
and that does not depend on the format.
2021-05-16 14:04:43 +02:00
Olaf Seibert
cb331d2a55 Add some register label tests that don't work yet. 2021-04-21 18:44:53 +02:00
Olaf Seibert
9ade850447 Fix typo. 2021-04-21 18:39:58 +02:00
Olaf Seibert
2753b081cc Start each pass with .DSABL LSB
otherwise the end of pass 1 carries over into pass 2, which messes with
the ranges of local symbols.
2021-04-18 15:18:38 +02:00
Olaf Seibert
22fdaedded Some floating point fixes.
- Fixed immediate source operand of LDEXP, LD[IL][FD]
  which is an integer, unlike several other FPP instructions.
- Renamed floating point instruction formats so they match the
  instruction descriptions in the architecture handbook better.
2021-03-30 20:13:31 +02:00
Olaf Seibert
b100021ffd Add check for odd branch target.
Apart from the fact that instruction addresses must be even, this can't
even be expressed since the branch offset is expressed in words.
2021-03-14 21:19:18 +01:00
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