CSE 216 · Microprocessors · Final Exam

8086 Microprocessor
Final Revision, Lectures 9–14

Faculty-assigned slide topics only. Built from the L9–L14 lecture decks — key definitions, tables, worked examples, and the exact diagrams from the slides.

Section A5 × 2 marks — all compulsory
Section B4 × 4 marks — answer any 3
Section C3 × 6 marks — answer all
09

Bus Cycle

Read · Write · Memory Banking

What is a bus cycle

The 8086 executes a bus cycle to transfer data or fetch an instruction over the system bus. The minimum bus cycle is 4 clock periods (T-states): T1–T4. Slower devices force extra wait states, Tw, inserted between T3 and T4. Every bus cycle follows the same shape: address out → read/write + control signals → data transfer → termination.

Read cycle

Control pins

PinTypeWhat it does
RDOutputGoes LOW when 8086 reads from memory or an I/O location.
BHE/S7OutputLOW in T1 to enable AD15–AD8 (high byte). In later T-states it re-purposes as status S7.
DT/ROutputHIGH = transmit, LOW = receive, through the 8286/8287 transceiver.
DENOutputLOW enables the transceiver.
ALEOutputDemultiplexes AD15–AD0 into address (A15–A0) and data (D15–D0) on its high→low edge.
READYInputSlow devices pull this LOW, then HIGH once data is ready, to release the processor.

T-state breakdown — Read

  1. T1: 20-bit address placed on AD15–AD0 and A16/S3–A19/S6. Processor outputs LOW on DT/R (holds until T4).
  2. T2: AD15–AD0 lines go tri-state. A16/S3–A19/S6 switch from address to status S3–S6. RD and DEN go LOW (hold until T4).
  3. T3 / Tw: Data comes in on AD15–AD0 from memory/device. If the device pulls READY LOW at the start of T3, the CPU inserts wait states (Tw) until READY goes HIGH. Data is latched at the end of this state.
  4. T4: Command lines disabled — bus cycle terminates.
8086 Read Cycle Timing Diagram
Fig. Read cycle timing diagram — minimum mode

Write cycle

Same shape as the read cycle, with two differences: the WR pin replaces RD, and DT/R is driven HIGH throughout (CPU is transmitting, not receiving).

T-state breakdown — Write

  1. T1: 20-bit address on AD15–AD0 / A16–A19. DT/R goes HIGH, holds until T4.
  2. T2: AD lines tri-state, address/status lines switch to S3–S6. WR and DEN go LOW (hold until T4).
  3. T3 / Tw: Data goes OUT from CPU to memory/device on AD15–AD0. Wait states inserted the same way as the read cycle if READY is pulled LOW.
  4. T4: Command lines disabled — bus cycle terminates.
8086 Write Cycle Timing Diagram
Fig. Write cycle timing diagram — minimum mode
Read vs Write — the 2-mark version RD vs WR pin driven LOW; DT/R is LOW for read (receiving) and HIGH for write (transmitting); data flows IN on AD15–0 during read, OUT during write. Everything else (T-states, ALE, BHE/S7, DEN, READY) behaves identically.

Memory space: even/odd banking

8086 memory is split into two banks, up to 512K bytes each: the odd bank (connects to D15–D8) and the even bank (connects to D7–D0). Bank selection is controlled by BHE and A0:

BHEA0Bank(s) selected
00Both banks (word access, even address)
01Odd address bank only
10Even address bank only
11None
Address space and memory bank diagram
Fig. Physical implementation of the address space — Bank 1 (odd) and Bank 0 (even)

Worked examples

MOV DH, [BX] — byte operation, address 20004H (even): A0=LOW, BHE=HIGH → even bank selected → byte comes off D7–D0 → DH. Single bus cycle.

MOV DH, [BX] — byte operation, address 20005H (odd): A0=HIGH, BHE=LOW → odd bank selected → byte comes off D15–D8 → DH. Single bus cycle.

MOV [BX], CX — word operation, address 20008H (even): A0=LOW, BHE=LOW → both banks selected → CL on D7–D0, CH on D15–D8, written to 20008H/20009H. Single bus cycle.

