Although Seymour has pointed out the OS/360 convention of placing a return code 
in GR15, there are numerous alternative approaches used elsewhere. Your example 
of using "historical opcodes" (BAL 14,some_test / BE success) was used 
extensively in the National Institute of Health (NIH) version of the Wylbur / 
Milton text editing / communications packages of the 1960s. Other operating 
systems and languages take different approaches (an early version of Bell Labs 
mainframe version of UNIX used R7 for a return code).

Other than the conventional OS-360 approach, I tend to favor the above example 
(i.e., having the subroutine set the CC, rather than the indexed-branch 
approach). Having the subroutine set the CC provides a means of having (up to) 
four possible actions that the calling program can take upon return. You state: 
"The problem for me was that you have to jump through some convolutions to set 
the condition code." However, you still have to have some determination in the 
subroutine that loads a condition code (conventional approach), or selects 
which branch to used (index-branch approach).

Using the indexed branch allows for many more possible actions -- not just 
binary true/false -- but may necessitate accommodating all possible branch 
cases following each return. I also agree that the indexed branch approach may 
be more complicated to maintain. 

As to how to set [and preserve] the condition code, many experienced assembler 
programmers have yet to discover the "newer" instruction SET PROGRAM MASK (SPM) 
[and INSERT PROGRAM MASK (IPM)].  I say "newer" with tongue pressed firmly in 
cheek, since these unprivileged instructions have been around since the 
introduction of the S/370 (five decades ago). 

Reply via email to