78 Commits

Author SHA1 Message Date
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
461205d60a Make a nice flag name for evaluate(). 2021-04-21 18:34:11 +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
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
70d06c9a92 Fix a double free. 2021-03-13 14:50:29 +01:00
Bjoren Davis
12e66a65d9 Properly set the character pointer after the operand.
Fixes issue #6.
2021-03-13 14:00:51 +01:00
Olaf Seibert
39653bcd2f Fix typo. 2021-02-13 14:14:37 +01:00
Olaf Seibert
b6d49ec467 Typo/comment fixes. 2021-01-31 17:55:22 +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
c53aec71c3 This TODO has been done (line end checks). 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
6f1af83101 Check junk at end of line with the repeat directives. 2021-01-23 18:37:47 +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
5df0db5b58 First End Of Line checks. 2021-01-23 17:15:32 +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
28f891dc1f Correct name of OC_[12]FIS to OC_FPP{ACGEN,GENAC}. 2021-01-22 18:26:07 +01:00
Olaf Seibert
e720e8a756 Fix floating ac number bounds check. 2021-01-22 18:10:36 +01:00
Olaf Seibert
21c994cfcd Replace magic value by the appropriate constant. 2021-01-22 18:09:42 +01:00
Olaf Seibert
2ac8b7eb5e Replace dodgy strncpy() with better range-checked variant. 2021-01-20 20:40:12 +01: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
592b7facf1 Silence gcc7 warnings by adjusting FALLS THROUGH comment. 2020-03-03 22:11:02 +01:00
Olaf Seibert
78fb685e59 Clarify ORG error message a bit
its counterpart for absolute sections mentions the section type too.
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
ea5ef8587f Add .ENABL LCM. Its default setting was incorrect. 2017-05-06 17:53:15 +02:00
Olaf Seibert
e42bc827ff Merge branch 'master' into mlb2 2017-05-04 23:02:08 +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
8cf4145724 Merge branch 'master' into mlb2 2017-04-27 22:12:48 +02:00
Olaf Seibert
27abf32bf4 Let .LIST and .NLIST affect listing only if they have no argument. 2017-04-27 22:11:31 +02:00
Olaf Seibert
f202984a3c Merge branch 'master' into mlb2 2017-04-27 21:56:54 +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
65f29a6497 Recognize, but ignore, the BSD m11 syntax .MCALL (macrolibname)macroname 2017-04-27 20:44:30 +02:00
Olaf Seibert
f07c9045f5 Prepare for macros being defined in "other ways" which are not yet put in the macro definition table. 2017-04-27 20:43:28 +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
433e8ecda6 Add comment on a format strictness. ...
Remove unneeded #define.
2016-10-22 15:13:34 +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
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
fdceabe88c Add .IF P1 and .IF P2 (tests for pass 1 and 2). 2015-06-04 00:35:31 +02:00
Olaf Seibert
b75195549e Combine .IF IDN and .IF DIF. 2015-06-03 23:03:36 +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
Olaf Seibert
60d0afde00 Use the path search also for .INCLUDE, and add -I option: include path
The -I option is used to specify the search path for .INCLUDE files.
It also appends this to the "INCLUDE" environment variable.
2015-05-31 22:52:05 +02:00
Olaf Seibert
c8dbd26e9a This initialisation wasn't needed. 2015-05-27 22:22:52 +02:00
Olaf Seibert
d38f4009c4 Crank up the warning levels, and adjust the code to silence ...
several compilers:
- gcc version 4.5.3 (NetBSD nb2 20110806)
- gcc version 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
- Ubuntu clang version 3.6.0-2ubuntu1 (tags/RELEASE_360/final) (based on LLVM 3.6.0)

The warnings were mostly about local variables shadowing others,
unused function parameters, and C++ style comments. Some variables were
indeed used before set.

Note that on Linux, using -std=c99 does stupid things like *remove* the
declaration of strdup() from <string.h>. Therefore I've reluctantly used
-std=gnu99.
2015-05-27 21:51:26 +02:00