MOV [BX], CX — word operation, address 20007H (odd): needs two bus cycles. Cycle 1: A0=HIGH, BHE=LOW → odd bank → CL written to 20007H. Cycle 2: A0=LOW, BHE=HIGH → even bank → CH written to 20008H.

Exam trap A word starting at an even address (e.g. 1078H) is a normal single-cycle transfer: A0=0, BHE=0, both banks selected together. Don't confuse this with the odd-address case (e.g. 1077H) — that one is the split, two-bus-cycle operation. Check whether the address itself is even or odd before deciding single vs. double cycle.
10

Interrupt System

Polling · Vector Table · Priority · INTA

The interrupt system lets the processor handle unusual circumstances and lets external hardware communicate with it, without the CPU wasting cycles constantly checking devices. Three categories: predefined interrupts, software interrupts (user-defined), and hardware interrupts (user-defined).

Interrupt classification tree
Fig. Interrupts → Hardware / Software (INT n) → Maskable / Non-Maskable / 256 software types

Polling vs. interrupt-driven I/O

Polling: the main program periodically breaks away (e.g. every 20 ms) to run the keyboard driver and check the device directly — it "asks" the keyboard every cycle whether it has data, whether or not it actually does. This wastes CPU time on empty checks.

Polling diagram — main program checks the keyboard driver every 20ms
Fig. Polling — main program interrupts itself on a timer to check the keyboard

Interrupt-driven: the keyboard itself signals the interrupt controller only when it actually has data, which triggers the appropriate ISR. The CPU runs the main program uninterrupted otherwise — no wasted checks.

Interrupt-driven I/O diagram
Fig. Interrupt-driven I/O — keyboard triggers the ISR only when it has data
2-mark answer Polling = CPU repeatedly checks a device's status at fixed intervals, wasting cycles when there's nothing to do. Interrupt-driven I/O = device signals the CPU only when it needs service, so the CPU is free otherwise. Interrupts are more efficient for infrequent, unpredictable events.

Interrupt vector table

Every 8086 interrupt has a service routine. Their addresses live in a table in 0000:0000H–0000:03FFH. Each interrupt gets 4 bytes (2 for IP, 2 for CS) → the table holds 256 vectors total, one per interrupt type code (0–255).

Formula For interrupt type nn:
Table address of IP = 4 × nn
Table address of CS = 4 × nn + 2
Physical address of ISR = CS × 10H + IP

Worked example — INT 2: IP is stored at table address 4×2 = 00008H; CS is stored at 4×2+2 = 0000AH. The processor reads both values, then computes the ISR's physical start address as CS×10H + IP.

