11.07.2015 Views

section 7 - Index of

section 7 - Index of

section 7 - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SUB Subtract SUBOperation:O-S -4 D (parallel move)Assembler Syntax:SUB S,D (parallel move)Description: Subtract the source operand S from the destination operand 0 and storethe result in the destination operand O. Words (24 bits), long words (48 bits), and accumulators(56 bits) may be subtracted from the destination accumulator.Note: The carry bit is set correctly using word or long-word source operands if the extensionregister <strong>of</strong> the destination accumulator (A2 or B2) is the sign extension <strong>of</strong> bit 47 <strong>of</strong> thedestination accumulator (A or B). The carry bit is always set correctly using accumulatorsource operands.Example:SUB X1 ,A X:(R2)+N2,RO;24.;bit subtract, load RO, update R2Before ExecutionXi 1~ _________ $_OO_O_OO_3 __ ~A 1~ ___ $_OO_:O_OO_05_8_:24_2_42_4 __--'After ExecutionXii ~ _________ $_O_OO_OO_3 __ ~A~I ____ $_OO_:O_OO_05_5_:24_2_42_4 __ ~Explanation <strong>of</strong> Example: Prior to execution, the 24-bit X1 register contains the value$000003, and the 56-bit A accumulator contains the value $00:000058:242424. TheSUB instruction automatically appends the 24-bit value in the X1 register with 24 LSzeros, sign extends the resulting 48-bit long word to 56 bits, and subtracts the result fromthe 56-bit A accumulator. Thus, 24-bit operands are subtracted from the MSP portion <strong>of</strong>A or B (A 1 or B1) because all arithmetic instructions assume a fractional, twos complementdata representation. Note that 24-bit operands can be subtracted from the LSP portion<strong>of</strong> A or B (AO or BO) by loading the 24-bit operand into XO or YO, forming a 48-bitword by loading X1 or Y1 with the sign extension <strong>of</strong> XO or YO, and executing a SUB X,Aor SUB Y,A instruction.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!