[Simh] CMP R3,(R3)+

Timothe Litt litt at ieee.org
Sun Jul 29 16:42:05 EDT 2018


On 29-Jul-18 06:42, Lars Brinkhoff wrote:
> Hello,
>
> I have a very small debugger for the GT40 called URUG, or micro RUG.  It
> has two troublesome instructions: CMP R3,(R3)+ and equivalent with R4.
> I suppose SIMH will run it fine even though there's a hazard?
>
> The PALX assembler complains about this, so I'm considering chaning the
> code.  As far as I can see, the instructions are used to add 2 to a
> register.  It's shorter than an ADD R3,#2, which is important because
> there's not a lot of memory on this machine.
>
> Would there be any possible downside to using TST (R3)+ instead?
>
> The whole file is here:
> https://github.com/PDP-10/its-vault/blob/master/files/sysen2/urug.27
>
I think the 11/20 had a bug and compared C(r3)+2 to @R3; the original
intent was that it would compare C(r3) to @R3; then increment R3.  I
don't recall if it was fixed in later machines.

In any case, the CMP's purpose is to set the condition codes - e.g. it
does a subtract to set the condition codes, comparing the register
contents with memory.  Aside from the autoincrement, it has no other
side effects.

Your code doesn't use the condition codes, so there's no difference
between your cmp and a TST (R3)+.

In either case, the instruction is making a memory reference.  So R3
must not point at NXM (or many I/O devices, which have read side-effects).

As long as R3 points to a valid location in core memory, TST should be fine.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20180729/7ed7a772/attachment.html>


More information about the Simh mailing list