The 8085 Chip: Ee309: Computer Organization, Architecture and Microprocessors
The 8085 Chip: Ee309: Computer Organization, Architecture and Microprocessors
F LAGS : S Z x A x P x cy ALE : Address Latch Enable: Positivegoing pulse at the start of a machine cycle (each 8085 operation), indicates AD7 - AD0 are A7 - A0 .
HIGH ORDER ADDRESS BUS MULTIPLEXED ADDRESS/DATA BUS
X1 X2 SID SOD A B D H W
VCC
GND A FLAGS 15 C A8 E L SP A7 PC A0 Z
External devices or signals can initiate the following four operations: 1. Reset: RESET IN , RESET OU T Resets the 8085 PC 0 2. Ready: The 8085 waits for an integral number of cycles till this goes high. It waits to sync with slow peripherals 3. Hold: HOLD, HLDA (DMA). The 8085 relinquishes the control of buses, allows external peripherals to use them
INTA HLDA
ALE S0 S1 IO/M RD WR
(b) RST 7.5, RST 6.5, RST 5.5: Vectored restart interrupts (transfer program control to specic memory locations). Order of priority: 7.5 > 6.5 > 5.5 (c) IN T R: Software interrupt, general purpose (d) IN T A: Interrupt Acknowledge Machine Cycle Opcode Fetch Memory Read Memory Write I/O Read I/O Write Interurpt Ack Halt Hold Reset (Status) IO/M S1 S0 0 0 0 1 1 1 Z Z Z 1 1 0 1 0 1 0 X X 1 0 1 0 1 1 0 X X Control Signals RD = 0 RD = 0 WR = 0 RD = 0 WR = 0 IN T A = 0 RD = Z , W R = Z, IN T A = 1
CAMP:8085 Primer-2
PCHL,
5. Stack, I/O and Machine Control Instructions PUSH, XTHL, IN, EI, POP, SPHL, OUT, DI, HLT, NOP, SIM, RIM, LXI SP, INX SP, DCX SP DAD SP
CAMP:8085 Primer-3
CAMP:8085 Primer-4
2. Arithmetic Group
[All Flags Aected:] 1. ADD r A A+r NOTE: ADD A is a valid instruction ! 2. ADD M A A + (HL) 3. ADI 8-bit data A A + byte 2 4. ADC r A A + r + cy 5. ADC M A A + (HL) + cy 6. ACI 8-bit data A A + byte 2 + cy 7. SUB r A Ar If the result is negative, the Carry / Borrow ag cy is set. The Carry ag is the Borrow ag. However, the Auxiliary Carry ag does not double up as an Auxiliary Borrow ! 8. SUB M A A (HL) 9. SUI 8-bit data A A byte 2 10. SBB r A A {r + cy } 11. SBB M A A {(HL) + cy } 12. SBI 8-bit data A A {byte 2 + cy } 13. DAA This adjusts the accumulator to packed BCD after the addition of two BCDs. It functions in two steps: (a) If the lower 4 bits of A are greater than 9, or the Auxiliary Carry ag is set, then it adds 6 to the lower nibble of A (b) Subsequently, if the higher 4 bits of A are now greater than 9, or the Carry Flag is set, it adds 6 to the higher nibble of A [Only cy Flag Aected:] 14. DAD rp HL HL + rp
Sumantra Dutta Roy, EE, IITB [email protected]
CAMP:8085 Primer-5 [Flags Aected: ZAP S , no cy !] 15. INR r r r+1 16. INR M (HL) (HL) + 1 17. DCR r r r1 18. DCR M (HL) (HL) 1 [No Flags Aected:] 19. INX rp rp rp + 1 20. DCX rp rp rp 1 i.e., rh rl rh rl + 1 i.e., rh rl rh rl 1
Addition and Subtraction + DAA All Flags ! INR + DCR no cy ! DAD only cy ! INX + DCX no ags !
3. Logical Group
1. ANA r A Ar 2. ANA M A A (HL) 3. ANI 8-bit data A A byte 2 4. ORA r A Ar 5. ORA M A A (HL) 6. ORI 8-bit data A A byte 2 7. XRA r A Ar 8. XRA M A A (HL) 9. XRI 8-bit data A A byte 2
Sumantra Dutta Roy, EE, IITB [email protected]
CAMP:8085 Primer-6 10. CMP r A r, without performing the actual subtraction. This just sets the ags. 11. CMP M 12. CPI 8-bit data 13. RLC Rotate left without Carry ! 14. RAL Rotate Accumulator left through Carry 15. RRC Rotate right without Carry ! 16. RAR Rotate Accumulator right through Carry 17. CMA Complement contents of the Accumulator 18. STC Set the Carry ag 19. CMC Complement the Carry ag AND, OR, XOR cyZP S aected in all, cy reset(0) AND Auxiliary Carry is set(1) any OR (inclusive / exclusive) Auxiliary Carry is reset(0) Comparison All ags Rotation only cy ! CMA No ags ! STC, CMC only cy !
CAMP:8085 Primer-7
CAMP:8085 Primer-8 16. DAD SP [Only cy Flag aected] HL HL + SP 17. SIM Set Interrupt Mask A suitable bit pattern is loaded into the Accumulator, and then this instruction is to be called. The bit pattern is interpretated as follows: If SDE = 1 only (Serial Data Enable), then whatever is in the SOD SDE R7.5 MSE M7.5 M6.5 M5.5
SOD (Serial Output Data) - 0/1 is latched onto the SOD output line on the 8085. R7.5 is an additional control to reset the RST7.5 ip op. If MSE = 1 only (Mask Set Enable), Mn is masked or disabled if Mn = 1, enabled if Mn = 0. Ths command is also used for serial output. 18. RIM Read Interrupt Mask This command is used to read the status of interrupts 7.5, 6.5 and 5.5, and serial data input. The result of executing this command is a number being loaded into the Accumulator, whose interpretation is as follows: SID represents the serial input bit. SID I7.5 I6.5 I5.5 IE M7.5 M6.5 M5.5
In = 1 interrupt n is pending. IE = 1 the Interrupt Enable ip op is set. Mn the corresponding interrupt is masked out.
Notes
All are equal, but some are more equal than others. . George Orwell, Animal Farm. HOLD has a higher priority than any interrupt. LDAX is not meant for the HL register pair. DAD, HLT have a special Bus Idle Machine cycle. The following instructions have a special 6 T-state Opcode Fetch machine cycle: INX, DCX, PCHL, SPHL, PUSH, RST, and All CALL and RETURN instructions (except RET)