Tuesday, August 13, 2013

SAP-2 Immediate Logic Instructions

          SAP-2 as well has immediate logic instructions. Here are the three logic immediates: ANI, ORI, and XRI.



ANI

       ANI means AND immediate. The execution of this instruction will AND the accumulator contents with the immediate byte that follows the op code.

Figure 2

       Example:


From Figure 2, the (a) accumulator content is ANDed with (b) the immediate value C7H and (c) the result is  86H which is stored in the accumulator.






ORI

       ORI means OR immediate. It tells the computer to OR the accumulator contents with the immediate byte that follows the op code.

       Example:


For instance, if the content of accumulator is given by Figure 2, the execution of ORI 8FH will OR (a) 96H with (b) the immediate byte 8FH to produce (c) new accumulator contents of 9FH.





XRI

       XRI is the mnemonic for XOR immediate. It will XOR the accumulator contents with the immediate byte that follows the op code.

       Example:


If the accumulator content is given by Figure 2, then executing XRI 1BH will XOR (a) 96H with the (b) immediate byte 1BH to produce (c) 8CH which will be stored in the accumulator.











Previous topic:

SAP-2 Logic Instructions





Reference:
Brown, J. A., & Malvino, A. P. (1992, 3rd edition). Digital Computer Electronics. Career Education, page 184.

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