[Simh] CMP R3,(R3)+
Johnny Billquist
bqt at softjar.se
Mon Jul 30 11:45:48 EDT 2018
On 2018-07-30 15:51, Timothe Litt wrote:
> On 30-Jul-18 09:30, Paul Koning wrote:
>> Yes, that is the standard way to do this. I have never seen the code you quoted before and I can't imagine any reason for doing that.
> A memory address test's verification pass. Check that memory contains
> address of self. Of course, you need a
>
> bne fail
> following the compare :-)
Not to mention that it will succeed or fail depending on which PDP-11
model you run the code on? :-)
Just as Paul, I have never seen anyone actually do CMP R3,(R3)+. Most
assemblers will give a warning just because the actual values used will
vary depending on model.
>> Either option of course only works if R3 contains a valid memory address, and it must be even.
> I should have noted that "valid memory address" includes "even" for
> words. But if the code provided works on any 11 (obviously, not the
> 11/20), that constraint is met.
I thought about that one for a moment as well, but since the results of
the compare itself was obviously irrelevant, using a TST instead of a
CMP does not make the code any more error prone than before.
The CMP would have barfed on an illegal or odd address already. Using a
TST will cause the same effects, except that condition codes will be
different at the end. In all other aspects they produce the same result.
Johnny
--
Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: bqt at softjar.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol
More information about the Simh
mailing list