Summary of 8080 Instructions

From Higher Intellect Wiki
Jump to: navigation, search


Summary of 8080 Instructions
------- -- ---- ------------

Abbreviations used in this Summary:

      R       Any of the 8-Bit registers A,B,C,D,E,H,L.
      data    Any 8-bit or 16-bit value.
      PC      Program Counter.
      SP      Stack Pointer.
      RM      Register A,B,C,D,E,H,L or memory M pointed by HL.
      BD      Either register pair BC or DE  (B=BC, D=DE).
      BP      Any byte pair symbol (B=BC, D=DE, H=HL, PSW=AF).
      RP      Any register pair (B=BC, D=DE, H=HL, SP=SP).
      Addr    A 16-Byte address.

8-Bit Transfers

MOV   RM1,RM2     Moves data from one register to another.
MVI   RM,data     Puts 8 bits into register, or memory.
LDA   Addr        Puts 8 bits at location Addr into A Register.
STA   Addr        Stores 8 bits at location Addr.
LDAX  BD          Loads A register with 8 bits from location in BC or DE.
STAX  BD          Stores A register at location in BC or DE.

16-Bit Transfers

LHLD  Addr        Loads HL register with 16 bits found at Addr and Addr+1.
SHLD  Addr        Stores HL register contents at Addr and Addr+1.
LXI   RP,data     Loads 16 bits into B,D,H, or SP.
PUSH  BP          Puts 16 bits of BP onto stack. SP=SP-2.
POP   BP          Takes top of stack, puts it in BP. SP=SP+2.
XTHL              Exchanges HL with top of stack.
SPHL              Puts contents of HL into SP (stack pointer).
PCHL              Puts contents of HL into PC (program counter) [=JMP (HL].
XCHG              Exchanges HL and DE.

8-Bit Arithmetic

ADD   RM          Adds contents of register R to A register.
SUB   RM          Subtracts contents of register R from A register.
INR   RM          Increments register R by one.  R=R+1.
DCR   RM          Decrements register R by one.  R=R-1.
CMP   RM          Compares contents of R with A register.
ANA   RM          Logically ANDs contents of R with A register.
ORA   RM          Logically ORs contents of R with A register.
XRA   RM          Exclusive-OR contents of R with A register.

ADI   data        Adds 8 bit data to contents of A register.
SUI   data        Subtracts 8 bit data from contents of A register.
CPI   data        Compares 8 bit data with contents of A register.
ANI   data        Logically ORs 8 bit data with contents of A register.
ORI   data        Logically ORs 8 bit data with contents of A register.
XRI   data        Exclusive-OR 8 bit data with A register.

DAA               Convert A register to packed Binary Coded Decimal.
ADC   RM          Add with carry.
ACI   data        Add with carry immediate.
SBB   RM          Subtract with borrow.
SBI   data        Subtract with borrow immediate.

16-Bit Arithmetic

DAD   RP          Adds contents of register RP to contents of HL register.
INX   RP          Increments register RP.
DCX   RP          Decrements register RP.

Jumps, Calls, and Returns

JMP   Addr        Unconditional Jump to location Addr.
CALL  Addr        Unconditional Subroutine call to location Addr.
RET               Unconditional return from subroutine.

       Conditional variations

       Flag condition          Jump         Call         Return
       --------------          ------       ------       ------
        Nonzero                JNZ          CNZ          RNZ
        Zero                   JZ           CZ           RZ
        No Carry               JNC          CNC          RNC
        Carry                  JC           CC           RC
        Parity Odd             JPO          CPO          RPO
        Parity Even            JPE          CPE          RPE
        Plus                   JP           CP           RP
        Minus                  JM           CM           RM

Rotations

RAL               Rotate Accumulator Left:  Bit0=C  C=Bit7.
RAR               Rotate Accumulator Right:  Bit7=C  C=Bit0.
RLC               Rotate Accumulator Left thru Carry:  Bit0=Bit7  C=Bit7.
RRC               Rotate Accumulator Right thru Carry:  Bit7=Bit0  C=Bit0.

Other Instructions

IN    Port        Data from Port placed in A register.
OUT   Port        Data from A register placed in Port.

CMC               Complement Carry Flag.
STC               Set Carry Flag = 1.
CMA               Complement A register.

HLT               Halt CPU and wait for interrupt.
NOP               No operation.

DI                Disable Interrupts.
EI                Enable Interrupts.

RST 0             Call 0000H.
RST 1             Call 0008H.
RST 2             Call 0010H.
RST 3             Call 0018H.
RST 4             Call 0020H.
RST 5             Call 0028H.
RST 6             Call 0030H.
RST 7             Call 0038H.

Assembler Directives

ORG   Addr        Begin Assembly at Addr.
END               Causes Assembly to End.
EQU   Addr        Define symbolic label.  A label name must precede EQU.
                  (For example, BDOS EQU 05H.)
SET   Exp         Set numeric constant.
IF    Exp         Conditional Assembly, if Exp<>0.
ENDIF             End of Conditional Assembly.
DB    List        Define Bytes. May be Hex, ASCII, etc.
DW    List        Define Words. May be Hex, ASCII, etc.
DS    Exp         Define Storage of length Exp.
��


Share your opinion