/360 Condition Codes

   When IBM brought out the /360 mainframe in 1964, one thing that took some getting your head around was processing Condition Codes.
 
 Many operations set a “condition code” which indicated the result of the operation and which could be tested by a Branch-On-Condition instruction:
 
   BC xx,yyyy   =   Branch to yyyy on Condition xx
 
Part of the problem was syntax – the term “Condition Code” had two meanings:

Hardware: The four 2-bit possibilities set by the previous operation
Assembler: The values assigned to those four possibilities for testing purposes.

2-bits    Assigned
 set       values
   00   =   8
   01   =   4
   10   =   2
   11   =   1

In addition, the assigned values could be OR’d for testing.

BC   08,yyyy means Branch if 2-bits were 00
BC   04,yyyy means Branch if 2-bits were 01
BC   02,yyyy means Branch if 2-bits were 10
BC   01,yyyy means Branch if 2-bits were 11

BC   12,yyyy means Branch if 2-bits were 00 or 01
BC   10,yyyy means Branch if 2-bits were 00 or 10
BC   09,yyyy means Branch if 2-bits were 00 or 11

BC   07,yyyy means Branch if 2-bits were 01 or 10 or 11
   Note: 08 and 07 are complimentary numbers re 15
   Thus if BC 08 means Branch Equal, BC 07 means Branch Not Equal
   The same is true of other complementary pairs; BC 12 vs BC 3; BC 9 vs BC 6, etc.

BC 15,yyyy means Branch if 2-bits were 00 or 01 or 10 or 11
And since that covers all possibilities, BC 15 means Absolute Branch
And BC 00,yyyy is a No-Op, since one of the 4 possibilities had to have been set.

There were many Assembler instructions which resolved to one of the 16 possible values
BZ = Branch Equal
BH = Branch High
BL = Branch Low
BNZ = Branch Not Equal
BNH = Branch Not High
BNL = Branch Not Low
BHE = Branch High or Equal
BLE = Branch Low or Equal
BZ = Branch Zero
BNZ = Branch Not Zero
BO = Branch Overflow
etc etc etc

Two binary bits = 4 possible hardware settings = 16 programmable conditions!

Leave a Reply