MIT PDP-10 'Info' file converted to Hypertext 'html' format by Henry Baker

Previous Up Next

Arithmetic testing. AOBJP, AOBJN, JUMP, SKIP, CAM, CAI, AOS, SOS, SOJ, AOJ

The AOBJ (Add One to Both halves of AC and Jump) instructions allow forward indexing through an array while maintaining a control count in the left half of an accumulator. Use of AOBJN and AOBJP can reduce loop control to one instruction.
AOBJN   C(AC)<-C(AC)+<1,,1>; If C(AC)<0 then PC<-E;
AOBJP   C(AC)<-C(AC)+<1,,1>; If C(AC)>=0 then PC<-E;
Example. Add 3 to N words starting at location TAB:
        MOVSI 1,-N              ;Initialize register 1 to -N,,0
        MOVEI 2,3               ;register 2 gets the constant 3.
        ADDM 2,TAB(1)           ;add 3 to one array element.
        AOBJN 1,.-1             ;increment both the index and the control.
                                ;Loop until the ADDM has been done N times.
By the way, for the sake of consistency, AOBJN should have been called AOBJL and AOBJP should have been called AOBJGE. However, they weren't.

The JUMP instructions compare the selected accumulator to zero and jump (to the effective address of the instruction) if the specified relation is true.

JUMP            Jump never.  This instruction is a no-op.
JUMPL           If C(AC) < 0 then PC<-E;
JUMPLE          If C(AC) <= 0 then PC<-E;
JUMPE           If C(AC) = 0 then PC<-E;
JUMPN           If C(AC) # 0 then PC<-E;
JUMPGE          If C(AC) >= 0 then PC<-E;
JUMPG           If C(AC) > 0 then PC<-E;
JUMPA           PC<-E.  This is an unconditional branch.
Example:
        JUMPLE 5,FOO    ;Jump to FOO if AC 5 is negative or zero.
The SKIP instructions compare the contents of the effective address to zero and skip the next instruction if the specified relation is true. If a non-zero AC field appears, the selected AC is loaded from memory.
SKIP            If AC#0 then C(AC)<-C(E);
SKIPL           If AC#0 then C(AC)<-C(E);  If C(E) < 0 then skip
SKIPLE          If AC#0 then C(AC)<-C(E);  If C(E) <= 0 then skip;
SKIPE           If AC#0 then C(AC)<-C(E);  If C(E) = 0 then skip;
SKIPN           If AC#0 then C(AC)<-C(E);  If C(E) # 0 then skip;
SKIPGE          If AC#0 then C(AC)<-C(E);  If C(E) >= 0 then skip;
SKIPG           If AC#0 then C(AC)<-C(E);  If C(E) > 0 then skip;
SKIPA           If AC#0 then C(AC)<-C(E);  skip;
Example:
        SKIPL FOO       ;Unless FOO's contents are negative,
         MOVE 1,BAR     ;load BAR's contents into accumulator 1.
                        ;By convention, instructions which can be
                        ;are written indented an extra space.

        SKIPN 2,FOO     ;Load FOO's contents into accumulator 2
                        ;and if they are nonzero, skip the next
                        ;instruction.
