{
    "id": "intel_8051_cheat_sheet",
    "name": "Intel 8051 Instruction Set",
    "description": "Basic instruction sets of 8051 MicroController",

    "metadata": {
        "sourceName": "Keil",
        "sourceUrl" : "http://www.keil.com/support/man/docs/is51/is51_instructions.htm"
    },

    "aliases": [
        "8051 instructions", "8051 opcode","8051"
    ],

    "template_type": "reference",

    "section_order": [
        "Instructions (A-D)",
        "Instructions (I-O)",
        "Instructions (P-X)"
        
    ],

    "sections": {
        "Instructions (A-D)": [
            {
                "key": "ACALL",
                "val": "Calls a subroutine located at the specified address (ACALL LABEL)"
            },
            {
                "key": "ADD",
                "val": "Adds a byte value to the accumulator and stores the results back in the accumulator (ADD A, @R1)"
            },
            {
                "key": "ADDC",
                "val": "Adds a byte value and the value of the carry flag to the accumulator (ADDC A, @R0)"
            },
            {
                "key": "AJMP",
                "val": "The AJMP instruction transfers program execution to the specified address (AJMP LABEL)"
            },
            {
                "key": "ANL",
                "val": "Performs a bitwise logical AND operation between the specified byte or bit operands and stores the result in the destination operand (ANL A, @R0)"
            },
            {
                "key": "CJNE",
                "val": "Compares the first two operands and branches to the specified destination if their values are not equal (CJNE @R1, #24H, LABEL)"
            },
            {
                "key": "CLR",
                "val": "Sets the specified destination operand to a value of 0 (CLR A)"
            },
            {
                "key": "CPL",
                "val": "The CPL instruction logically complements the value of the specified destination operand and stores the result back in the destination operand (CPL A)"
            },
            {
                "key": "DA",
                "val": "Adjusts the eight-bit value in the Accumulator resulting from the earlier addition of two variables (DA A)"
            },
            {
                "key": "DEC",
                "val": "The DEC instruction decrements the specified operand by 1 (DEC @R1)"
            },
            {
                "key": "DIV",
                "val": "Divides the unsigned 8-bit integer in the accumulator by the unsigned 8-bit integer in register B (DIV AB)"
            },
            {
                "key": "DJNZ",
                "val": "Decrements the byte indicated by the first operand and, if the resulting value is not zero, branches to the address specified in the second operand (DJNZ 40h, LABEL)"
            }
            ],
         "Instructions (I-O)" :[    
            {
                "key": "INC",
                "val": "Increments the specified operand by 1 (INC @R0)"
            },
            {
                "key": "JB",
                "val": "Branches to the address specified in the second operand if the value of the bit specified in the first operand is 1 (JB P1.2 LABEL)"
            },
            {
                "key": "JBC",
                "val": "Branches to the address specified in the second operand if the value of the bit specified in the first operand is 1 (JBC 44h)"
            },
            {
                "key": "JC",
                "val": "Branches to the specified address if the carry flag is set (JC LABEL)"
            },
            {
                "key": "JMP",
                "val": "Transfers execution to the address generated by adding the 8-bit value in the accumulator to the 16-bit value in the DPTR register (JMP @A+DPTR)"
            },
            {
                "key": "JNB",
                "val": "Branches to the specified address if the specified bit operand has a value of 0 (JNB P1.3, LABEL)"
            },
            {
                "key": "JNC",
                "val": "Transfers program control to the specified address if the carry flag is 0 (JNC LABEL)"
            },
            {
                "key": "JNZ",
                "val": "Transfers control to the specified address if the value in the accumulator is not 0 (JNZ LABEL)"
            },
            {
                "key": "JZ",
                "val": "Transfers control to the specified address if the value in the accumulator is 0 (JZ LABEL)"
            },
            {
                "key": "LCALL",
                "val": "Calls a subroutine located at the specified address (LCALL SUB1)"
            },
            {
                "key": "LJMP",
                "val": "Transfers program execution to the specified 16-bit address (LJMP LABEL)"
            },
            {
                "key": "MOV",
                "val": "Moves data bytes between the two specified operands (MOV @R0, #0)"
            },
            {
                "key": "MOVC",
                "val": "Moves a byte from the code or program memory to the accumulator (MOVC A, @A+DPTR)"
            },
             {
                "key": "MOVX",
                "val": "Transfers data between the accumulator and external data memory (MOVX @R0, A)"
            },
             {
                "key": "MUL",
                "val": "Multiplies the unsigned 8-bit integer in the accumulator and the unsigned 8-bit integer in the B register producing a 16-bit product (MUL AB)"
            },
            
             {
                "key": "NOP",
                "val": "Does no operation (NOP)"
            },
             {
                "key": "ORL",
                "val": "Performs a bitwise logical OR operation on the specified operands, the result of which is stored in the destination operand (ORL A, #01h)"
            }
            ],
        "Instructions (P-X)" : [   
            
             {
                "key": "POP",
                "val": "Reads a byte from the address indirectly referenced by the SP register (POP 34h)"
            },
            
             {
                "key": "PUSH",
                "val": "Increments the stack pointer and stores the value of the specified byte operand at the internal RAM address indirectly referenced by the stack pointer (PUSH A)"
            },
             {
                "key": "RET",
                "val": "Pops the high-order and low-order bytes of the PC from the stack (and decrements the stack pointer by 2) (RET)"
            },
             {
                "key": "RETI",
                "val": "Used to end an interrupt service routine (RETI)"
            },
             {
                "key": "RL",
                "val": "Rotates the eight bits in the accumulator left one bit position (RL A)"
            },
             {
                "key": "RLC",
                "val": "Rotates the eight bits in the accumulator and the one bit in the carry flag left one bit position (RLC A)"
            },
             {
                "key": "RR",
                "val": "Rotates the eight bits in the accumulator right one bit position (RR A)"
            },
             {
                "key": "RRC",
                "val": "Rotates the eight bits in the accumulator and the one bit in the carry flag right one bit position (RRC A)"
            },
             {
                "key": "SETB",
                "val": "Sets the bit operand to a value of 1 (SETB 63h)"
            },
             {
                "key": "SJMP",
                "val": "Transfers execution to the specified address (SJMP LABEL)"
            },
             {
                "key": "SUBB",
                "val": "Subtracts the specified byte variable and the carry flag from the accumulator (SUBB A, #01h)"
            },
             {
                "key": "SWAP",
                "val": "Exchanges the low-order and high-order nibbles within the accumulator (SWAP A)"
            },
             {
                "key": "XCH",
                "val": "Loads the accumulator with the byte value of the specified operand while simultaneously storing the previous contents of the accumulator in the specified operand (XCH A, @R0)"
            },
             {
                "key": "XCHD",
                "val": "Exchanges the low-order nibble of the accumulator with the low-order nibble of the specified internal RAM location (XCHD A, @R1)"
            },
             {
                "key": "XRL",
                "val": "Performs a logical exclusive OR operation between the specified operands (XRL A, #0FFh)"
            }
             
        ]
    }
}