Response to an interrupt — the 8 steps

  1. Push the existing Flag register, CS, and IP onto the stack.
  2. Jump to the interrupt vector table.
  3. Find the appropriate CS and IP in the vector table.
  4. Load the new CS and IP for the Interrupt Service Routine.
  5. Execute the Interrupt Service Routine.
  6. Pop the IP, CS, and Flag of the main program (via the ISR's final IRET).
  7. Load the popped IP, CS, and Flag.
  8. Resume executing the main program.

Along the way, TF and IF are cleared when the interrupt is taken, so the ISR itself isn't interrupted by single-stepping or another maskable interrupt unless it re-enables them.

Interrupt priority

PrioritySource
1 (highest)Single-step mode
2NMI pin interrupt
3Software interrupt
LowestHardware interrupt (only services when nothing else is active)
Exception to memorize If single-step, NMI, and a software interrupt are all pending at once, the software interrupt executes first — NMI and single-stepping are not serviced in that round.

The 256 interrupts & predefined types 0–4

TypeNameTrigger condition
0Division by zeroAny attempted divide-by-zero. Non-maskable.
1Single-step modeWhen TF=1, fires after every instruction.
2NMI pinEdge-triggered, active ≥2 clock cycles on NMI pin — e.g. power failure.
3BreakpointUser-inserted INT 3 — used for debugging.
4OverflowFires when OF=1 and INTO is executed.

Types 5–31 and 32–255

RangeSlide labelHow it's actually invoked
5–31Hardware (per slide header)Two-byte instruction INT nn written into a program — e.g. INT 21H, INT 16H.
32–255Software (per slide header), maskableHardware device pulls INTR pin HIGH while IF=1; after finishing the current instruction the CPU pulses INTA LOW and the device puts its type code on the bus.
Exam trap — label vs. mechanism This is genuinely contradictory-looking, and it's exactly how the course slides present it. For "which range is X" questions, use the slide label: 5–31 = Hardware, 32–255 = Software. For "how is it invoked" questions, use the mechanism: 5–31 is invoked by the software instruction INT nn; 32–255 is invoked by the hardware INTR pin. Answer with whichever the question is actually asking for — the slide headers are authoritative for range questions in this course.

Non-maskable interrupt (NMI) — use cases

NMI use cases diagram
Fig. NMI use cases — power failure, critical response time, non-recoverable HW errors, watchdog, memory parity errors

INTA sequence (for maskable / INTR-driven interrupts)

The interrupt-acknowledge sequence has two INTA bus cycles:

  1. ALE is issued, loading the address latches with indeterminate information.
  2. The first INTA cycle tells the requesting hardware that acknowledgment is in progress and to get ready.
  3. On the second INTA cycle, the hardware places its interrupt type code (32–255) onto the low data bus lines.
11

Interfacing with Memories

ROM Family · SRAM vs DRAM · 8205 Decoder

Instruction processing has three basic steps: (1) fetch from memory, (2) decode, (3) execute (often needs another memory access for operands/results). Memory interfacing is about connecting memory chips to the microprocessor and reading/writing them correctly.

ROM family (PROM → EPROM → EEPROM)

TypeKey property
ROMNon-volatile. Data written at the factory during fabrication; can't be changed after.
PROMProgrammable ROM — user can program it, but only once.
EPROMErasable PROM — contents erased by exposure to ultraviolet light, then reprogrammed.
EEPROMElectrically erasable PROM — no UV needed. This is the tech behind USB memory sticks.
Block diagram of a ROM
Fig. ROM interface — address input, data output, /CE (chip enable), /OE (output enable, for READ)

SRAM vs. DRAM

SRAMDRAM
Cell structure4–6 transistors1 transistor + 1 capacitor
Data retentionValid as long as power is ON — no refresh neededCapacitor leaks → needs periodic refresh (every few ms) or data is lost
SpeedFasterSlower
Cost / density / powerMore expensive, lower densityCheaper, higher density, lower power, less space
Typical useCacheMain memory (most prevalent)

DRAM types

DRAM packaging

PackageDetail
SIMMLate-1980s–1990s, now obsolete. 30- or 72-pin, 32-bit data bus.
DIMMCurrent standard. Pins on both sides ("dual in-line"). Started at 168-pin / 64-bit bus; DDR4 DIMMs use 288-pin connectors.

Memory interface — the three buses

Address bus, data bus, control bus diagram
Fig. 8086 system buses — Address (A19–A0), Data (D15–D0, 16-bit), Control (RD/WR)
BusFunction
Address busCarries the memory address (or I/O address) to the system.
Data bus16-bit; transfers data between the microprocessor and memory/I/O.
Control busCarries the signals (RD/WR) that tell memory or I/O to perform a read or write.

A 16-bit memory word is split into high and low 8-bit banks, connected to the upper/lower halves of the data bus and selected by BHE/A0 — same logic as Lecture 9's memory banking.

ROM/EPROM vs. SRAM interfacing

The 8205 decoder

The Intel 8205 is a common decoder for this: 3 enables (E1, E2, E3), 3 inputs (A0–A2), and 8 outputs — enough to select up to 8 RAM chips (e.g. the 2142).

2k x 8 static RAM array using the 8205 decoder
Fig. 2K×8 static RAM array for the 8086, using the 8205 decoder — note A0/WR and BHE feeding the low/high bank write-enable logic, and A11–A16 feeding the 8205's address/enable inputs for chip select
12

Interfacing Input/Output Ports

Memory-Mapped vs I/O-Mapped · IN/OUT · 74LS245

Two methods exist for interfacing I/O devices to a microprocessor: memory-mapped I/O and I/O-mapped (isolated) I/O. The 8086/8088 (and most Intel µPs) use isolated I/O; the 68HC11 is the course's example of memory-mapped I/O.

Memory-mapped vs. I/O-mapped — the class comparison table

#Memory Mapped I/OI/O Mapped I/O
1I/O device mapped to memory spaceI/O device mapped to I/O space
2Device takes a memory addressDevice takes an I/O address
320-bit address; 220 = 1 MB16-bit address; 216 = 64 KB
4No special treatment for the I/O deviceMicrocontroller distinguishes memory space from I/O space
5All memory instructions allowedOnly IN and OUT instructions allowed
6All registers usableOnly the A register (accumulator) usable
72 control signals: RD, WR4 control signals: MR, MW, IOR, IOW
8Complex decodingSimple decoding
9Slower decodingFaster decoding
10Common in microcontrollersCommon in microprocessors
Exam trap — slide contradiction, resolved Rows 8–9 of the official class table say memory-mapped I/O has complex, slower decoding and I/O-mapped is simple, faster. A different slide's prose says the opposite — that memory-mapped needs no extra instructions or control circuitry, "reducing" decoding complexity. Follow the class comparison table above in your exam answer — it's the one explicitly marked "Notes from Class" and is what full marks are graded against. If a question asks you to reconcile the two, mention both briefly for extra credit but lead with the table.

Memory-mapped I/O

The I/O device is treated as an ordinary memory location — the same instructions (e.g. MOV) that access memory also access the device. Advantage: no extra instructions or control circuitry needed. Disadvantage: eats into the address space available to actual memory. Used by the 68HC11.

Memory mapped I/O diagram
Fig. Memory-mapped I/O — I/O devices sit inside the same 1 MB memory space; same MOV instruction reaches both

I/O-mapped (isolated) I/O

I/O addresses live in a separate address space from memory, reached only through dedicated port instructions. Advantage: memory keeps its full addressable space. Disadvantage: needs specific instructions and separate control signals — IOR to read from an I/O device, IOW to write to one.

The M/IO pin

The processor tells memory and I/O apart using the M/IO pin: pulled one way for a MOV (memory) instruction, the other way for an IN/OUT (I/O) instruction.

M/IO pin diagram distinguishing memory space from IO space
Fig. M/IO pin is pulled LOW or HIGH depending on whether the instruction targets Memory Space (1 MB) or I/O Space (64 KB)

I/O ports — IN / OUT

8-bit port: address is encoded directly in the instruction (1 byte opcode + 1 byte address), carried on A0–A7. No segment register involved.

16-bit port: address must be loaded into DX first, carried on A0–A15. Still no segment register.

Transfer width: 8-bit transfers use AL; 16-bit transfers use the full AX (low byte AL → specified port, high byte AH → the next port address — little endian).

Worked assembly example (Slide 13)

An 8088 system monitors a critical temperature at input port 22h, and raises an alarm if it hits 100:

Chk:  IN   AL, 22h    ; Read temperature from port 22h
      CMP  AL, 100    ; Is it >= 100?
      JB   Chk        ; If not, keep monitoring
      CALL Alarm      ; If it is, set off alarm

The 74LS245 octal bus transceiver

A common example ties switches to the 8086 through a 74LS245 — an octal bidirectional buffer/transceiver. Its DIR pin sets transfer direction, and its CS is generated by decoding the address lines together with IORD. Data moves over D0–D7; the I/O control signal (IORD) confirms the access is I/O-mapped, not memory.

74LS245 example with switches connected to 8086 via I/O mapped I/O
Fig. Switches connected to the processor through the 74LS245 — address-line decoding generates ̄CS, IORD confirms I/O-mapped access, data flows on D0–D7
13

Updated Microprocessors

Pipelining · Multicore · Turbo Boost · Hyper-Threading · PBO

Processor family lineage covered: 8085 → 8086 → 186 → 286 → 386 → 486 → 586 (P1–P4, Core 2 Duo → Core i7).

Pipelined vs. unpipelined execution

Unpipelined: each job (fetch → decode → execute) starts and fully finishes before the next job begins — jobs run one after another, back to back.

Unpipelined execution diagram
Fig. Unpipelined — start and finish a job before moving to the next

Pipelined: each job is broken into smaller stages (FET, DEC, EXE). While instruction I1 is in its EXE stage, I2 can already be in DEC, and I3 can already be in FET — stages overlap across a clock cycle, so throughput goes up even though any single instruction still takes 3 stages to finish.

Pipelined execution diagram
Fig. Pipelined — break the job into smaller stages; stages of successive instructions overlap
Quick calc intuition Unpipelined time for N instructions ≈ N × (3 stages). Pipelined time ≈ 3 + (N−1) stages once the pipeline is full — the first instruction still takes 3 stages to exit, but every instruction after that adds only 1 stage-cycle instead of 3.

Multi-core: what and why

A multi-core processor is a single component with two or more independent CPU cores that each read and execute ordinary instructions (add, move, branch). Multiple cores run multiple instructions at the same time, boosting throughput for parallel-friendly programs. Cores are usually integrated onto one die (a chip multiprocessor, CMP) or onto multiple dies in one package. Within each core, threads are still time-sliced, same as on a single-core processor.

Why go multi-core?

Processor family: i3 / i5 / i7

TierTarget market
Core i3Entry-level desktop/laptop
Core i5Mid-level computing
Core i7High-end / high performance

Cache: larger L3 cache speeds up repetitive tasks and multitasking — background tasks stay "ready" in cache when you switch windows. Desktop i5: 3–8 MB L3. Desktop i7: 8–15 MB L3.

Turbo Boost

Intel's built-in "overclocking" feature: lets the processor exceed its base clock speed when only one or two cores are actually needed (e.g. a demanding single-threaded task), by effectively powering down unused cores. Both Core i5 and Core i7 support Turbo Boost; it's activated when the OS requests the highest performance state, and its frequency ceiling is highest on Core i7.

Active coresModeBase frequencyMax Turbo Boost frequency
4Quad-Core1.73 GHz2.0 GHz
2Dual-Core1.73 GHz2.8 GHz
1Single-Core1.73 GHz3.06 GHz

Note the pattern: base frequency stays fixed at 1.73 GHz regardless of how many cores are active, but the fewer cores in use, the higher Turbo Boost can push the active core(s).

Hyper-Threading

Intel Hyper-Threading uses multi-threading so a processor appears to have more cores than it physically does, to the OS and applications — useful for multitasking, multimedia transcoding/rendering, and web loads with several simultaneous elements.

Hyper-threading diagram: processor with HT executes two threads more in parallel
Fig. HT lets a processor interleave two software threads more efficiently, using previously idle resources
CPUHyper-Threading behavior
Core i7 (all variants)Always uses HT. 6-core → 12 streams, 4-core → 8 streams, dual-core → 4 streams.
Core i5Uses HT to make a dual-core act like 4 threads. A 4 true-core i5 will not have HT. Tops out at 4 streams either way.

Integrated graphics

Graphics built directly into the processor core (rather than the motherboard chipset, as in older designs). Saves power since there's no separate graphics chip drawing current on the board.

Updated microprocessors used in 2026

Table of updated microprocessors used in 2026
Fig. Spec comparison — AMD Ryzen 5600/7500F/7600/9600/9800X3D and Intel i5-12400F/i5-14600K

Precision Boost Overdrive (PBO) — AMD Ryzen

What it is: a Ryzen feature that pushes CPU frequency higher than stock boost, in real time, without manual overclocking — as long as cooling is sufficient.

How it works: increases voltage and wattage to extract more performance within the thermal limits available, going beyond default power limits. Easier to use than manual overclocking, though manual OC can still edge out slightly higher performance.

Getting the most from it: pair PBO with AMD's Curve Optimizer (CO) to adjust the voltage-frequency curve per core (or all cores) — effectively undervolting to reach higher frequencies within thermal limits.

Adjustable PBO-related BIOS settings
PBO Limits
Precision Boost Overdrive Scalar Control
CPU Boost Clock Override
Platform Thermal Throttle Control
Curve Optimizer
Curve Shaper
BIOS screenshot showing Precision Boost Overdrive settings
Fig. PBO exposed in motherboard BIOS (Advanced Mode) — Auto / Disable / Enabled / Advanced
14

DMA & Microcontroller

DMA Module · 8-Step Sequence · Microcontroller Concepts

Why DMA?

Programmed I/O and interrupt-driven I/O both need active CPU involvement, which caps the transfer rate and ties up the CPU. Programmed I/O gets high transfer rates but the CPU does nothing else meanwhile; interrupt I/O frees the CPU somewhat but at the cost of transfer rate. DMA (Direct Memory Access) solves both: an extra hardware module moves data directly between memory and I/O, without routing it through the processor.

DMA function

The DMA controller is an additional module on the system bus. It takes over from the CPU for I/O transfers, and must either wait to use the bus only when the CPU doesn't need it, or force the CPU to briefly suspend operation.

What the CPU tells the DMA controller (once, up front)

After that, the CPU carries on with other work. The DMA module transfers data one word at a time, directly to/from memory, and interrupts the CPU only once — when the whole transfer is finished. So the CPU is involved only twice: at the start and at the end.

DMA overview: CPU, Memory, DMA Controller, I/O Device connected via address/data/control bus, with HOLD, HLDA, DREQ, DACK
Fig. Peripheral-to-memory transfer with DMA — CPU, Memory, and I/O Device around the DMA Controller, linked by HOLD/HLDA (to CPU) and DREQ/DACK (to device)

The 8-step DMA transfer sequence

  1. µP initializes the DMAC by giving it the starting address and the number of bytes to transfer.
  2. An I/O device requests the DMAC to perform a DMA transfer, through the DREQ line.
  3. The DMAC in turn sends a request signal to the µP, through the HOLD line.
  4. The µP finishes its current machine cycle and releases the system bus (disconnects from it), and acknowledges the HOLD signal through the HLDA line.
  5. The DMAC acquires control of the system bus, and sends the DACK signal to the I/O peripheral — the DMA transfer begins.
  6. After every byte transferred, the Address register is incremented (or decremented) and the Count register is decremented.
  7. This continues until the Count reaches zero (Terminal Count) — the DMA transfer is now complete.
  8. At the end, the DMAC releases the system bus by setting HOLD = 0. The µP takes back control of the system bus and continues its own operation.

DMA module diagram

DMA module internal diagram with Data Count, Data Register, Address Register, Control Logic
Fig. Internal DMA module — Data Count, Data Register, Address Register, and Control Logic handling DMA Request/Acknowledge, Interrupt, Read, and Write

Internally, the module holds a Data Count register, a Data Register, an Address Register, and Control Logic that manages the DMA Request/Acknowledge handshake, raises an interrupt when done, and drives Read/Write.

Intel 8237 DMA controller — key signals

SignalFunction
D[7..0]System (ISA) bus lines the µP uses to write to the 8237's internal registers.
A[19..0]Carries the memory address the DMA writes transferred data to; also addresses the 8237 itself via the lower bits.
ALEAddress latch enable, used by the 8237 when driving the system bus.
MEMR / MEMWMemory read / write, issued by the 8237 while driving the bus.
IOR / IOWI/O device read / write, issued by the 8237 while driving the bus.
HLDAAsserted by the µP to say it has released the system bus.
HRQAsserted by the 8237 to request the µP release the bus.
REQ 0–3 / ACK 0–3Per-channel: device requests a transfer / 8237 grants it.

Devices that typically use DMA: floppy drive, hard drive, sound card.

DMA bus configurations

ConfigurationBehavior
1. Single bus, detached DMA controllerEach transfer uses the bus twice (I/O→DMA, then DMA→memory). CPU suspended twice per word. Cheap but inefficient.
2. Single bus, integrated DMA controllerController may support >1 device. Each transfer uses the bus once (DMA→memory directly). CPU suspended once. Far fewer bus cycles needed.
3. Separate I/O busA dedicated bus supports all DMA-enabled devices. Each transfer uses the bus once; CPU suspended once.

Microcontroller concepts

Microprocessor — a processing unit with basic I/O interfacing and off-chip memory (e.g. 8008, 8080, 8086, 80286, Pentium).

Single-chip microcomputer — a processing unit with on-chip memory, I/O devices, and often extra peripherals like timers and A/D converters (e.g. Intel 8048, 8051, Motorola 68HC11/12).

Microcontroller — an I/O-oriented single-chip microcomputer, distinguished from other single-chip microcomputers by: