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 addressable memory, 16-bitSPandPC, six 8-bit general registers paired as(B,C), (D,E), (H,L)plus 8-bit AccumulatorA. - 5 Active Flags in 8-Bit Flag Register
[S | Z | - | AC | - | P | - | CY]: Sign (D7), Zero (Z=1when result is00H), Auxiliary Carry (D3 -> D4, used for BCDDAA), Parity (P=1for even number of1s), Carry (CY).
| 8085 Instruction | Byte Length | Addressing Mode | Machine Cycles / T-States | Subtle Flag / Execution Trap |
|---|---|---|---|---|
MOV A, B | 1 Byte | Register | 1 MC / 4T | Zero flags affected! |
MVI A, 32H | 2 Bytes | Immediate | 2 MC / 7T | Zero flags affected |
LXI H, 2050H | 3 Bytes | Immediate (16-bit) | 3 MC / 10T | Loads L=50H, H=20H |
LDA 2050H / STA 2050H | 3 Bytes | Direct | 4 MC / 13T | Opcode(4T)+Low(3T)+High(3T)+Mem R/W(3T) |
INR B / DCR B | 1 Byte | Register | 1 MC / 4T | Updates S, Z, AC, P — DOES NOT affect CY! |
INX H / DCX H | 1 Byte | Register Pair | 1 MC / 6T | Affects NO flags at all! (Loop trap!) |
CALL addr16 | 3 Bytes | Direct | 5 MC / 18T | Opcode fetch is 6T, pushes PC onto stack |
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 time or 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
| Interrupt | Priority | Maskable? | Trigger Type | Vector Address |
|---|---|---|---|---|
TRAP (RST 4.5) | 1 (Highest) | ❌ Non-Maskable (NMI) | Both Edge AND Level | 0024H |
RST 7.5 | 2 | ✅ Maskable | Rising Edge triggered (latched) | 003CH |
RST 6.5 | 3 | ✅ Maskable | High Level triggered | 0034H |
RST 5.5 | 4 | ✅ Maskable | High Level triggered | 002CH |
INTR | 5 (Lowest) | ✅ Maskable | Level 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:
# 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
Practice Questions on This Chapter (3)
In the Intel 8085 microprocessor, which hardware interrupt has the highest priority, is Non-Maskable (NMI), and what is its hexadecimal vector jump address?
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?
How many Machine Cycles and T-States are required by the 8085 microprocessor to fetch and execute the 3-byte instruction STA 4050H?