C      JOB   TEST COMPARE LOGIC
       ORG   500
START  CS    332
       CS
       MLCWA @TEST OF COMPARE INSTRUCTION@,290
       W
       CS    299
       H
*
*      COMPARE TWO FIELDS OF THE SAME LENGTH, ONE CHARACTER, B>A
*
       C     CA,CB
       BH    OK1                              
       MLCWA @COMPARE OF @A@ AND @B@ FAILED, EXPECTED B>A, GOT @,290
       B     WC                              CALL COMPARE PRINT
       W
       CS    299
*
* COMPARE TWO VALUES, A FIELD LONGER THAN B FIELD, RESULT SHOULD BE EQUAL
*
OK1    C     CAB,CB
       BE    OK2
       MLCWA @COMPARE OF @AB@ AND @B@ FAILED, EXPECTED B=A, GOT @,290
       B     WC
       W
       CS    299
*
* COMPARE TWO VALUES, B-FIELD LONGER THAN A-FIELD, RESULT SHOULD BE HIGH
*
OK2    C     CA,CAA
       BH    OK3
       MLCWA @COMPARE OF @A@ AND @AA@ FAILED, EXPECTED B>A, GOT @,290
       B     WC
       W
       CS    299
*
* COMPARE TWO VALUES, SAME WIDTH FIELD, B<A RESULT LOW
*
OK3    C     CB,CA
       BL    OK4
       MLCWA @COMPARE OF @B@ AND @A@ FAILED, EXPECTED B<A, GOT @,290
       B     WC
       W
       CS    299
*
* COMPARE TWO VALUES, SAME LENGTH FIELD, RESULT SHOULD BE EQUAL
*
OK4    C     CA,CA
       BE    OK5
       MLCWA @COMPARE OF @AB@ AND @A@ FAILED, EXPECTED B=A, GOT @,290
       B     WC
       W
       CS    299
*
* COMPARE TWO VALUES, DIFFER IN MIDDLE, RESULT SHOULD BE HIGH
*
OK5    C     CABC,CADC
       BH    OK6
       MLCWA @COMPARE OF @ABC@ AND @ADC@ FAILED, EXPECTED B>A, GOT @,290
       B     WC
       W
       CS    299
*
* COMPARE TWO FIELDS, DIFFER IN MIDDLE, B < A
*
OK6    C     CADC,CABC
       BL    OK7
       MLCWA @COMPARE OF @ADC@ AND @ABC@ FAILED, EXPECTED B<A, GOT @,290
       B     WC
       W
       CS    299
*
* COMPARE TWO FIELDS, MULTICHARACTER, EQUAL
*
OK7    C     CABC,CABC
       BE    OK8
       MLCWA @COMPARE OF @ABC@ AND @ABC@ FAILED, EXPECTED B=A, GOT @,290
       B     WC
       W
       CS    299
*
* COMPARE WITH CHAINING, FOUR FIELDS, RESULT SHOULD BE EQUAL
*
OK8    C     CHAIN1,CHAIN1
       C
       BE    OK9
       MLCWA @CHAINED COMPARE FAILED, EXPECTED B=A, GOT@,290
       B     WC
       W
       CS    299
*
* COMPARE WITH CHAINING, FOUR FIELDS, RESULT SHOULD BE B>A
*
OK9    C     CHAIN1,CHAIN2
       C
       BH    OK10
       MLCWA @CHAINED COMPARE FAILED, EXPECTED B>A, GOT @,290
       B     WC
       W
       CS    299
*
* COMPARE OF TWO CHAINED FIELDS, EXPECT B<A
*
OK10   C     CHAIN2,CHAIN1
       C
       BL    OK11
       MLCWA @CHAINED COMPARE FAILED, EXPECTED B<A, GOT @,290
       B     WC
       W
       CS    299
*
* END OF TESTS
*
OK11   MLCWA @END OF COMPARE INSTRUCTION TEST@,290
       W     
       CS    299
       H     *-3
*
*      SUBROUTINE TO PRINT OUT RESULT OF COMPARISON
*
WC     SBR   WCR+3
       BH    HIGH
       BL    LOW
       MLCWA @B=A@,299
       B     WCR
HIGH   MLCWA @B>A@,299
       B     WCR
LOW    MLCWA @B<A@,299
WCR    B     0
*
*
CA     DCW   @A@
CB     DCW   @B@
CAB    DCW   @AB@
CAA    DCW   @AA@
CABC   DCW   @ABC@
CADC   DCW   @ADC@
*
       DCW   @DEF@
CHAIN1 DCW   @ABC@
*
       DCW   @XYZ@
CHAIN2 DCW   @ABC@
*
       END   START

       