| ACALL addr11 | Absolute subroutine call (details) |
| Call subroutine at addr | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | |||||||||||||||||||||||||||
| ACALL | addr11 | 2 | 24 | Absolute Subroutine Call (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
ACALL unconditionally calls a subroutine located at the indicated address. The instruction increments the PC twice to obtain the address of the following instruction, then pushes the 16-bit result onto the stack (low-order byte first) and increments the Stack Pointer twice. The destination address is obtained by successively concatenating the five high-order bits of the incremented PC, opcode bits 7 through 5, and the second byte of the instruction. The subroutine called must therefore start within the same 2 K block of the program memory as the first byte of the instruction following ACALL. No flags are affected.
| ADD A,<src-byte> | Add Byte to Accumullator (details) |
| A = A + <byte> | |
| affected flags: C, OV, AC | |
| addresing modes: direct, indirect, register, constant |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||||||||||||
| ADD | A,Rn | 1 | 12 | Add register to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ADD | A,direct | 2 | 12 | Add direct byte to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ADD | A,@Ri | 1 | 12 | Add indirect RAM to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ADD | A,#data | 2 | 12 | Add immediate data to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
ADD adds the byte variable indicated to the Accumulator, leaving the result in the Accumulator. The carry and auxiliary-carry flags are set, respectively, if there is a carry-out from bit 7 or bit 3, and cleared otherwise. When adding unsigned integers, the carry flag indicates an overflow occurred. OV is set if there is a carry-out of bit 6 but not out of bit 7, or a carry-out of bit 7 but not bit 6; otherwise, OV is cleared. When adding signed integers, OV indicates a negative number produced as the sum of two positive operands, or a positive sum from two negative operands.
| ADDC A,<src-byte> | Add Byte to Accumullator with Carry flag (details) |
| A = A + <byte> + C | |
| affected flags: C, OV, AC | |
| addresing modes: direct, indirect, register, constant |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||||||||||||
| ADDC | A,Rn | 1 | 12 | Add register to Accumulator with Carry (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ADDC | A,direct | 2 | 12 | Add direct byte to Accumulator with Carry (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ADDC | A,@Ri | 1 | 12 | Add indirect RAM to Accumulator with Carry (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ADDC | A,#data | 2 | 12 | Add immediate data to Acc with Carry (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
ADDC simultaneously adds the byte variable indicated, the carry flag and the Accumulator contents, leaving the result in the Accumulator. The carry and auxiliary-carry flags are set respectively, if there is a carry-out from bit 7 or bit 3, and cleared otherwise. When adding unsigned integers, the carry flag indicates an overflow occurred. OV is set if there is a carry-out of bit 6 but not out of bit 7, or a carry-out of bit 7 but not out of bit 6; otherwise OV is cleared. When adding signed integers, OV indicates a negative number produced as the sum of two positive operands or a positive sum from two negative operands. Four source operand addressing modes are allowed: register, direct, register-indirect, or immediate.
| AJMP addr11 | Absolute Jump (details) |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | |||||||||||||||||||||||||||
| AJMP | addr11 | 2 | 24 | Absolute Jump (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
AJMP transfers program execution to the indicated address, which is formed at run-time by concatenating the high-order five bits of the PC (after incrementing the PC twice), opcode bits 7 through 5, and the second byte of the instruction. The destination must therfore be within the same 2 K block of program memory as the first byte of the instruction following AJMP.
| ANL <dest-byte>,<src-byte> | Logical AND for Byte variables (details) |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||||||||||||
| ANL | A,Rn | 1 | 12 | AND Register to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ANL | A,direct | 2 | 12 | AND direct byte to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ANL | A,@Ri | 1 | 12 | AND indirect RAM to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ANL | A,#data | 2 | 12 | AND immediate data to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ANL | direct,A | 2 | 12 | AND Accumulator to direct byte (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ANL | direct,#data | 3 | 24 | AND immediate data to direct byte (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
ANL performs the bitwise logical-AND operation between the variables indicated and stores the results in the destination variable. No flags are affected. The two operands allow six addressing mode combinations. When the destination is the Accumulator, the source can use register, direct, register-indirect, or immediate addressing; when the destination is a direct address, the source can be the Accumulator or immediate data. Note: When this instruction is used to modify an output port, the value used as the original port data will be read from the output data latch, not the input pins.
| ANL C,<src-bit> | Logical OR for Carry flag and Bit data (details) |
| C = C AND bit | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| ANL | C,bit | 2 | 24 | AND direct bit to CARRY (hex codes) | ||||||
| ||||||||||
| ANL | C,/bit | 2 | 24 | AND complement of direct bit to Carry (hex codes) | ||||||
| ||||||||||
If the Boolean value of the source bit is a logical 0, then ANL C clears the carry flag; otherwise, this instruction leaves the carry flag in its current state. A slash ( / ) preceding the operand in the assembly language indicates that the logical complement of the addressed bit is used as the source value, but the source bit itself is not affected. No other flags are affected. Only direct addressing is allowed for the source operand.
| CJNE <dest-byte>,<src-byte>, rel | Compare and jump if not equal (details) |
| Jump if <byte> <> #data | |
| affected flags: C | |
| addresing modes: indirect, register |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||||||||||||||||||||||||||||||
| CJNE | A,direct,rel | 3 | 24 | Compare direct byte to Acc and Jump if Not Equal (hex codes) | ||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||
| CJNE | A,#data,rel | 3 | 24 | Compare immediate to Acc and Jump if Not Equal (hex codes) | ||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||
| CJNE | Rn,#data,rel | 3 | 24 | Compare immediate to register and Jump if Not Equal (hex codes) | ||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||
| CJNE | @Ri,#data,rel | 3 | 24 | Compare immediate to indirect and Jump if Not Equal (hex codes) | ||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||
CJNE compares the magnitudes of the first two operands and branches if their values are not equal. The branch destination is computed by adding the signed relative-displacement in the last instruction byte to the PC, after incrementing the PC to the start of the next instruction. The carry flag is set if the unsigned integer value of <dest-byte> is less than the unsigned integer value of <src-byte>; otherwise, the carry is cleared. Neither operand is affected. The first two operands allow four addressing mode combinations: the Accumulator may be compared with any directly addressed byte or immediate data, and any indirect RAM location or working register can be compared with an immediate constant.
| CLR A | Clear Accumulator (details) |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| CLR | A | 1 | 12 | Clear Accumulator (hex codes) | ||||
| ||||||||
CLR A clears the Accumulator (all bits set to 0). No flags are affected
| CLR bit | Clear Bit data (details) |
| bit = 0 | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| CLR | C | 1 | 12 | Clear Carry (hex codes) | ||||||
| ||||||||||
| CLR | bit | 2 | 12 | Clear direct bit (hex codes) | ||||||
| ||||||||||
CLR bit clears the indicated bit (reset to 0). No other flags are affected. CLR can operate on the carry flag or any directly addressable bit.
| CPL A | Complement Accumulator (details) |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| CPL | A | 1 | 12 | Complement Accumulator (hex codes) | ||||
| ||||||||
CPLA logically complements each bit of the Accumulator (one’s complement). Bits which previously contained a 1 are changed to a 0 and vice-versa. No flags are affected.
| CPL bit | Complement Bit data (details) |
| bit = NOT bit | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| CPL | C | 1 | 12 | Complement Carry (hex codes) | ||||||
| ||||||||||
| CPL | bit | 2 | 12 | Complement direct bit (hex codes) | ||||||
| ||||||||||
CPL bit complements the bit variable specified. A bit that had been a 1 is changed to 0 and vice-versa. No other flags are affected. CLR can operate on the carry or any directly addressable bit. Note: When this instruction is used to modify an output pin, the value used as the original data is read from the output data latch, not the input pin.
| DA A | Decimal adjust Accumulator for Addition (details) |
| Decimal Adjust | |
| affected flags: C | |
| note: Accumulator only |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| DA | A | 1 | 12 | Decimal Adjust Accumulator (hex codes) | ||||
| ||||||||
DA A adjusts the eight-bit value in the Accumulator resulting from the earlier addition of two variables (each in packed-BCD format), producing two four-bit digits. Any ADD or ADDC instruction may have been used to perform the addition. If Accumulator bits 3 through 0 are greater than nine (xxxx1010-xxxx1111), or if the AC flag is one, six is added to the Accumulator producing the proper BCD digit in the low-order nibble. This internal addition sets the carry flag if a carry-out of the low-order four-bit field propagates through all high-order bits, but it does not clear the carry flag otherwise. If the carry flag is now set, or if the four high-order bits now exceed nine (1010xxxx-1111xxxx), these high-order bits are incremented by six, producing the proper BCD digit in the high-order nibble. Again, this sets the carry flag if there is a carry-out of the high-order bits, but does not clear the carry. The carry flag thus indicates if the sum of the original two BCD variables is greater than 100, allowing multiple precision decimal addition. OV is not affected. All of this occurs during the one instruction cycle. Essentially, this instruction performs the decimal conversion by adding 00H, 06H, 60H, or 66H to the Accumulator, depending on initial Accumulator and PSW conditions. Note: DA A cannot simply convert a hexadecimal number in the Accumulator to BCD notation, nor does DAA apply to decimal subtraction.
| DEC byte | Decrement Byte variable (details) |
| <byte> = <byte> – 1 | |
| affected flags: C, OV, AC | |
| addresing modes: direct, indirect, register |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||||||||||||
| DEC | A | 1 | 12 | Decrement Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| DEC | Rn | 1 | 12 | Decrement Register (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| DEC | direct | 2 | 12 | Decrement direct byte (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| DEC | @Ri | 1 | 12 | Decrement indirect RAM (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
DEC byte decrements the variable indicated by 1. An original value of 00H underflows to 0FFH. No flags are affected. Four operand addressing modes are allowed: accumulator, register, direct, or register-indirect. Note: When this instruction is used to modify an output port, the value used as the original port data will be read from the output data latch, not the input pins.
| DIV AB | Divide Accumulator by B register (details) |
| A = Int [A/B]; B = Mod [A/B] | |
| affected flags: OV | |
| note: ACC and B only |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| DIV | AB | 1 | 48 | Divide A by B (hex codes) | ||||
| ||||||||
DIV AB divides the unsigned eight-bit integer in the Accumulator by the unsigned eight-bit integer in register B. The Accumulator receives the integer part of the quotient; register B receives the integer remainder. The carry and OV flags are cleared. Exception: if B had originally contained 00H, the values returned in the Accumulator and B-register are undefined and the overflow flag are set. The carry flag is cleared in any case.
| DJNZ <byte>,<rel-addr> | Decrement and Jump if Not Zero (details) |
| Decrement and jump if not zero | |
| affected flags: C, OV, AC | |
| addresing modes: direct, register |
| Mnemonic | Operands | Bytes | Periods | Description | |||||||||||||||||||||||||||
| DJNZ | Rn,rel | 2 | 24 | Decrement register and Jump if Not Zero (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| DJNZ | direct,rel | 3 | 24 | Decrement direct byte and Jump if Not Zero (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
DJNZ decrements the location indicated by 1, and branches to the address indicated by the second operand if the resulting value is not zero. An original value of 00H underflows to 0FFH. No flags are affected. The branch destination is computed by adding the signed relative-displacement value in the last instruction byte to the PC, after incrementing the PC to the first byte of the following instruction. The location decremented may be a register or directly addressed byte. Note: When this instruction is used to modify an output port, the value used as the original port data will be read from the output data latch, not the input pins.
| INC <byte> | Increment Byte variable (details) |
| <byte> = <byte> + 1 | |
| affected flags: C, OV, AC | |
| addresing modes: direct, indirect, register |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||||||||||||
| INC | A | 1 | 12 | Increment Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| INC | Rn | 1 | 12 | Increment register (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| INC | direct | 2 | 12 | Increment direct byte (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| INC | @Ri | 1 | 12 | Increment direct RAM (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
INC increments the indicated variable by 1. An original value of 0FFH overflows to 00H. No flags are affected. Three addressing modes are allowed: register, direct, or register-indirect. Note: When this instruction is used to modify an output port, the value used as the original port data will be read from the output data latch, not the input pins.
| INC DPTR | Increment Data Pointer (details) |
| DPTR = DPTR + 1 | |
| affected flags: C, OV, AC | |
| note: Data Pointer only |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| INC | DPTR | 1 | 24 | Increment Data Pointer (hex codes) | ||||
| ||||||||
INC DPTR increments the 16-bit data pointer by 1. A 16-bit increment (modulo 216) is performed, and an overflow of the low-order byte of the data pointer (DPL) from 0FFH to 00H increments the high-order byte (DPH). No flags are affected. This is the only 16-bit register which can be incremented.
| JB blt,rel | Jump if Bit is set (details) |
| Jump if bit = 1 | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||
| JB | bit,rel | 3 | 24 | Jump if direct Bit is set (hex codes) | ||||||||
| ||||||||||||
If the indicated bit is a one, JB jump to the address indicated; otherwise, it proceeds with the next instruction. The branch destination is computed by adding the signed relative-displacement in the third instruction byte to the PC, after incrementing the PC to the first byte of the next instruction. The bit tested is not modified. No flags are affected.
| JBC bit,rel | Jump if Bit is set and Clear Bit (details) |
| Jump if bit = 1; bit = 0 | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||
| JBC | bit,rel | 3 | 24 | Jump if direct Bit is set & clear bit (hex codes) | ||||||||
| ||||||||||||
If the indicated bit is one, JBC branches to the address indicated; otherwise, it proceeds with the next instruction. The bit will not be cleared if it is already a zero. The branch destination is computed by adding the signed relative-displacement in the third instruction byte to the PC, after incrementing the PC to the first byte of the next instruction. No flags are affected. Note: When this instruction is used to test an output pin, the value used as the original data will be read from the output data latch, not the input pin.
| JC rel | Jump if Carry flag is set (details) |
| Jump if C = 1 | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| JC | rel | 2 | 24 | Jump if Carry is set (hex codes) | ||||||
| ||||||||||
If the carry flag is set, JC branches to the address indicated; otherwise, it proceeds with the next instruction. The branch destination is computed by adding the signed relative-displacement in the second instruction byte to the PC, after incrementing the PC twice. No flags are affected.
| JMP @A+DPTR | Jump indirect relative to the DPTR (details) |
| Jump to A + DPTR | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| JMP | @A+DPTR | 1 | 24 | Jump indirect relative to the DPTR (hex codes) | ||||
| ||||||||
JMP @A+DPTR adds the eight-bit unsigned contents of the Accumulator with the 16-bit data pointer and loads the resulting sum to the program counter. This is the address for subsequent instruction fetches. Sixteen-bit addition is performed (modulo 216): a carry-out from the low-order eight bits propagates through the higher-order bits. Neither the Accumulator nor the Data Pointer is altered. No flags are affected.
| JNB bit,rel | Jump if Bit is not set (details) |
| Jump if bit = 0 | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||
| JNB | bit,rel | 3 | 24 | Jump if direct Bit is Not set (hex codes) | ||||||||
| ||||||||||||
If the indicated bit is a 0, JNB branches to the indicated address; otherwise, it proceeds with the next instruction. The branch destination is computed by adding the signed relative-displacement in the third instruction byte to the PC, after incrementing the PC to the first byte of the next instruction. The bit tested is not modified. No flags are affected.
| JNC rel | Jump if Carry flag is not set (details) |
| Jump if C = 0 | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| JNC | rel | 2 | 24 | Jump if Carry not set (hex codes) | ||||||
| ||||||||||
If the carry flag is a 0, JNC branches to the address indicated; otherwise, it proceeds with the next instruction. The branch destination is computed by adding the signal relative-displacement in the second instruction byte to the PC, after incrementing the PC twice to point to the next instruction. The carry flag is not modified.
| JNZ rel | Jump if Accumulator is not zero (details) |
| Jump if A <> 0 | |
| affected flags: C, OV, AC | |
| note: Accumulator only |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| JNZ | rel | 2 | 24 | Jump if Accumulator is Not Zero (hex codes) | ||||||
| ||||||||||
If any bit of the Accumulator is a one, JNZ branches to the indicated address; otherwise, it proceeds with the next instruction. The branch destination is computed by adding the signed relative-displacement in the second instruction byte to the PC, after incrementing the PC twice. The Accumulator is not modified. No flags are affected.
| JZ rel | Jump if Accumulator is zero (details) |
| Jump if A = 0 | |
| affected flags: C, OV, AC | |
| note: Accumulator only |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| JZ | rel | 2 | 24 | Jump if Accumulator is Zero (hex codes) | ||||||
| ||||||||||
If all bits of the Accumulator are 0, JZ branches to the address indicated; otherwise, it proceeds with the next instruction. The branch destination is computed by adding the signed relative-displacement in the second instruction byte to the PC, after incrementing the PC twice. The Accumulator is not modified. No flags are affected.
| LCALL addr16 | Long subroutine call (details) |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||
| LCALL | addr16 | 3 | 24 | Long Subroutine Call (hex codes) | ||||||||
| ||||||||||||
LCALL calls a subroutine located at the indicated address. The instruction adds three to the program counter to generate the address of the next instruction and then pushes the 16-bit result onto the stack (low byte first), incrementing the Stack Pointer by two. The high-order and low-order bytes of the PC are then loaded, respectively, with the second and third bytes of the LCALL instruction. Program execution continues with the instruction at this address. The subroutine may therefore begin anywhere in the full 64K byte program memory address space. No flags are affected.
| LJMP addr16 | Long jump (details) |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||
| LJMP | addr16 | 3 | 24 | Long Jump (hex codes) | ||||||||
| ||||||||||||
LJMP causes an unconditional branch to the indicated address, by loading the high-order and low-order bytes of the PC (respectively) with the second and third instruction bytes. The destination may therefore be anywhere in the full 64K program memory address space. No flags are affected.
| MOV <dest-byte>,<src-byte> | Move Byte variable (details) |
| <dest> = <src> | |
| affected flags: C, OV, AC | |
| addresing modes: direct, indirect, register, constant |
| Mnemonic | Operands | Bytes | Periods | Description | |||||||||||||||||||||||||||
| MOV | A,Rn | 1 | 12 | Move register to Accumulator (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| MOV | A,direct | 2 | 12 | Move direct byte to Accumulator (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| MOV | A,@Ri | 1 | 12 | Move indirect RAM to Accumulator (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| MOV | A,#data | 2 | 12 | Move immediate data to Accumulator (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| MOV | Rn,A | 1 | 12 | Move Accumulator to register (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| MOV | Rn,direct | 2 | 24 | Move direct byte to register (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| MOV | Rn,#data | 2 | 12 | Move immediate data to register (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| MOV | direct,A | 2 | 12 | Move Accumulator to direct byte (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| MOV | direct,Rn | 2 | 24 | Move register to direct byte (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| MOV | direct,direct | 3 | 24 | Move direct byte to direct (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| MOV | direct,@Ri | 2 | 24 | Move indirect RAM to direct byte (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| MOV | direct,#data | 3 | 24 | Move immediate data to direct byte (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| MOV | @Ri,A | 1 | 12 | Move Accumulator to indirect RAM (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| MOV | @Ri,direct | 2 | 24 | Move direct byte to indirect RAM (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
| MOV | @Ri,#data | 2 | 12 | Move immediate data to indirect RAM (hex codes) | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
The byte variable indicated by the second operand is copied into the location specified by the first operand. The source byte is not affected. No other register or flag is affected. This is by far the most flexible operation. Fifteen combinations of source and destination addressing modes are allowed.
| MOV <dest-bit>,<src-bit> | Move Bit data (details) |
| <dest-bit> = <src-bit> | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| MOV | C,bit | 2 | 12 | Move direct bit to Carry (hex codes) | ||||||
| ||||||||||
| MOV | bit,C | 2 | 24 | Move Carry to direct bit (hex codes) | ||||||
| ||||||||||
MOV <dest-bit>,<src-bit> copies the Boolean variable indicated by the second operand into the location specified by the first operand. One of the operands must be the carry flag; the other may be any directly addressable bit. No other register or flag is affected.
| MOV DPTR,#data16 | Load Data Pointer with a 16-bit constant (details) |
| DPTR = 16-bit immediate constant | |
| affected flags: C, OV, AC | |
| addresing modes: constant |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||
| MOV | DPTR,#data16 | 3 | 24 | Load Data Pointer with a 16-bit constant (hex codes) | ||||||||
| ||||||||||||
MOV DPTR,#data16 loads the Data Pointer with the 16-bit constant indicated. The 16-bit constant is loaded into the second and third bytes of the instruction. The second byte (DPH) is the high-order byte, while the third byte (DPL) holds the lower-order byte. No flags are affected. This is the only instruction which moves 16 bits of data at once.
| MOVC A,@A+ <base-reg> | Move Code byte relative to Accumulator + Register (details) |
| Read Pgm Memory at (A + DPTR), Read Pgm Memory at (A + PC) | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| MOVC | A,@A+DPTR | 1 | 24 | Move Code byte relative to DPTR to Acc (hex codes) | ||||
| ||||||||
| MOVC | A,@A+PC | 1 | 24 | Move Code byte relative to PC to Acc (hex codes) | ||||
| ||||||||
The MOVC instructions load the Accumulator with a code byte or constant from program memory. The address of the byte fetched is the sum of the original unsigned 8-bit Accumulator contents and the contents of a 16-bit base register, which may be either the Data Pointer or the PC. In the latter case, the PC is incremented to the address of the following instruction before being added with the Accumulator; otherwise the base register is not altered. Sixteen-bit addition is performed so a carry-out from the low-order eight bits may propagate through higher-order bits. No flags are affected.
| MOVX <dest-byte>,<src-byte> | Move external byte variable (details) |
| Read?Write external RAM @Ri | |
| affected flags: C, OV, AC | |
| note: Ri, DPTR |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| MOVX | A,@Ri | 1 | 24 | Move External RAM (8- bit addr) to Acc (hex codes) | ||||||
| ||||||||||
| MOVX | A,@DPTR | 1 | 24 | Move Exernal RAM (16- bit addr) to Acc (hex codes) | ||||||
| ||||||||||
| MOVX | @Ri,A | 1 | 24 | Move Acc to External RAM (8-bit addr) (hex codes) | ||||||
| ||||||||||
| MOVX | @DPTR,A | 1 | 24 | Move Acc to External RAM (16-bit addr) (hex codes) | ||||||
| ||||||||||
The MOVX instructions transfer data between the Accumulator and a byte of external data memory, which is why “X” is appended to MOV. There are two types of instructions, differing in whether they provide an 8-bit or 16-bit indirect address to the external data RAM. In the first type, the contents of R0 or R1 in the current register bank provide an 8-bit address multiplexed with data on P0. Eight bits are sufficient for external I/O expansion decoding or for a relatively small RAM array. For somewhat larger arrays, any output port pins can be used to output higher-order address bits. These pins are controlled by an output instruction preceding the MOVX. In the second type of MOVX instruction, the Data Pointer generates a 16-bit address. P2 outputs the high-order eight address bits (the contents of DPH), while P0 multiplexes the low-order eight bits (DPL) with data. The P2 Special Function Register retains its previous contents, while the P2 output buffers emit the contents of DPH. This form of MOVX is faster and more efficient when accessing very large data arrays (up to 64K bytes), since no additional instructions are needed to set up the output ports. It is possible to use both MOVX types in some situations. A large RAM array with its high-order address lines driven by P2 can be addressed via the Data Pointer, or with code to output high-order address bits to P2, followed by a MOVX instruction using R0 or R1.
| MUL AB | Multiply Accumulator and B register (details) |
| B:A = B × A | |
| affected flags: OV | |
| note: ACC and B only |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| MUL | AB | 1 | 48 | Multiply A & B (hex codes) | ||||
| ||||||||
MUL AB multiplies the unsigned 8-bit integers in the Accumulator and register B. The low-order byte of the 16-bit product is left in the Accumulator, and the high-order byte in B. If the product is greater than 255 (0FFH), the overflow flag is set; otherwise it is cleared. The carry flag is always cleared.
| NOP | No operation (details) |
| No operation | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| NOP | 1 | 12 | No Operation (hex codes) | |||||
| ||||||||
Execution continues at the following instruction. Other than the PC, no registers or flags are affected.
| ORL <dest-byte>,<src-byte> | Logical OR for byte variables (details) |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||||||||||||
| ORL | A,Rn | 1 | 12 | OR register to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ORL | A,direct | 2 | 12 | OR direct byte to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ORL | A,@Ri | 1 | 12 | OR indirect RAM to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ORL | A,#data | 2 | 12 | OR immediate data to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ORL | direct,A | 2 | 12 | OR Accumulator to direct byte (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| ORL | direct,#data | 3 | 24 | OR immediate data to direct byte (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
ORL performs the bitwise logical-OR operation between the indicated variables, storing the results in the destination byte. No flags are affected. The two operands allow six addressing mode combinations. When the destination is the Accumulator, the source can use register, direct, register-indirect, or immediate addressing; when the destination is a direct address, the source can be the Accumulator or immediate data. Note: When this instruction is used to modify an output port, the value used as the original port data is read from the output data latch, not the input pins.
| ORL C,<src-bit> | Logical OR for Carry bit and Bit variable (details) |
| C = C OR bit | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| ORL | C,bit | 2 | 24 | OR direct bit to Carry (hex codes) | ||||||
| ||||||||||
| ORL | C,/bit | 2 | 24 | OR complement of direct bit to Carry (hex codes) | ||||||
| ||||||||||
Set the carry flag if the Boolean value is a logical 1; leave the carry in its current state otherwise. A slash ( / ) preceding the operand in the assembly language indicates that the logical complement of the addressed bit is used as the source value, but the source bit itself is not affected. No other flags are affected.
| POP direct | Pop Byte from stack (details) |
| MOV <dest>, “@SP”; DEC SP | |
| affected flags: C, OV, AC | |
| addresing modes: direct |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| POP | direct | 2 | 24 | Pop direct byte from stack (hex codes) | ||||||
| ||||||||||
The contents of the internal RAM location addressed by the Stack Pointer is read, and the Stack Pointer is decremented by one. The value read is then transferred to the directly addressed byte indicated. No flags are affected.
| PUSH direct | Push Byte into stack (details) |
| INC SP; MOV “@SP”, <scr> | |
| affected flags: C, OV, AC | |
| addresing modes: direct |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| PUSH | direct | 2 | 24 | Push direct byte into stack (hex codes) | ||||||
| ||||||||||
The Stack Pointer is incremented by one. The contents of the indicated variable is then copied into the internal RAM location addressed by the Stack Pointer. Otherwise no flags are affected.
| RET | Return from subroutine (details) |
| Return from subroutine | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| RET | 1 | 24 | Return from Subroutine (hex codes) | |||||
| ||||||||
RET pops the high- and low-order bytes of the PC successively from the stack, decrementing the Stack Pointer by two. Program execution continues at the resulting address, generally the instruction immediately following an ACALL or LCALL. No flags are affected.
| RETI | Return from interrupt (details) |
| Return from interrupt | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| RETI | 1 | 24 | Return from interrupt (hex codes) | |||||
| ||||||||
RETI pops the high- and low-order bytes of the PC successively from the stack and restores the interrupt logic to accept additional interrupts at the same priority level as the one just processed. The Stack Pointer is left decremented by two. No other registers are affected; the PSW is not automatically restored to its pre-interrupt status. Program execution continues at the resulting address, which is generally the instruction immediately after the point at which the interrupt request was detected. If a lower- or same-level interrupt was pending when the RETI instruction is executed, that one instruction is executed before the pending interrupt is processed.
| RL A | Rotate Accumulator Left (details) |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| RL | A | 1 | 12 | Rotate Accumulator Left (hex codes) | ||||
| ||||||||
The eight bits in the Accumulator are rotated one bit to the left. Bit 7 is rotated into the bit 0 position. No flags are affected.
| RLC A | Rotate Accumulator Left through the Carry flag (details) |
| affected flags: C |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| RLC | A | 1 | 12 | Rotate Accumulator Left through the Carry (hex codes) | ||||
| ||||||||
The eight bits in the Accumulator and the carry flag are together rotated one bit to the left. Bit 7 moves into the carry flag; the original state of the carry flag moves into the bit 0 position. No other flags are affected.
| RR A | Rotate Accumulator Right (details) |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| RR | A | 1 | 12 | Rotate Accumulator Right (hex codes) | ||||
| ||||||||
The eight bits in the Accumulator are rotated one bit to the right. Bit 0 is rotated into the bit 7 position. No flags are affected.
| RRC A | Rotate Accumulator Right through Carry flag (details) |
| affected flags: C |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| RRC | A | 1 | 12 | Rotate Accumulator Right through the Carry (hex codes) | ||||
| ||||||||
The eight bits in the Accumulator and the carry flag are together rotated one bit to the right. Bit 0 moves into the carry flag; the original value of the carry flag moves into the bit 7 position. No other flags are affected.
| SETB <bit> | Set Bit data (details) |
| bit = 1 | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| SETB | C | 1 | 12 | Set Carry (hex codes) | ||||||
| ||||||||||
| SETB | bit | 2 | 12 | Set direct bit (hex codes) | ||||||
| ||||||||||
SETB sets the indicated bit to one. SETB can operate on the carry flag or any directly addressable bit. No other flags are affected.
| SJMP rel | Short jump (details) |
| Jump to addr | |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| SJMP | rel | 2 | 24 | Short Jump (relative addr) (hex codes) | ||||||
| ||||||||||
Program control branches unconditionally to the address indicated. The branch destination is computed by adding the signed displacement in the second instruction byte to the PC, after incrementing the PC twice. Therefore, the range of destinations allowed is from 128 bytes preceding this instruction 127 bytes following it.
| SUBB A,<src-byte> | Subtract Byte with Carry from Accumullator (details) |
| A = A – <byte> – C | |
| affected flags: C, OV, AC | |
| addresing modes: direct, indirect, register, constant |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||||||||||||
| SUBB | A,Rn | 1 | 12 | Subtract Register from Acc with borrow (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| SUBB | A,direct | 2 | 12 | Subtract direct byte from Acc with borrow (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| SUBB | A,@Ri | 1 | 12 | Subtract indirect RAM from ACC with borrow (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| SUBB | A,#data | 2 | 12 | Subtract immediate data from Acc with borrow (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
SUBB subtracts the indicated variable and the carry flag together from the Accumulator, leaving the result in the Accumulator. SUBB sets the carry (borrow) flag if a borrow is needed for bit 7 and clears C otherwise. (If C was set before executing a SUBB instruction, this indicates that a borrow was needed for the previous step in a multiple-precision subtraction, so the carry is subtracted from the Accumulator along with the source operand.) AC is set if a borrow is needed for bit 3 and cleared otherwise. OV is set if a borrow is needed into bit 6, but not into bit 7, or into bit 7, but not bit 6. When subtracting signed integers, OV indicates a negative number produced when a negative value is subtracted from a positive value, or a positive result when a positive number is subtracted from a negative number. The source operand allows four addressing modes: register, direct, register-indirect, or immediate.
| SWAP A | Swap nibbles within the Accumulator (details) |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||
| SWAP | A | 1 | 12 | Swap nibbles within the Accumulator (hex codes) | ||||
| ||||||||
SWAP A interchanges the low- and high-order nibbles (four-bit fields) of the Accumulator (bits 3 through 0 and bits 7 through 4). The operation can also be thought of as a 4-bit rotate instruction. No flags are affected.
| XCH A,<byte> | Exchange Accumulator with byte variable (details) |
| ACC and <byte> Exchange Data | |
| affected flags: C, OV, AC | |
| addresing modes: direct, indirect, register |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||||||||||||
| XCH | A,Rn | 1 | 12 | Exchange register with Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| XCH | A,direct | 2 | 12 | Exchange direct byte with Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| XCH | A,@Ri | 1 | 12 | Exchange indirect RAM with Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
XCH loads the Accumulator with the contents of the indicated variable, at the same time writing the original Accumulator contents to the indicated variable. The source/destination operand can use register, direct, or register-indirect addressing.
| XCHD A,@Ri | Exchange Byte with Accumulator (details) |
| ACC and @ Ri exchange low nibbles | |
| affected flags: C, OV, AC | |
| addresing modes: indirect |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||
| XCHD | A,@Ri | 1 | 12 | Exchange low-order Digit indirect RAM with Acc (hex codes) | ||||||
| ||||||||||
XCHD exchanges the low-order nibble of the Accumulator (bits 3 through 0), generally representing a hexadecimal or BCD digit, with that of the internal RAM location indirectly addressed by the specified register. The high-order nibbles (bits 7-4) of each register are not affected. No flags are affected.
| XRL <dest-byte>,<src-byte> | Logical Exclusive OR for Byte variables (details) |
| affected flags: C, OV, AC |
| Mnemonic | Operands | Bytes | Periods | Description | ||||||||||||||||||
| XRL | A,Rn | 1 | 12 | Exclusive-OR register to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| XRL | A,direct | 2 | 12 | Exclusive-OR direct byte to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| XRL | A,@Ri | 1 | 12 | Exclusive-OR indirect RAM to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| XRL | A,#data | 2 | 12 | Exclusive-OR immediate data to Accumulator (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| XRL | direct,A | 2 | 12 | Exclusive-OR Accumulator to direct byte (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
| XRL | direct,#data | 3 | 24 | Exclusive-OR immediate data to direct byte (hex codes) | ||||||||||||||||||
| ||||||||||||||||||||||
XRL performs the bitwise logical Exclusive-OR operation between the indicated variables, storing the results in the destination. No flags are affected. The two operands allow six addressing mode combinations. When the destination is the Accumulator, the source can use register, direct, register-indirect, or immediate addressing; when the destination is a direct address, the source can be the Accumulator or immediate data. Note: When this instruction is used to modify an output port, the value used as the original port data is read from the output data latch, not the input pins.