daftar instruksi data 8085
Post on 29-Mar-2015
307 Views
Preview:
TRANSCRIPT
DAFTAR INSTRUKSI DATA 8085
DETAIL INSTRUKSI
DATA TRANSFER INSTRUCTIONS
OPCODE OPERAND KETERANGANSalin dari sumber ke tujuan
MOV Rd, RsM, RsRd, M
Instruksi ini menyalinisi dari register sumber ke register tujuan; isi register sumber tidak diubah. Jika salah satu operan adalah lokasi memori, lokasi adalah ditentukan oleh isi di HL register.Contoh: MOV B, C or MOV B, M
Move immediate 8-bitMIV Rd, data
M, dataData8-bit tersimpan di register tujuan atau memory.jika operand adalah lokasi memori, lokasi adalah ditentukan oleh isi di HL register.Contoh: MVI B, 57 or MVI M, 57
Load accumulatorLDA 16-bit address Isi lokasi memori, yang ditentukan oleh
Alamat 16-bit operan, disalin ke akumulator.Isi dari sumber yang tidak berubah.Contoh: LDA 2034 or LDA XYZ
Load accumulator indirectLDAX B/D Reg. pair Isi dari titik yang ditunjuk register pair untuk
lokasi memori. instruksi mengkopi isi dari memori ke akumulator. Isi dari register pair atau lokasi memori tidak berubah.Contoh: LDAX B
Load register pair immediateLXI Reg. pair, 16-bit data Instruksi memuat 16-bit data dalam register pair yang
ditunjuk dalam operan.Contoh: LXI H, 2034
Load H and L registers directLHLD 16-bit address Instruksi menyalin isi lokasi memori yang ditunjukkan oleh
alamat 16-bit ke dalam register L dan salinanisi lokasi memori berikutnya ke register H.isi lokasi memori sumber yang tidak berubah.Contoh: LHLD 2040
Store accumulator directSTA 16-bit address Isi akumulator disalin ke dalam memori
lokasi yang ditentukan oleh operan.Ini adalah 3-byteinstruksi, byte kedua menetapkan alamat low-orderdan byte ketiga menentukan alamat tinggi-order.Contoh: STA 4350 or STA XYZ
Store accumulator indirectSTAX Reg.pair Isi akumulator disalin ke dalam lokasi memori yang
ditentukan oleh isi dari operan (registerpasangan). Isi akumulator tidak diubah.
Contoh: STAX BStore H and L registers direct
SHLD 16-bit address Isi dari register L disimpan ke dalam lokasi memoriditentukan oleh alamat 16-bit dalam operan dan isiregister H disimpan ke lokasi memori berikutnya denganoperan incrementing. Isi dari register HL adalahtidak berubah. Ini adalah instruksi 3-byte, byte keduamenentukan alamat low-order dan byte ketiga menentukantinggi-order alamat.Contoh: SHLD 2470
Exchange H and L with D and EXCHG none Isi dari register H dipertukarkan dengan isi
register D, dan isi dari register L dipertukarkan denganisi dari register E.Contoh: XCHG
Copy H and L registers to the stack pointerSPHL none instruksi memuat isi register H dan L
ke stack pointer register, isi H registermemberikan alamat tinggi-order dan isi Lregister berikan alamat low-order. Isi Hdan register L tidak berubah.Contoh: SPHL
Exchange H and L with top of stackXTHL none The contents of the L register are exchanged with the stack
location pointed out by the contents of the stack pointerregister. The contents of the H register are exchanged withthe next stack location (SP+1); however, the contents of thestack pointer register are not altered.Example: XTHL
Contoh: XTHLPush register pair onto stack
PUSH Reg. pair The contents of the register pair designated in the operand arecopied onto the stack in the following sequence. The stackpointer register is decremented and the contents of the high-order register (B, D, H, A) are copied into that location. Thestack pointer register is decremented again and the contents ofthe low-order register (C, E, L, flags) are copied to thatlocation.Example: PUSH B or PUSH A
Contoh: PUSH B or PUSH APop off stack to register pair
POP Reg. pair The contents of the memory location pointed out by the stackpointer register are copied to the low-order register (C, E, L,status flags) of the operand. The stack pointer is incremented
by 1 and the contents of that memory location are copied tothe high-order register (B, D, H, A) of the operand. The stackpointer register is again incremented by 1.Example: POP H or POP A
Contoh: POP H or POP AOutput data from accumulator to a port with 8-bit address
OUT 8-bit port address The contents of the accumulator are copied into the I/O portspecified by the operand.Example: OUT 87
Contoh: OUT 87Input data to accumulator from a port with 8-bit address
IN 8-bit port address The contents of the input port designated in the operand areread and loaded into the accumulator.Example: IN 82
Contoh: IN 82
ARITHMETIC INSTRUCTIONS
Add register or memory to accumulatorADD R
MThe contents of the operand (register or memory) andthe Carry flag are added to the contents of the accumulator and the result isstored in the accumulator. If the operand is a memory location, its location is specified by the contents of the HL registers. All flags are modified to reflect the result of the addition.Example: ADD B or ADD M
Contoh: ADD B or ADD MAdd register to accumulator with carry
ADC RM
The contents of the operand (register or memory) andthe Carry flag are added to the contents of the accumulatorand the result is stored in the accumulator. If the operand is amemory location, its location is specified by the contents ofthe HL registers. All flags are modified to reflect the result ofthe addition.Example: ADC B or ADC M
Contoh: ADC B or ADC MAdd immediate to accumulator
ADI 8-bit data The 8-bit data (operand) is added to the contents of the
accumulator and the result is stored in the accumulator. Allflags are modified to reflect the result of the addition.Example: ADI 45
Contoh: ADI 45Add immediate to accumulator with carry
ACI 8-bit data The 8-bit data (operand) and the Carry flag are added to thecontents of the accumulator and the result is stored in theaccumulator. All flags are modified to reflect the result of theaddition.Example: ACI 45
Contoh: ACI 45Add register pair to H and L registers
DAD Reg. pair The 16-bit contents of the specified register pair are added tothe contents of the HL register and the sum is stored in theHL register. The contents of the source register pair are notaltered. If the result is larger than 16 bits, the CY flag is set.No other flags are affected.Example: DAD H
Contoh: DAD HSubtract register or memory from accumulator
SUB RM
The contents of the operand (register or memory ) aresubtracted from the contents of the accumulator, and theresult is stored in the accumulator. If the operand is amemory location, its location is specified by the contents ofthe HL registers. All flags are modified to reflect the result ofthe subtraction.Example: SUB B or SUB M
Contoh: SUB B or SUB MSubtract source and borrow from accumulator
SBB RM
The contents of the operand (register or memory ) arethe Borrow flag are subtracted from the contents of theaccumulator and the result is placed in the accumulator. Ifthe operand is a memory location, its location is specified bythe contents of the HL registers. All flags are modified toreflect the result of the subtraction.Example: SBB B or SBB M
Contoh: SBB B or SBB MSubtract immediate from accumulator
SUI 8-bit data The 8-bit data (operand) is subtracted from the contents of theaccumulator and the result is stored in the accumulator. Allflags are modified to reflect the result of the subtraction.
Example: SUI 45
Contoh: SUI 45Subtract immediate from accumulator with borrow
SBI 8-bit data The 8-bit data (operand) and the Borrow flag are subtractedfrom the contents of the accumulator and the result is storedin the accumulator. All flags are modified to reflect the resultof the subtracion.Example: SBI 45
Contoh: SBI 45Increment register or memory by 1
INR RM
The contents of the designated register or memory) areincremented by 1 and the result is stored in the same place. Ifthe operand is a memory location, its location is specified bythe contents of the HL registers.Example: INR B or INR M
Contoh: INR B or INR MIncrement register pair by 1
INX R The contents of the designated register pair are incrementedby 1 and the result is stored in the same place.Example: INX H
Contoh: INX HDecrement register or memory by 1
DCR RM
The contents of the designated register or memory aredecremented by 1 and the result is stored in the same place. Ifthe operand is a memory location, its location is specified bythe contents of the HL registers.Example: DCR B or DCR M
Contoh: DCR B or DCR MDecrement register pair by 1
DCX RM
The contents of the designated register pair are decrementedby 1 and the result is stored in the same place.Example: DCX H
Contoh: DCX HDecimal adjust accumulator
DAA noneThe contents of the accumulator are changed from a binaryvalue to two 4-bit binary coded decimal (BCD) digits. This is
the only instruction that uses the auxiliary flag to perform thebinary to BCD conversion, and the conversion procedure isdescribed below. S, Z, AC, P, CY flags are altered to reflectthe results of the operation.
If the value of the low-order 4-bits in the accumulator isgreater than 9 or if AC flag is set, the instruction adds 6 to thelow-order four bits.
If the value of the high-order 4-bits in the accumulator isgreater than 9 or if the Carry flag is set, the instruction adds 6to the high-order four bits.
Example: DAA
Contoh: DAA
BRANCHING INSTRUCTIONS
Jump unconditionallyJMP 16-bit address The program sequence is transferred to the memory
locationspecified by the 16-bit address given in the operand.Example: JMP 2034 or JMP XYZ
Contoh: JMP 2034 or JMP XYZJump conditionally
JCJNCJPJMJZ
JNZJPEJPO
16-bit address The program sequence is transferred to the memory locationspecified by the 16-bit address given in the operand based onthe specified flag of the PSW as described below.
DeskripsiJump on CarryJump on no CarryJump on positiveJump on minusJump on zeroJump on no zeroJump on parity evenJump on parity odd
Contoh: JZ 2034 or JZ XYZUnconditional subroutine call
CALL 16-bit address The program sequence is transferred to the memory location
specified by the 16-bit address given in the operand. Beforethe transfer, the address of the next instruction after CALL(the contents of the program counter) is pushed onto the stack.Example: CALL 2034 or CALL XYZ
Contoh: CALL 2034 or CALL XYZCall conditionally
CCCNCCPCMCZCNZCPECPO
16-bit address DeskripsiCall on CarryCall on no CarryCall on positiveCall on minusCall on zeroCall on no zeroCall on parity evenCall on parity odd
The program sequence is transferred to the memory locationspecified by the 16-bit address given in the operand based onthe specified flag of the PSW as described below. Before thetransfer, the address of the next instruction after the call (thecontents of the program counter) is pushed onto the stack.Example: CZ 2034 or CZ XYZ
Contoh: CZ 2034 or CZ XYZReturn from subroutine unconditionallyRET none The program sequence is transferred from the subroutine
tothe calling program. The two bytes from the top of the stackare copied into the program counter, and program executionbegins at the new address.Example: RET
Contoh: RETReturn from subroutine conditionally
RCRNCRPRMRZRNZRPERPO
16-bit address DeskripsiReturn on CarryReturn on no CarryReturn on positiveReturn on minusReturn on zeroReturn on no zeroReturn on parity evenReturn on parity odd
The program sequence is transferred from the subroutine tothe calling program based on the specified flag of the PSW asdescribed below. The two bytes from the top of the stack arecopied into the program counter, and program executionbegins at the new address.Example: RZ
Contoh: RZLoad program counter with HL contents
PCHL none The contents of registers H and L are copied into the programcounter. The contents of H are placed as the high-order byteand the contents of L as the low-order byte.Example: PCHL
Contoh: PCHLRestart
RST 0-7 The RST instruction is equivalent to a 1-byte call instructionto one of eight memory locations depending upon the number.The instructions are generally used in conjunction withinterrupts and inserted using external hardware. Howeverthese can be used as software instructions in a program totransfer program execution to one of the eight locations. Theaddresses are:
InstructionRST 0RST 1RST 2RST 3RST 4RST 5RST 6RST 7
Restart Address0000H0008H0010H0018H0020H0028H0030H0038H
The 8085 has four additional interrupts and these interruptsgenerate RST instructions internally and thus do not requireany external hardware. These instructions and their Restartaddresses are:
InterruptTRAPRST 5.5RST 6.5RST 7.5
Restart Address0024H002CH0034H003CH
LOGICAL INSTRUCTIONS
Compare register or memory with accumulatorCMP R
MThe contents of the operand (register or memory) arecompared with the contents of the accumulator. Bothcontents are preserved . The result of the comparison isshown by setting the flags of the PSW as follows:if (A) < (reg/mem): carry flag is set, s=1if (A) = (reg/mem): zero flag is set, s=0if (A) > (reg/mem): carry and zero flags are reset, s=0Example: CMP B or CMP M
Contoh: CMP B or CMP MCompare immediate with accumulatorCPI 8-bit data The second byte (8-bit data) is compared with the contents
ofthe accumulator.The values being compared remainunchanged. The result of the comparison is shown by settingthe flags of the PSW as follows:if (A) < data: carry flag is set, s=1if (A) = data: zero flag is set, s=0if (A) > data: carry and zero flags are reset, s=0Example: CPI 89
Contoh: CPI 89Logical AND register or memory with accumulator
ANA RM
The contents of the accumulator are logically ANDed withthe contents of the operand (register or memory), and theresult is placed in the accumulator. If the operand is a
memory location, its address is specified by the contents ofHL registers. S, Z, P are modified to reflect the result of theoperation. CY is reset. AC is set.Example: ANA B or ANA M
Contoh: ANA B or ANA MLogical AND immediate with accumulatorANI 8-bit data The contents of the accumulator are logically ANDed with
the8-bit data (operand) and the result is placed in theaccumulator. S, Z, P are modified to reflect the result of theoperation. CY is reset. AC is set.Example:
Contoh: ANI 86Exclusive OR register or memory with accumulatorXRA R
M The contents of the accumulator are Exclusive ORed withthe contents of the operand (register or memory), and theresult is placed in the accumulator. If the operand is amemory location, its address is specified by the contents ofHL registers. S, Z, P are modified to reflect the result of theoperation. CY and AC are reset.Example: XRA B or XRA M
Contoh: XRA B or XRA MExclusive OR immediate with accumulatorXRI 8-bit data The contents of the accumulator are Exclusive ORed with
the8-bit data (operand) and the result is placed in theaccumulator. S, Z, P are modified to reflect the result of theoperation. CY and AC are reset.Example: XRI 86
Contoh: XRI 86Logical OR register or memory with accumulaotrORA R
MThe contents of the accumulator are logically ORed withMthe contents of the operand (register or memory), and theresult is placed in the accumulator. If the operand is amemory location, its address is specified by the contents ofHL registers. S, Z, P are modified to reflect the result of theoperation. CY and AC are reset.Example: ORA B or ORA M
Contoh: ORA B or ORA MLogical OR immediate with accumulatorORI 8-bit data The contents of the accumulator are logically ORed with the
8-bit data (operand) and the result is placed in theaccumulator. S, Z, P are modified to reflect the result of theoperation. CY and AC are reset.
Example: ORI 86
Contoh: ORI 86Rotate accumulator leftRLC none Each binary bit of the accumulator is rotated left by one
position. Bit D7 is placed in the position of D0 as well as inthe Carry flag. CY is modified according to bit D7. S, Z, P,AC are not affected.Example: RLC
Contoh: RLCRotate accumulator rightRRC none
Each binary bit of the accumulator is rotated right by oneposition. Bit D0 is placed in the position of D7 as well as inthe Carry flag. CY is modified according to bit D0. S, Z, P,AC are not affected.Example: RRC
Contoh: RRCRotate accumulator left through carryRAL none
Each binary bit of the accumulator is rotated left by oneposition through the Carry flag. Bit D7 is placed in the Carryflag, and the Carry flag is placed in the least significantposition D0. CY is modified according to bit D7. S, Z, P, ACare not affected.Example: RAL
Contoh: RALRotate accumulator right through carryRAR none
Each binary bit of the accumulator is rotated right by oneposition through the Carry flag. Bit D0 is placed in the Carryflag, and the Carry flag is placed in the most significantposition D7. CY is modified according to bit D0. S, Z, P, ACare not affected.
Contoh: RARComplement accumulatorCMA none
The contents of the accumulator are complemented. No flagsare affected.Example: CMA
Contoh: CMAComplement carryCMC none The Carry flag is complemented. No other flags are
affected.
Contoh: CMCSet CarrySTC none The Carry flag is set to 1. No other flags are affected.
Example: STC
Contoh: STC
CONTROL INSTRUCTIONS
No operationNOP none No operation is performed. The instruction is fetched and
decoded. However no operation is executed.
Contoh: NOPHalt and enter wait stateHLT none The CPU finishes executing the current instruction and halts
any further execution. An interrupt or reset is necessary toexit from the halt state.
Contoh: HLTDisable interruptsDI none The interrupt enable flip-flop is reset and all the interrupts
except the TRAP are disabled. No flags are affected.
Contoh: DIDisable interruptsDI none The interrupt enable flip-flop is reset and all the interrupts
except the TRAP are disabled. No flags are affected.
Contoh: DIEnable interruptsEI none The interrupt enable flip-flop is set and all interrupts are
enabled. No flags are affected. After a system reset or theacknowledgement of an interrupt, the interrupt enable flip-flop is reset, thus disabling the interrupts. This instruction isnecessary to reenable the interrupts (except TRAP).Contoh: EI
Read interrupt maskRIM none This is a multipurpose instruction used to read the status of
interrupts 7.5, 6.5, 5.5 and read serial data input bit. Theinstruction loads eight bits in the accumulator with thefollowing interpretationsContoh: RIM
Set interrupt maskSIM none This is a multipurpose instruction and used to implement
the8085 interrupts 7.5, 6.5, 5.5, and serial data output. Theinstruction interprets the accumulator contents as follows.
Contoh: SIM
top related