SUB: Difference between revisions

From NDWiki
Jump to navigation Jump to search
(SUB instruction)
 
m (fixing a typo,)
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
|Code=060 000
|Code=060 000
|Affected=A:=A-(ea), C, O, Q
|Affected=A:=A-(ea), C, O, Q
|Arcitecture=[[ND-100]], [[ND-110 CPU|ND-110]]
|Architecture=[[ND-100]], [[ND-110 CPU|ND-110]]
}}
}}


Line 11: Line 11:


== Flags affected ==
== Flags affected ==
The [[carry indicator]] ('''C''') is set to 1 if a [[Wikipedia:Carry (arithmetic)|carry occurs]] from the sign bit positions of the adder, otherwise the carry indicator is reset to 0. If the signs of the two operands are equal, but the sign of the result is different, overflow has occurred, and both the [[dynamic overflow indicator]] ('''O''') and the [[static overflow indicator]] ('''Q''') are set to one. If the condition for overflow does not exist, the dynamic overflow indicator is reset to 0, while the static overflow indicator is left unchanged.
The [[carry indicator]] ('''C''') is set to 1 if a [[Wikipedia:Carry (arithmetic)|carry occurs]] from the sign bit positions of the adder, otherwise the carry indicator is reset to 0. If the signs of the two operands are equal, but the sign of the result is different, overflow has occurred, and both the [[dynamic overflow indicator]] ('''Q''') and the [[static overflow indicator]] ('''O''') are set to one. If the condition for overflow does not exist, the dynamic overflow indicator is reset to 0, while the static overflow indicator is left unchanged.





Latest revision as of 17:22, 9 August 2009

SUB
Description Subtract from A register
Format SUB <addr. mode> <disp.>
Code 060 0008
Affected A:=A-(ea), C, O, Q
Type User
Architecture ND-100, ND-110

SUB is an assembly instruction. It subtracts the contents of the memory location pointed to by the effective address from the A register, leaving the result in the A register. The instruction is performed by forming the 2's complement of the 16-bit word in the effective address and add it to the content of the A register, so flags (see below) are affected exactly the same was as for the ADD instruction.

Flags affected

The carry indicator (C) is set to 1 if a carry occurs from the sign bit positions of the adder, otherwise the carry indicator is reset to 0. If the signs of the two operands are equal, but the sign of the result is different, overflow has occurred, and both the dynamic overflow indicator (Q) and the static overflow indicator (O) are set to one. If the condition for overflow does not exist, the dynamic overflow indicator is reset to 0, while the static overflow indicator is left unchanged.


References