30 Commits

Author SHA1 Message Date
Olaf Seibert
2aa43f17f7 Make some expression tree operations more generic. 2021-11-15 18:26:10 +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
ef66dd0379 Fix pasto. 2021-11-14 19:20:02 +01:00
Olaf Seibert
1722fae3d4 Rename 'rel' field to 'pcrel'. 2021-07-04 20:02:21 +02:00
Olaf Seibert
7f38f6ae03 Make it really easy to test putting undefined symbols in the main table. 2021-06-09 23:09:28 +02:00
Olaf Seibert
354aadfdc0 Add comment about undef'd symbols
that they can also be put in the main symbol table, since all code is
made to work with that scenario.
2021-05-30 21:52:08 +02:00
Olaf Seibert
d2d143dd9b Put undefined symbols in separate table.
Even though all regression tests pass, it feels better to do the
undefined symbols similar to the implicit globals.
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
426db4afda Make 2 "invalid expression" messages more exolicit. 2021-05-28 17:12:33 +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
93d7839ccf Expand some tabs that crept in over time. 2021-02-14 22:00:30 +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
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
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
592b7facf1 Silence gcc7 warnings by adjusting FALLS THROUGH comment. 2020-03-03 22:11:02 +01:00
Olaf Seibert
a685d341c5 First changes in 0.5wip: correct some grammar (it's vs. its). 2016-02-21 21:13:50 +01: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
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
168340c54c A bit more tweaking of output/listing. 2015-05-21 00:57:52 +02:00
Olaf Seibert
59711f17f2 Make trailing commas work in .BYTE and .WORD
16 000000 000123                  state:  .word   123    ; 1 word
      17 000002 000000                          .word          ; 1 word
      18 000004 000001  000000                  .word   1,     ; 2 words
      19 000010 000000  000002                  .word   ,2     ; 2 words
      20 000014 000000  000000                  .word   ,      ; 2 words
      21 000020 000000  000000  000000          .word   ,,     ; 3 words
      22 000026 000001  000000  000000          .word   1,,    ; 3 words
      23 000034 000000  000000  000003          .word   ,,3    ; 3 words
      24 000042 000001  000000  000003          .word   1,,3   ; 3 words
      25 000050 000001  000002  000003          .word   1,2,3  ; 3 words
2015-05-19 22:57:45 +02:00
Olaf Seibert
2488e02aae A few more small listing tweaks. 2015-05-19 22:09:53 +02:00
Olaf Seibert
f34996452b Mark PSECT relocation also with a ' in the listing. 2015-05-19 00:50:17 +02:00
Olaf Seibert
833d9186cc Make empty expressions in .byte and .word work
such as
        .byte   ,0
2015-05-14 14:32:46 +02:00
Olaf Seibert
21b5f2269f Spaces. Spelling. 2015-05-10 00:32:14 +02:00
Olaf Seibert
e55979b30d Add a symbol and section table dump at the end of the listing. 2015-05-10 00:04:41 +02:00
Olaf Seibert
32b8059cf8 Put code where it belongs. 2015-05-09 23:54:54 +02:00
Toby Thain
48996a6627 Typo and one more warning. 2015-02-01 22:25:59 -05: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