More Branch Instructions
Branch on Count
RX Format: label BCT R,D(X,B)
Decrements the value in R by 1 and branches to D(X,B) if the value in R is not 0
If R contains 0, instruction immediately following BCT is executed
RR Format: label BCTR R1,R2
Decrements the value in R1 by 1 and branches to the address in R2 if the value in R1 is not 0
If R1 contains 0, instruction immediately following BCTR is executed
EXCEPTION: If R2 is register 0, then 1 is subtracted from the value in R1 and NO branch is taken
LA R4,3 LA R4,3 LA R4,3 DO1 LTR R4,R4 DO1 LTR R4,R4 DO1 XREAD BUFFER,80 BZ ENDDO1 BZ ENDDO1 XPRNT BUFFER,80 XREAD BUFFER,80 XREAD BUFFER,80 BCT R4,DO1 XPRNT BUFFER,80 XPRNT BUFFER,80 EXIT BR R14 S R4,=F‘1’ BCTR R4,R0 B DO1 B DO1 ENDDO1 DS 0H ENDDO1 DS 0H EXIT BR R14 EXIT BR R14