201 Commits

Author SHA1 Message Date
Olaf Seibert
706e4e9758 Clang found an uninitialized pointer. 2021-01-23 22:06:12 +01:00
Olaf Seibert
c53aec71c3 This TODO has been done (line end checks). 2021-01-23 21:30:52 +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
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
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
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
a25a509ca5 Add some more test cases. 2021-01-21 20:56:22 +01:00
Olaf Seibert
96942ca6d6 Simplify rounding: unify cases for different sizes.
Mostly taken from Bjoren Davis in issue #5.
2021-01-21 20:56:22 +01:00
Olaf Seibert
8193f2c2cd Fix (rare) problem of exponent overflow when rounding. 2021-01-21 20:06:53 +01:00
Bjoren Davis
c559f1b65f Bump exponent when needed. 2021-01-21 18:04:49 +01:00
Olaf Seibert
3ef63b592e Add test for .MCALL (LIB)MACRO. 2021-01-20 21:33:13 +01:00
Olaf Seibert
2ac8b7eb5e Replace dodgy strncpy() with better range-checked variant. 2021-01-20 20:40:12 +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
4f2f813dee Adjust some comments about precision 2021-01-19 10:52:22 +01:00
Olaf Seibert
7705c33076 Use standard type instead of ulong64 2021-01-19 10:52:22 +01:00
Olaf Seibert
0d2b0950be Fix short float rounding
The exponent was adjusted incorrectly.
2021-01-19 10:52:18 +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
2b6c416408 Prepare for development after released version. 2020-08-22 15:29:13 +02:00
Olaf Seibert
9638d527c9 Bump version to 0.5. 2020-03-24 23:37:59 +01:00
Olaf Seibert
2842c927b8 Add reference to original obj2bin in README. 2020-03-11 22:58:06 +01:00
Olaf Seibert
8ab3c27e0c Plug a memory leak. 2020-03-11 22:53:51 +01:00
Olaf Seibert
1958fa1fad Make default object file format choosable from Makefile. 2020-03-11 21:16:08 +01:00
Olaf Seibert
1508da6f48 Merge commit '114ceaf32c0969a318ec330a26a1ed5c5f4b2b47'
git subtree pull --prefix obj2bin https://github.com/AK6DN/obj2bin.git master
2020-03-11 20:59:37 +01:00
AK6DN
114ceaf32c Added RSX-11 format .obj file reader (as default), set BIN format as default output 2020-03-10 22:25:01 -07:00
Olaf Seibert
8ce31d6bac Add -rt11 and -rsx options to usage message. 2020-03-08 21:38:14 +01:00
Olaf Seibert
5497a73a42 Add 'obj2bin/' from commit '5015ea60c545a7a21b17d5f313601111b96fe1cf'
git-subtree-dir: obj2bin
git-subtree-mainline: 890daab687b2625a59ef0295924fc711bf47bf29
git-subtree-split: 5015ea60c545a7a21b17d5f313601111b96fe1cf

Command was: git subtree add --prefix obj2bin https://github.com/AK6DN/obj2bin.git master
2020-03-08 21:28:29 +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
43aef73305 Fix logical error in listing from maclib.
It seems the code was similarly wrong before I introduced the flag
CALLED_NOLIST in f07c9045f5bf60ccd821a33bb4ebf06d06fe7c48.

No change in regression tests as we don't have macro libraries available
to test.
2020-03-07 23:23:44 +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
AK6DN
5015ea60c5 Update documentation comments 2020-03-06 23:48:55 -08:00
AK6DN
4523bd75e0 Update documentation re: multiple input .obj files 2020-03-06 21:51:29 -08:00
Olaf Seibert
62868a6661 Get rid of #define stricmp strcasecmp. 2020-03-06 22:44:20 +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
7595621cd7 Add new options to usage message. 2020-03-04 19:41:22 +01:00
Kevin Handy
bf322f3c6b Fix file name parsing. 2020-03-04 19:40:56 +01:00
Olaf Seibert
94d044fd77 Add -rt11 option to dumpobj too. 2020-03-03 22:58:32 +01:00
Olaf Seibert
592b7facf1 Silence gcc7 warnings by adjusting FALLS THROUGH comment. 2020-03-03 22:11:02 +01:00