[Simh] CMP R3,(R3)+
Paul Koning
paulkoning at comcast.net
Mon Jul 30 10:06:32 EDT 2018
> On Jul 30, 2018, at 9:51 AM, Timothe Litt <litt at ieee.org> 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 :-)
Oh, ok. Yes, for a memory test that makes sense, but now the incompatibility matters and you have to split the instruction into two.
> ...
>
> Those constructs bring back memories... particularly of debugging such clever code that didn't have the corresponding comment. I often worked on several machines with slightly different ideas of condition codes; switching took some effort. Clever coding is fine - as long as you document it.
>
> BLISS got pretty good at being clever - but never at commenting its assembler code. Some of its contortions caused CPU architects to pause before agreeing that the code should work. On a few occasions, SHOULD and DID diverged...
One example I remember that puzzled me the first time I saw it is CMP (SP)+, (PC)+ which is "pop a word from the stack and skip the next (one-word) instruction".
Then there is the classic "one word to write all of memory" -- 014747 dropped into the last word of memory and executed. For extra credit, there is a one-word program that *clears* all of memory.
paul
More information about the Simh
mailing list