[Simh] CMP R3,(R3)+

John Dundas dundas at caltech.edu
Mon Jul 30 14:41:50 EDT 2018


> 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.

The syntax should be:

     ADD #2,R3

in PAL/PALX/MACRO-11.  But this generates two words rather than one word 
as used by the CMP instruction.

> Would there be any possible downside to using TST (R3)+ instead?

A number of possibilities have already been covered.  Also consider:

BIT (R3)+,(R3)+

(different result in the condition codes) and

INC R3
INC R3

Note this is two words but may be faster as it is two instruction 
fetches and no gratuitous memory references.

John


More information about the Simh mailing list