15 Commits

Author SHA1 Message Date
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
461205d60a Make a nice flag name for evaluate(). 2021-04-21 18:34:11 +02:00
Stephen Casner
ef8afb9e5f Put back a blank line unintentionally deleted 2021-02-15 19:48:23 +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
706e4e9758 Clang found an uninitialized pointer. 2021-01-23 22:06:12 +01:00
Olaf Seibert
433e8ecda6 Add comment on a format strictness. ...
Remove unneeded #define.
2016-10-22 15:13:34 +02:00
Olaf Seibert
d6ff111149 Introduce a function to create a binary expression node. 2015-11-08 20:51:07 +01:00
Olaf Seibert
40ff236aaf Make free(tp) common code. 2015-11-08 20:49:37 +01: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
Olaf Seibert
8433503792 Make sure that undefined global symbols don't get reduced to 0 when negated
Test case:

        ; test complex relocations

        ; .globl  IE.ITS,IE.MON ; implicit
        mov     #-IE.ITS, space

space:  .word   IE.ITS    ; the only simple relocation
        .word   -IE.ITS   ; all others are complex relocations
        .word   ^C<IE.ITS>
        .word   IE.ITS + IE.MON
        .word   IE.ITS - IE.MON
        .word   IE.ITS * IE.MON
        .word   IE.ITS / IE.MON
        .word   IE.ITS & IE.MON
        .word   IE.ITS ! IE.MON
2015-05-21 23:21:19 +02:00
Olaf Seibert
2bc55f39f3 Add debug flag to command line interpretation. 2015-05-10 17:39:38 +02:00
Olaf Seibert
cf320a2e60 Fix use-after-free errors.
evaluate() would not-quite-copy the original tree, which often would
get freed afterward. Including the shared parts.
Also fixed the case where evaluate() would turn a EX_NEG node into an
EX_COM node.
2015-05-07 23:26:38 +02:00
Sergey Svishchev
6a2afc3fa7 Import J Hoppe's 20090427 release from http://retrocmp.com/tools/macro-11-on-windows 2013-02-15 23:50:38 +04:00