Saturday, August 14, 2010

Instruction Set Continued

CJNE - Compare and Jump if Not Equal
Description: The CJNE instruction compares the values of two operands, and jumps to relative address associated with the instruction. If the value of two operands are equal, the program execution continues to the next line of program.
Syntax: CJNE Source, Destination, Rel_Addr
Example:
Source: Accumulator or any register
Destination: Immediate value, direct value or any register


CJNE A, R0, LABEL
CJNE A, 60h, LABEL
CHNE R0, #12H, LABEL

CLR - Clear Register
Description: The CLR instruction clears the value of associated operand(a bit operand or a register) i.e sets to zero.
Syntax: CLR Register
Example:
CLR A
CLR C

CPL - Complement Register
Description: The CPL instruction complements the value of associated operand. If a bit operand is provided, the bit get toggled, if a register(Accumulator) is provided all the bits get reversed.
Syntax: CPL Operand
Example:
CPL A
CPL C
CPL bit_addr

DA - Decimal Adjust
Description: The DA instruction used to convert the value stored in accumulator to the binary coded decimal(BCD) format.
Syntax: DA Accumulator
Example:
DA A

DEC - Decrement Register
Description: The DEC instruction decrements the value of associated operands by 1. If the value of operands is zero, then the operand value is reset to FF(255) and then decremented further.
Syntax: DEC Operand
Example:
DEC A
DEC Rn
DEC @RAM

DIV - Divide Accumulator by B
Description: The DIV instruction divides the unsigned value in Accumulator by the unsigned value of Register B.
Syntax: DIV Accumulator, B
Example:
DIV A, B

DJNZ - Decrement Register and Jump if Not Zero
Description: The DJNZ instruction decrements the value of associated operands by 1. If the value of operands is not equal to zero, then jumps to the address indicated by the second operand.
Syntax: DJNZ Operand1, operand2
Example:
LABEL Some code......
      Some code......
      Some code......
      DLNZ R0, LABEL

No comments:

Post a Comment