Monday, August 12, 2013

SAP-2 Logic Instructions

        Logic instructions are digital computer instruction which forms a logical combination (on a bit-by-bit basis) of its operands and leaves the result in a known location.
 
      The following SAP-2 logic instructions are subset of the 8080/8085 instructions.


CMA  

       CMA stands for "complement the accumulator." It inverts each bit in the accumulator, producing the 1's complement.

        Example:

 


Suppose the accumulator contains C2H, and the execution of CMA results in A=3DH.







ANA

       ANA means to AND the accumulator contents with the designated register.  The result is stored in the accumulator, and the two available ANA instructions are ANA B and ANA C.

Figure 1

        Example:



Based on Figure 1, the contents of A and B registers are A7H and D2H, respectively. The execution of AND B will AND accumulator and B register to produce 82H.






ORA

       ORA means OR the accumulator contents with the designated register. The two ORA instructions are ORA B and ORA C.

        Example:

 


For instance, if the accumulator and C register contents are given by Figure 1, then executing ORA C gives A=BFH.






XRA

       XRA means XOR the accumulator contents with the designated register. The two XRA instructions in SAP-2 are XRA B and XRA C.

        Example:

 


If the accumulator and B register contents are given by Figure 1, then the execution of XRA B results in A=75H.












Next topic:



References:
Brown, J. A., & Malvino, A. P. (1992, 3rd edition). Digital Computer Electronics. Career Education, page 184.
http://encyclopedia2.thefreedictionary.com/logical+instruction

No comments:

Post a Comment