1.
Microprocessor Bus Structure
A bus is a set of parallel lines (wires or traces) used to carry signals between components in a computer
system.
There are three main buses:
1. Address Bus
• Carries memory addresses from CPU to memory/IO devices.
• Unidirectional: Only from CPU to other components.
• The width of the address bus (e.g., 16-bit, 20-bit, 32-bit) determines the maximum
addressable memory.
2. Data Bus
• Transfers actual data between CPU, memory, and IO devices.
• Bidirectional: CPU can send or receive data.
3. Control Bus
• Carries control signals to coordinate operations.
• Examples: Read (RD), Write (WR), Clock, Interrupt Request (IRQ).
2. Memory Organization and Structure
Segmented Model
• Memory is divided into segments: Code Segment, Data Segment, Stack Segment, Extra
Segment.
• Address = Segment Address × 16 + Offset.
• Used in Intel 8086 and compatible CPUs to manage 1 MB memory with 16-bit registers.
Linear Model
• Memory addresses are continuous from 0 to maximum limit.
• No segmentation; simpler but requires a wide address bus.
3. Introduction to Registers and Flags
Registers
• Small, high-speed storage inside CPU.
• Types:
• General-purpose (AX, BX, CX, DX in 8086)
• Segment registers (CS, DS, SS, ES)
• Pointer/index registers (SP, BP, SI, DI)
• Instruction pointer (IP) – holds address of next instruction.
Flags
• Single-bit indicators in Flag Register showing CPU status after operations.
• Examples: Zero Flag (ZF), Carry Flag (CF), Sign Flag (SF), Overflow Flag (OF).
4. Data Movement, Arithmetic and Logic
• Data Movement: Instructions like MOV, PUSH, POP, XCHG.
• Arithmetic: ADD, SUB, INC, DEC, MUL, DIV.
• Logic: AND, OR, XOR, NOT, TEST, SHL, SHR.
• Affects flags and sometimes modifies registers/memory.
5. Program Control
• Branching: Conditional (JE, JNE, JG) and Unconditional (JMP).
• Loops: LOOP, LOOPE, LOOPNE.
• Call and Return for subroutines.
6. Subroutines
• Reusable code blocks called by CALL and exited with RET.
• Parameters passed via registers, stack, or memory.
• Stack saves return address automatically on CALL.
7. Stack and Its Operation
• Stack: LIFO (Last-In, First-Out) structure in memory.
• SP (Stack Pointer) and SS (Stack Segment) manage it.
• PUSH decreases SP and stores data; POP increases SP and retrieves data.
8. Peripheral Control & Interrupts
• Peripheral Control: Using I/O ports with IN and OUT instructions.
• Interrupts: Signals to CPU to pause current task and execute Interrupt Service Routine (ISR).
• Hardware interrupts: From devices (keyboard, timer).
• Software interrupts: Triggered by INT instruction.
9. Interfacing with High-Level Languages
• Assembly functions can be linked with C, C++, etc.
• Parameters passed via registers or stack; results returned in registers.
• Useful for performance-critical tasks.
10. Real-Time Applications
• Require guaranteed response time (e.g., robotics, embedded systems).
• Assembly ensures fast, predictable execution for hardware control.
11. Objectives & Perspectives of Assembly Language
• Close to hardware, more control over CPU and memory.
• Used where performance and size optimization are critical.
• Helps understand how computers work internally.
12. Addressing Modes
• Ways to specify operands for instructions:
1. Immediate (MOV AX, 5)
2. Register (MOV AX, BX)
3. Direct (MOV AX, [1234H])
4. Register Indirect (MOV AX, [BX])
5. Base+Index (MOV AX, [BX+SI])
6. Relative (used in jumps).
13. Introduction to the Assembler and Debugger
• Assembler: Translates assembly code into machine code (e.g., MASM, TASM, NASM).
• Debugger: Allows step-by-step execution, viewing registers, memory, and flags (e.g., DEBUG
in DOS).
14. Manipulate & Translate Machine and Assembly Code
• Machine code: Binary instructions executed by CPU.
• Assembly: Human-readable mnemonics for machine code.
• Assemblers perform translation; disassemblers reverse it.
15. Describe Actions Inside the Processing Chip
• Fetch instruction → Decode → Execute → Store result.
• Control unit manages signals, ALU performs calculations, registers store temporary data.
16. Operations Performed by an Instruction Set
• Data transfer, arithmetic, logic, control transfer, I/O, string processing, bit manipulation.
17. Writing a Fully Documented Program
• Include comments for each step, state purpose, input/output, registers used, logic flow.
• Example: Adding two numbers from memory and storing result.
18. Using an Assembler of Choice
• Write source file (.asm) → Assemble (.obj) → Link (.exe) → Run → Debug if needed.