The second operand is subtracted from the first oper
and, and the difference is placed in the first-
operand location. The occurrence of a carry out of
the sign position is recorded in the condition code.
Logical subtraction is considered to be performed
by adding the one's complement of the second oper
and and a low-order one to the first operand. All 32
bits of both operands participate, without further
change to the resulting sign bit. The instruction dif
fers fromSUBTRACT in the meaning of the condi
tion code and in the absence of the interruption for
overflow.
If a carry out of the sign position occurs, the left
most bit of the condition code is made one. In the
absence of a carry, the bit is made zero. When the
sum iszero, the rightmost bit of the condition code
is made zero. For a nonzero sum, the bit is made
one.Resulting Condition Code:
o -
1 Difference is not zero, with no carry
2 Difference is zero, with carry
3 Difference is not zero, with carry
Program Exceptions:
Access (fetch, operand 2 ofSL only)
Programming Note
The use of the one's complement and the low-order
oneinstead of the two's complement of the second
operand results in the recognition of carry when
subtracting zero or the maximum negative number.
A zero difference cannot be obtained without a car
ry out of the sign position.Superl'isor Call SVC [RR]
o 8 15
The instruction causes a supervisor-call interruption,
with the I field of the instruction providing the inter
ruptionIcode. The contents of bit positions 8-15 of the instruc
tion, with eight high-order zeros appended, are
placed in the supervisor-call interruption code that is
stored in the course of the interruption. The oldPSW is stored at location 32, and a new PSW is ob
tained from location 96. The instruction is valid in
both the problem and supervisor states.
144System/370 Principles of Operation Condition Code:
The code remains unchanged in the oldPSW. Program Exceptions:
None
Test and SetTS [S] The leftmost bit (bit position 0) of the byte located
at the second-operand address is used to set the conI dition code, and then the entire addressed byte is set
to all ones. Bits 8-15 of the instruction are ignored.
The byte in storage is set to all ones as it is
fetched for the testing of bit positionO. No access by
anotherCPU is permitted to this location between
the moment of fetching and the moment of storing
all ones.
A serialization function is performed before the
byte is fetched and again after the storing of all
ones.CPU operation is delayed until all previous
accesses by thisCPU to main storage have been
completed, as observed by channels and otherCPUs, and then the byte is fetched. No subsequent
instructions or their operands are accessed by thisCPU until the all-ones value has been placed in main
storage, as observed by channels and otherCPUs. Resulting Condition Code:
o Leftmost bit of byte specified is zero
1 Leftmost bit of byte specified is one
2 -
3 -
Program Exceptions:
Access (fetch and store, operand 2)
Programming NoteTEST AND SET can be used for controlled sharing
of a common storage area by more than one pro
gram. To accomplish this, bit position0 of a byte
must be designated as the control bit. The desired
interlock can be achieved by establishing a program
convention in which a zero in the bit position indi
cates that the common area is available but a one
means that the area is being used. Each using pro
gram then must examine this byte by means ofTEST AND SET before making access to the com
mon area. If the test sets condition code0, the area
is available for use; if it sets condition code 1, the
and, and the difference is placed in the first-
operand location. The occurrence of a carry out of
the sign position is recorded in the condition code.
Logical subtraction is considered to be performed
by adding the one's complement of the second oper
and and a low-order one to the first operand. All 32
bits of both operands participate, without further
change to the resulting sign bit. The instruction dif
fers from
tion code and in the absence of the interruption for
overflow.
If a carry out of the sign position occurs, the left
most bit of the condition code is made one. In the
absence of a carry, the bit is made zero. When the
sum is
is made zero. For a nonzero sum, the bit is made
one.
o -
1 Difference is not zero, with no carry
2 Difference is zero, with carry
3 Difference is not zero, with carry
Program Exceptions:
Access (fetch, operand 2 of
Programming Note
The use of the one's complement and the low-order
one
operand results in the recognition of carry when
subtracting zero or the maximum negative number.
A zero difference cannot be obtained without a car
ry out of the sign position.
o 8 15
The instruction causes a supervisor-call interruption,
with the I field of the instruction providing the inter
ruption
tion, with eight high-order zeros appended, are
placed in the supervisor-call interruption code that is
stored in the course of the interruption. The old
tained from location 96. The instruction is valid in
both the problem and supervisor states.
144
The code remains unchanged in the old
None
Test and Set
at the second-operand address is used to set the con
to all ones. Bits 8-15 of the instruction are ignored.
The byte in storage is set to all ones as it is
fetched for the testing of bit position
another
the moment of fetching and the moment of storing
all ones.
A serialization function is performed before the
byte is fetched and again after the storing of all
ones.
accesses by this
completed, as observed by channels and other
instructions or their operands are accessed by this
storage, as observed by channels and other
o Leftmost bit of byte specified is zero
1 Leftmost bit of byte specified is one
2 -
3 -
Program Exceptions:
Access (fetch and store, operand 2)
Programming Note
of a common storage area by more than one pro
gram. To accomplish this, bit position
must be designated as the control bit. The desired
interlock can be achieved by establishing a program
convention in which a zero in the bit position indi
cates that the common area is available but a one
means that the area is being used. Each using pro
gram then must examine this byte by means of
mon area. If the test sets condition code
is available for use; if it sets condition code 1, the