100 likes | 292 Views
ECT 464 . Lecture 11 Math Instructions. Today’s Quote: The doors of opportunity are marked “Push” and “Pull.” The sluggard craves and gets nothing, but the desires of the diligent are fully satisfied. Proverbs 13:4. Arithmetic Status Bits.
E N D
ECT 464 Lecture 11 Math Instructions
Today’s Quote: The doors of opportunity are marked “Push” and “Pull.” The sluggard craves and gets nothing, but the desires of the diligent are fully satisfied. Proverbs 13:4
Arithmetic Status Bits • S:0/0 Carry (C) sets if carry is generated • S:0/1 Overflow (V) set if overflow • S:0/2 Zero (Z) indicates a resulting zero • S:0/3 Sign (S) indicates a resulting negative value • S:5/0 Overflow Trap Bit – Will set major error if not unlatched before END, TND, or REF statement • S:13 Least Significant Word of MUL and DDV instructions. Contains remainder for DIV and DDV instructions and the first four BCD digits for the convert from BCD (FRD) and convert to BCD (TOD) instructions. • S:14 Least Significant Word of MUL and DDV instructions. Contains unrounded quotient for DIV and DDV instructions and the most significant digit for TOD and FRD instructions
Add (ADD) • Adds source A to source B and stores the result in the destination. • Source A can be an address or a constant • Source B can be an address or a constant • Destination must be an address • Changes Carry, Overflow, Zero, and Sign bits
Subtract (SUB) • Subtract source B from source A and stores the result in the destination. • Source A can be an address or a constant • Source B can be an address or a constant • Destination must be an address • Changes Carry, Overflow, Zero, and Sign bits
Multiply (MUL) • Multiply source A by source B and stores the result in the destination. • Source A can be an address or a constant • Source B can be an address or a constant • Destination must be an address • Changes Carry, Overflow, Zero, and Sign bits • The result is also placed in S:14 and S:13 (Math Register)
Divide (DIV) • Divides source A by source B and stores the rounded quotient in the destination. • Source A can be an address or a constant • Source B can be an address or a constant • Destination must be an address • Changes Carry, Overflow, Zero, and Sign bits • The unrounded quotient is placed in S:14 and the remainder is placed in S:13 (Math Register)
Double Divide (DDV) • The 32 bit content of the math register is divided by the 16-bit source value and the rounded quotient is placed in the destination. • Source can be an address or a constant • Destination must be an address • Changes Carry, Overflow, Zero, and Sign bits • The unrounded quotient is placed in S:14 and the remainder is placed in S:13 (Math Register)
Clear (CLR) • The destination is set to zero. • Destination must be an address • Changes Carry, Overflow, Zero, and Sign bits
Square Root (SQR) • The square root of the absolute value of the source is calculated and the rounded result is placed in the destination. • Source must be an address • Destination must be an address • Changes Carry, Overflow, Zero, and Sign bits