∑GateAndNet
PlannerSign Up
INTERMEDIATEFrequently Tested 6 min read 6 views

Assembly Languages (8085, 8086 & RISC): Registers, Flags, T-States, Interrupts & Traces

8085 flag byte [S,Z,X,AC,X,P,X,CY], instruction byte sizes & T-states (MVI, LXI, LDA, STA, LHLD, CALL), hardware interrupt priority & vector addresses (TRAP 0024H), 8086 20-bit physical addressing, and RISC assembly.

1. Intel 8085 Architecture, Flag Register & Subtle Instruction Traps

  • 8085 Bus Widths: 8-bit Data Bus (multiplexed AD0–AD7), 16-bit Address Bus   ⟹  216=64 KB\implies 2^{16} = 64\text{ KB} addressable memory, 16-bit SP and PC, six 8-bit general registers paired as (B,C), (D,E), (H,L) plus 8-bit Accumulator A.
  • 5 Active Flags in 8-Bit Flag Register [S | Z | - | AC | - | P | - | CY]: Sign (D7), Zero (Z=1 when result is 00H), Auxiliary Carry (D3 -> D4, used for BCD DAA), Parity (P=1 for even number of 1s), Carry (CY).
8085 InstructionByte LengthAddressing ModeMachine Cycles / T-StatesSubtle Flag / Execution Trap
MOV A, B1 ByteRegister1 MC / 4TZero flags affected!
MVI A, 32H2 BytesImmediate2 MC / 7TZero flags affected
LXI H, 2050H3 BytesImmediate (16-bit)3 MC / 10TLoads L=50H, H=20H
LDA 2050H / STA 2050H3 BytesDirect4 MC / 13TOpcode(4T)+Low(3T)+High(3T)+Mem R/W(3T)
INR B / DCR B1 ByteRegister1 MC / 4TUpdates S, Z, AC, P — DOES NOT affect CY!
INX H / DCX H1 ByteRegister Pair1 MC / 6TAffects NO flags at all! (Loop trap!)
CALL addr163 BytesDirect5 MC / 18TOpcode fetch is 6T, pushes PC onto stack
Common Exam Mistake

Classic UGC NET 8085 Loop Trap:

LXI B, 0100H
LOOP: DCX B
JNZ LOOP

How many times does LOOP execute? Depends ONLY on previous Zero flag (either 11 time or ∞\infty infinite loop)! Why? Because DCX B does NOT update ANY flag (including Z)! To test BC == 0, you must write MOV A, B followed by ORA C before JNZ LOOP!

2. 8085 Hardware Interrupt Priority & Triggering

InterruptPriorityMaskable?Trigger TypeVector Address
TRAP (RST 4.5)1 (Highest)❌ Non-Maskable (NMI)Both Edge AND Level0024H
RST 7.52✅ MaskableRising Edge triggered (latched)003CH
RST 6.53✅ MaskableHigh Level triggered0034H
RST 5.54✅ MaskableHigh Level triggered002CH
INTR5 (Lowest)✅ MaskableLevel triggered (Non-vectored, external INTA)Supplied externally

3. Load-Store RISC Assembly (MIPS / RISC-V) in GATE COA

In RISC load-store ISAs, arithmetic instructions operate exclusively on registers; only LW (Load Word) and SW (Store Word) access memory:

asm
# Compute A[i] = A[i] + k  (s0 = base of int A[], s1 = i, s2 = k)
SLLI t0, s1, 2      # t0 = i * 4 (byte offset for 4-byte int)
ADD  t1, s0, t0     # t1 = &A[i]
LW   t2, 0(t1)      # t2 = Mem[t1 + 0]  <-- Load-Use RAW hazard if next instr uses t2 immediately!
ADD  t2, t2, s2     # t2 = A[i] + k     (requires 1 stall bubble even with forwarding!)
SW   t2, 0(t1)      # Mem[t1 + 0] = t2
Key Formulas Summary
Intel 8086 20-Bit Segmented Physical Memory Address Formula
Physical Address (20-bit)=(Segment Register×1016)+Offset (16-bit)\text{Physical Address (20-bit)} = (\text{Segment Register} \times 10_{16}) + \text{Offset (16-bit)}
Note: Example: CS = 2500H, IP = 1430H => Physical Address = 25000H + 1430H = 26430H (1 MB space = 2^20)
8085 Vectored Interrupt Hex Address Shortcut (RST n)
Vector Address(RST n)=Hex⁡(8×n),TRAP (RST 4.5)=4.5×8=3610=0024H\text{Vector Address}(\texttt{RST } n) = \operatorname{Hex}(8 \times n), \qquad \texttt{TRAP (RST 4.5)} = 4.5 \times 8 = 36_{10} = \texttt{0024H}
Note: RST 7.5 = 003CH, RST 6.5 = 0034H, RST 5.5 = 002CH
#Assembly Language#8085 Microprocessor#8086 Segmentation#RISC#Interrupts#UGC NET CS#GATE COA

Practice Questions on This Chapter (3)

Q1UGC NET CS Dec 2024MCQEASY
+2M • 0 Neg

In the Intel 8085 microprocessor, which hardware interrupt has the highest priority, is Non-Maskable (NMI), and what is its hexadecimal vector jump address?

⚡ Click an option above to verify instantly
Q2UGC NET CS June 2023MCQMEDIUM
+2M • 0 Neg

In an Intel 8086 microprocessor, if the Code Segment register is CS = 348AH and the Instruction Pointer is IP = 4214H, what is the 20-bit physical memory address of the next instruction fetched?

⚡ Click an option above to verify instantly
Q3UGC NET CS 2021MCQMEDIUM
+2M • 0 Neg

How many Machine Cycles and T-States are required by the 8085 microprocessor to fetch and execute the 3-byte instruction STA 4050H?

⚡ Click an option above to verify instantly
Previous TopicJavaScript (ES6+) Runtime: Event Loop (Microtasks vs Macrotasks), Closures, Hoisting & CoercionNext Topic Software Engineering: COCOMO, Function Points, Cyclomatic Complexity & Cohesion