<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Being able to fix bugs like this is one of the reasons we like open
source so much.<br>
<br>
I took a look at a copy of the gas source I have online.
Thankfully, the pdp-11 assembly parser is not embedded within nor
totally intertwined with the monstrosity (my opinion; obviously
others don't see it that way) known as "bfd". <br>
<br>
If I'm not mistaken, the bug is within binutils/gas/config/pdp11.c .
The routine parse_op_noreg () in that file contains:<br>
<pre> if (*str == '@' || *str == '*')
{
str = parse_op_no_deferred (str + 1, operand);
if (operand->error)
return str;
operand->code |= 010;
}
</pre>
and the routine<tt> parse_op_no_deferred() </tt> is little more than
a large, complex switch on the next (non-whitespace) char, the
first case of which assumes that if the char is '<tt>(</tt>', then
the mode must be either <tt>(rn) </tt>or<tt> (rn)+</tt>.<br>
<br>
It seems that <tt>operand->code</tt> is being set "wrong", as
(at least for MACRO-11 compatibility) the code above should have the
call to parse_op_no_deferred() set that field to (registerno | (6
<< 3)) for a mode 7 operand, after which the "|= 010" would
change it to mode 7. But within <tt>parse_op_no_deferred()</tt><b>,</b><tt><b>
</b></tt>as the '@' before "(ER)" was already eaten before the
routine was called, you get mode 1, not mode 6 (again without being
able to consider the '@' within this routine).<br>
<br>
Perhaps a fix could involve setting the 010 (octal) bit before
(rather than after) the call to parse_op_no_deferred(), and when it
gets in there, it could use that as a flag saying that finding a
'(' will lead to the mode 6 code path (not the mode 1 code path),
resulting in mode 7 (because of the '@')), & the setting of <tt>operand->word</tt>
to 0.<br>
<br>
- michael<br>
<br>
P.S. Apologies if I've totally missed the boat. it's late and i'm
ghetting punchy....<br>
<br>
<br>
<br>
On 08/21/2012 05:48 PM, Larry Baker wrote:
<blockquote
cite="mid:%3C822ADDAD-6C96-49A9-BFE6-4DFBB92F0CD3@usgs.gov%3E"
type="cite">
<div>On 17 Aug 2012, at 9:00 AM, <a moz-do-not-send="true"
href="mailto:simh-request@trailing-edge.com">simh-request@trailing-edge.com</a>
wrote:</div>
<div><br class="Apple-interchange-newline">
<blockquote type="cite"><span class="Apple-style-span"
style="border-collapse: separate; font-family: 'Helvetica
Neue'; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
normal; orphans: 2; text-align: -webkit-auto; text-indent:
0px; text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; -webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width:
0px; font-size: medium; "><span class="Apple-style-span"
style="font-family: monospace; ">Well, using the DEC
notation for PDP-11 assembler language, @(R0) and <br>
(R0) are indeed two different things, and you seem to have
understood it <br>
perfectly right.<br>
Not sure if gas might have its own ideas about notation
though...<br>
</span></span></blockquote>
</div>
<div><br>
</div>
<div>See the NOTE at the bottom of page 5-5 in Section 5.8, INDEX
DEFERRED MODE, in the PDP-11 MACRO-11 Language Reference Manual
on the BitSavers web site (<a moz-do-not-send="true"
href="http://www.bitsavers.org/pdf/dec/pdp11/rsx11/RSX11M_V4.1_Apr83/4_ProgramDevelopment/AA-V027A-TC_macro11_Mar83.pdf">http://www.bitsavers.org/pdf/dec/pdp11/rsx11/RSX11M_V4.1_Apr83/4_ProgramDevelopment/AA-V027A-TC_macro11_Mar83.pdf</a>):</div>
<div><br>
</div>
<div> The expression @(ER) may be used, but it</div>
<div> will be assembled as if it were written</div>
<div> @0(ER), and a word will be used to store</div>
<div> the 0.</div>
<div><br>
</div>
<div>GAS has got it wrong. There really is no addressing mode of
the form @(ER). GAS should either follow MACRO-11 and convert
@(ER) to @0(ER), or it should give an error. It should not
convert @(ER) to @ER, which is equivalent to (ER). That is, it
should not be silently eliminating the @ deferred address
operator from the operand.</div>
<div><br>
</div>
<div>Larry Baker</div>
<div>US Geological Survey<br>
650-329-5608<br>
<a moz-do-not-send="true" href="mailto:baker@usgs.gov">baker@usgs.gov</a><br>
<br>
</div>
</blockquote>
<br>
<br>
</body>
</html>