The AOS (Add One to memory and Skip) instructions increment a memory location, compare the result to zero to determine the skip condition, If a non-zero AC field appears then the AC selected will be loaded (with the incremented data).
AOS             Add One to Storage (don't skip).
                C(E) <- C(E)+1;  If AC#0 then C(AC)<-C(E);

AOSL            Add One and Skip if Less than zero.
                C(E) <- C(E)+1;  If AC#0 then C(AC)<-C(E);
                 If C(E) < 0 then skip;

AOSLE           Add One and Skip if Less than or Equal to zero.
                C(E) <- C(E)+1;  If AC#0 then C(AC)<-C(E);
                 If C(E) <= 0 then skip;

AOSE            Add One and Skip if Equal to zero.
                C(E) <- C(E)+1;  If AC#0 then C(AC)<-C(E);
                 If C(E) = 0 then skip;

AOSN            Add One and Skip if Not zero.
                C(E) <- C(E)+1;  If AC#0 then C(AC)<-C(E);
                 If C(E) # 0 then skip;

AOSGE           Add One and Skip if Greater than or Equal to zero.
                C(E) <- C(E)+1;  If AC#0 then C(AC)<-C(E);
                 If C(E) >= 0 then skip;

AOSG            Add One and Skip if Greater than zero.
                C(E) <- C(E)+1;  If AC#0 then C(AC)<-C(E);
                 If C(E) > 0 then skip;

AOSA            Add One and Skip Always
                C(E) <- C(E)+1;  If AC#0 then C(AC)<-C(E);
                 skip;
Example:
;This is the way, in parallel processing,
;we wait for a lock to be free and then lock it.
;If the lock is unlocked, it contains -1, so incrementing it yields zero.
        AOSE FOO        ;Increment FOO's contents, skip if zero.
         JUMPA .-1      ;If they aren't zero, do it again.
The SOS (Subtract One from memory and Skip) instructions decrement a memory location, then compare the result to zero to decide whether to skip. If a non-zero AC field appears then the AC selected will be loaded (with the decremented data).

The SOS instructions are just like the AOS instrucrtions except that they subtract one instead of adding one.

SOS             Subtract One from Storage (don't skip).
                C(E) <- C(E)-1;  If AC#0 then C(AC)<-C(E);

SOSL            Subtract One and Skip if Less than zero.
                Perform SOS instruction:
                        C(E) <- C(E)-1;  If AC#0 then C(AC)<-C(E);
                Then, if C(E) < 0 then skip;
The other SOS instructions differ from SOSL only in when they skip.
SOSLE           Subtract One and Skip if Less than or Equal to zero.
SOSE            Subtract One and Skip if Equal to zero.
SOSN            Subtract One and Skip if Not zero.
SOSGE           Subtract One and Skip if Greater than or Equal to zero.
SOSG            Subtract One and Skip if Greater than zero.
SOSA            Subtract One and Skip Always
The AOJ (Add One to AC and Jump) instructions increment the contents of the selected accumulator. If the result bears the indicated relation to zero then the instruction will jump to the effective address.
AOJ             Add One (don't jump).
                C(AC) <- C(AC)+1;

AOJL            Add One and Jump if Less than zero.
                C(AC) <- C(AC)+1; If C(AC) < 0 then PC <- E;
The other AOJ instructions differ from AOJL only in how they decide whether to jump.
AOJLE           Add One and Jump if Less than or Equal to zero.
AOJE            Add One and Jump if Equal to zero.
AOJN            Add One and Jump if Not zero.
AOJGE           Add One and Jump if Greater than or Equal to zero.
AOJG            Add One and Jump if Greater than zero.
AOJA            Add One and Jump Always
The SOJ (Subtract One from AC and Jump) instructions decrement the contents of the selected accumulator. If the result bears the indicated relation to zero then the instruction will jump to the effective address.
SOJ             Subtract One (don't jump).
                C(AC) <- C(AC)-1;

SOJL            Subtract One and Jump if Less than zero.
                C(AC) <- C(AC)-1; If C(AC) < 0 then PC <- E;
The other SOJ instructions differ from SOJL only in how they decide whether to jump.
SOJLE           Subtract One and Jump if Less than or Equall to zero.
SOJE            Subtract One and Jump if Equal to zero.
SOJN            Subtract One and Jump if Not zero.
SOJGE           Subtract One and Jump if Greater than or Equal to zero.
SOJG            Subtract One and Jump if Greater than zero.
SOJA            Subtract One and Jump Always
The CAM (Compare Accumulator to Memory) class compare the contents of the selected accumulator to the contents of the effective address. If the indicated condition is true, the instruction will skip. The CAM instruction is suitable for arithmetic comparision of either fixed point quantities or normalized floating point quantities. Needless to say, for the comparison to be meaningful both C(AC) and C(E) should be in the same format (i.e., either both fixed or both floating).
CAM             no op (references memory)
CAML            If C(AC) < C(E) then skip;
CAMLE           If C(AC) <= C(E) then skip;
CAME            If C(AC) = C(E) then skip;
CAMN            If C(AC) # C(E) then skip;
CAMGE           If C(AC) >= C(E) then skip;
CAMG            If C(AC) > C(E) then skip;
CAMA            skip;
The CAI (Compare Accumulator Immediate) class compare the contents of the selected accumulator to the value of the effective address. If the indicated condition is true, the instruction will skip. An effective address is an 18 bit quantity that is always considered to be positive.
CAI             no op
CAIL            If C(AC) < E then skip;
CAILE           If C(AC) <= E then skip;
CAIE            If C(AC) = E then skip;
CAIN            If C(AC) # E then skip;
CAIGE           If C(AC) >= E then skip;
CAIG            If C(AC) > E then skip;
CAIA            skip;