HP 21mx

J. David Bryan jdbryan at acm.org
Sat Apr 11 12:02:39 CDT 2009


This is an old one, but it just showed up on cctech.


On Sunday, March 22, 2009 at 9:18, dwight elvey wrote:

> If I had the sequence SLA,INA would the skip happen before the INA or
> after? Would the test for the skip happen before or after the INA? 

The general rules are:

 1. The sequences are executed left to right.

 2. The next instruction will be skipped if any skip test is true.

If a skip test was true, P is incremented just before completing the 
current instruction.  This sets the stage for the instruction skip when the 
next instruction is fetched.

So SLA,INA tests if bit 0 of A is 0 and then increments A.  If the test was 
true, then P is incremented.

An instruction such as RAL,CLE,SLA,ERA rotates A left, then clears the E 
register, then tests if bit 0 of A is clear, and then rotates A with E 
right.  If the test was true, then P is incremented.  The effect is to 
clear the MSB of A and skip the next instruction if it had been zero at the 
start of the instruction.

To be really perverse, the instruction CMA,SEZ,CME,SSA,SLA,INA:

 - one's complements A
 - tests if E is 0
 - complements E
 - tests if bit 15 of A is 0
 - tests if bit 0 of A is 0
 - increments A

So the effect is to two's complement A, complement E, and skip if E was 
zero or the MSB or LSB of A was one on entry (because the test on E is done 
before its complement, but the tests on A are done after its complement).

There is a caveat when RSS is combined with multiple skip instructions; see 
one of the 21MX Operating and Reference Manuals for details.

                                      -- Dave



More information about the cctech mailing list