Microprocessors · Prerequisites

Prerequisites for Microprocessors

Microprocessor programming brings together number systems, digital logic, computer architecture, assembly language, memory addressing, interrupts, stack-based execution, input/output and basic electronics.

Core preparation

The soundest preparation is hands-on familiarity with binary and hexadecimal numbers, Boolean logic, programming, the organization of the CPU and memory, and basic digital electronics.

Numbers · Architecture · Assembly

Core prerequisites

These topics lay the groundwork for the 8086 programming model, registers and pins, memory access with segment:offset, arithmetic and logic instructions, procedures, the stack, interrupts, I/O ports and BIOS/DOS services.

BIN

The binary number system

Bits · powers of two · unsigned values

Microprocessors represent data and instructions as binary bit patterns.

Technical significance

Binary arithmetic is the foundation of registers, memory, opcodes, flags and digital logic.

  • Converting between decimal and binary.
  • Recognizing the powers of two.
  • The ranges of 8-bit and 16-bit unsigned values.

Related topics: registers, opcodes, masks, addresses, flags.

HEX

The hexadecimal number system

Base 16 · a short way to write binary values

The hexadecimal system is a way of writing binary values compactly.

Technical significance

8086 addresses, machine-code bytes, register values and bit masks are usually written in hexadecimal.

  • Converting decimal↔hexadecimal and binary↔hexadecimal.
  • One hexadecimal digit corresponds to four bits.
  • Reading byte and word values in hexadecimal.

Related topics: addresses, memory dumps, opcodes, debugging.

2C

Signed numbers and two's complement

Negative integers · overflow

Processors need a way to encode negative integers in binary.

Technical significance

Two's complement representation lets the same adder hardware serve both signed and unsigned arithmetic.

  • The sign bit and the ranges of signed values.
  • Finding the two's complement of a negative value.
  • Telling carry apart from signed overflow.

Related topics: ADD/SUB, the sign flag (SF), the overflow flag (OF), conditional jumps.

ASC

ASCII character codes

Characters · bytes · 30h–39h

Every character read from the keyboard or written to the screen is carried as a one-byte ASCII code.

Technical significance

Writing a number to the screen or reading one from the keyboard requires converting between a digit and its ASCII code. DOS and BIOS services take and return characters as these codes.

  • Digits: '0'–'9' = 30h–39h. The value of a digit is found by subtracting 30h from its code.
  • Uppercase letters 'A'–'Z' = 41h–5Ah, lowercase letters 'a'–'z' = 61h–7Ah. The difference is 20h, that is, only bit 5.
  • Control characters: carriage return (CR) is 0Dh, line feed (LF) is 0Ah. The space is 20h and '$' is 24h.

Related topics: INT 21h character services, routines for reading and printing numbers, strings, DOS strings terminated with '$'.

MHz

Units and prefixes

Frequency · period · KB and MB

Clock speeds, instruction times and memory sizes are given in units with prefixes.

Technical significance

Computing the running time of a piece of code requires the clock period, and interpreting the width of the address bus requires knowing memory sizes in binary prefixes.

  • The period is the reciprocal of the frequency: T = 1/f. With a 5 MHz clock, one clock period is 200 ns.
  • Time prefixes: 1 ms = 10⁻³ s, 1 µs = 10⁻⁶ s, 1 ns = 10⁻⁹ s.
  • Time = number of clock cycles × clock period.
  • Memory uses binary prefixes: 1 KB = 2¹⁰ = 1024 bytes, 1 MB = 2²⁰ bytes. n address lines give 2ⁿ different addresses; 20 lines mean an address space of 1 MB.

Related topics: the clock signal, instruction cycle counts, delay loops, address bus width, the memory map.

BOO

Boolean logic

AND · OR · XOR · NOT

Arithmetic and control circuits are built from Boolean operations.

Technical significance

Logical instructions expose these operations directly to assembly programs.

  • Basic truth tables.
  • Bit masking.
  • Toggling bits with XOR; clearing a register by XORing it with itself.

Related topics: masks, flags, device control, bit fields.

DIG

Digital logic basics

Gates · multiplexers · flip-flops

A CPU consists of digital circuits that store and transform binary values.

Technical significance

Basic logic concepts make it easier to understand registers, ALUs, buses and control signals.

  • The difference between combinational and sequential logic.
  • Gates, multiplexers, decoders and flip-flops.
  • A register as stored binary state.

Related topics: the ALU, the register file, the instruction decoder, the control unit.

Z

Latches and three-state buffers

Latch · buffer · high impedance

When several devices are connected to one bus, these building blocks decide which device drives the bus and when a value is captured.

Technical significance

In processors that put address and data on the same pins one after the other, the address has to be captured in a latch and the data bus has to be isolated with three-state buffers.

  • A latch passes its input to its output while the enable input is active; when the enable is removed it holds the last value.
  • A three-state output can take the high-impedance (Z) state in addition to 0 and 1. In this state the device is as if disconnected from the bus.
  • Only one device should drive a bus at a time. Two outputs driving the bus at the same time is bus contention.
  • An active-low signal is active when it is 0; it is shown with a ' at the end of its name or with a bar over it.

Related topics: ALE and address latches, data transceivers, the RD' and WR' signals, memory banks.

PRG

Basic programming

Variables · loops · conditions

Assembly is easier to learn once you are used to the control flow of algorithms.

Technical significance

High-level programming concepts correspond to low-level instruction sequences.

  • Assignment and arithmetic expressions.
  • Tracing if/else structures and loops step by step.
  • Arrays and functions.

Related topics: CMP/Jcc, loops, variables in memory, procedures.

C

C programming concepts

Types · arrays · functions · memory

C is a useful bridge between high-level code and assembly.

Technical significance

Many processor concepts become clearer when they are related to variables, pointers, function calls and data sizes in C.

  • Integer types and arrays.
  • Basic pointer and address concepts.
  • Function calls and local variables at a conceptual level.

Related topics: stack frames, calling conventions, data representation.

BIT

Bitwise operations

Masks · shifts · rotates

Working with bits is the foundation of low-level programming.

Technical significance

The 8086 has dedicated logic, shift and rotate instructions for bit-level control.

  • Building and applying masks.
  • Testing individual bits.
  • The conceptual difference between logical and arithmetic shifts.

Related topics: SHL/SHR, ROL/ROR, device registers, flags.

ARC

Computer architecture basics

CPU · memory · buses

Microprocessor programming depends on knowing how the CPU exchanges data with memory and I/O.

Technical significance

Registers, buses, memory and control signals form the execution environment that assembly code sees.

  • The basic roles of the CPU, memory and input/output (I/O).
  • Address, data and control buses at a conceptual level.
  • The fetch–decode–execute cycle.

Related topics: the 8086 bus interface, memory access, instruction execution.

REG

Registers

General-purpose · segment · index · pointer

The 8086 exposes a small set of named registers directly to programs.

Technical significance

Assembly instructions mostly work on the AX, BX, CX and DX registers and on the segment, index and pointer registers.

  • Registers are small, fast storage areas inside the CPU.
  • The distinction between general-purpose and special-purpose roles.
  • 16-bit registers and, where available, 8-bit high/low halves.

Related topics: AX/AH/AL, BX, CX, DX, SP, BP, SI, DI, CS, DS, SS, ES.

MEM

Memory addressing

Addresses · bytes · words

Assembly code reads and writes memory locations whose addresses it specifies explicitly.

Technical significance

Knowing how memory is organized is indispensable for variables, arrays, pointers and instructions.

  • Byte-addressable memory.
  • Little-endian representation at a conceptual level.
  • Recognizing the effective address.

Related topics: data variables, arrays, pointers, instruction operands.

SEG

Segmentation on the 8086

Segment:offset · physical address

The 8086 forms 20-bit physical addresses from 16-bit segment and offset values.

Technical significance

Segmentation explains how the original 8086, whose registers are 16 bits wide, could address up to 1 MB of memory.

  • Physical address = segment × 16 + offset.
  • Overlapping segments.
  • The roles of the CS, DS, SS and ES registers.

Related topics: code, data, stack and extra segments, 20-bit addressing.

ALU

Arithmetic and flags

ADD · SUB · CMP · status flags

Arithmetic instructions update both the value in the destination and the processor's status flags.

Technical significance

Flags are used in comparisons, signed/unsigned decisions, loops and error detection.

  • The carry, zero, sign and overflow flags at a conceptual level.
  • CMP updates only the flags, without storing the result of the subtraction.
  • The relation between flags and conditional jumps.

Related topics: ADD, SUB, CMP, Jcc, signed and unsigned comparisons.

JMP

Control flow in assembly

Jumps · loops · labels

Assembly expresses decisions and repetition through labels and branch instructions.

Technical significance

High-level control structures turn into comparisons and jumps when compiled.

  • Tracing conditional and unconditional jumps step by step.
  • Labels as branch targets.
  • Translating simple if/while logic into low-level steps.

Related topics: JMP, JE/JZ, JNE/JNZ, signed/unsigned conditional jumps.

STK

Stack fundamentals

PUSH · POP · SP · LIFO

The stack is used for temporary storage, procedures, return addresses and interrupts.

Technical significance

Disciplined use of the stack is essential for procedure calls and interrupt handling to work correctly.

  • LIFO (last in, first out) order.
  • PUSH and POP at a conceptual level.
  • The SP and SS registers that hold the state of the stack on the 8086.

Related topics: procedures, return addresses, parameters, interrupts.

PROC

Procedures and calls

CALL · RET · parameters

Procedures divide assembly programs into reusable blocks.

Technical significance

CALL and RET rely on the stack to preserve the return information.

  • CALL pushes the return address onto the stack.
  • RET returns to the calling code.
  • Passing parameters in registers and on the stack at a conceptual level.

Related topics: modularity, the stack, calling conventions.

INT

Interrupts

Hardware · software · vector table

Interrupts transfer control to a service routine in response to hardware or software events.

Technical significance

BIOS/DOS services, timers, keyboards and interaction with devices all rely on interrupts.

  • The distinction between hardware and software interrupts.
  • The idea of an interrupt vector.
  • The need to save and restore the processor state.

Related topics: the INT instruction, the interrupt vector table (IVT), the interrupt service routine (ISR), BIOS/DOS services.

I/O

Input/output

Ports · devices · IN/OUT

Microprocessors communicate with peripherals through explicit I/O mechanisms.

Technical significance

Port-mapped and memory-mapped I/O connect the instructions in software to hardware devices.

  • Device registers at a conceptual level.
  • The purpose of the IN and OUT instructions on x86.
  • Polling and interrupt-driven I/O.

Related topics: ports, peripherals, keyboards, displays, controllers.

ELE

Basic electronics

Voltage · signals · timing

Microprocessors are not only abstract instruction machines but also digital systems that run on electricity.

Technical significance

Basic signal and timing concepts help explain the clock signal, buses, pins and interfacing.

  • Binary voltage levels at a conceptual level.
  • Clock signals.
  • Input/output direction and signal timing.

Related topics: the clock, reset (RESET), bus timing, digital interfaces.

TLS

Assembly tools

Assembler · linker · debugger

Low-level programming requires a toolchain that turns symbolic assembly code into executable machine code.

Technical significance

Knowing the stages of the toolchain makes it easier to trace the source of syntax, symbol and runtime errors.

  • The roles of the assembler and the linker.
  • Reading a simple memory/register dump.
  • Single-stepping and breakpoints at a conceptual level.

Related topics: a MASM/TASM/NASM-style workflow, the linker, the debugger.

MC

Machine code basics

Opcodes · operands · encoding

Assembly instructions are the symbolic representation of encoded machine instructions.

Technical significance

Instruction encoding explains why operands, addressing modes and instruction sizes matter.

  • The difference between an opcode and an operand.
  • Instructions occupy bytes in memory.
  • The addressing mode affects the encoding.

Related topics: machine code, disassembly, instruction size.

BUS

Bus and timing basics

Address · data · control

The processor communicates with the outside world through address, data and control signals that work together.

Technical significance

Bus timing explains how memory and peripherals know when to read, write or respond.

  • The distinction between address information and data information.
  • Read/write control signals at a conceptual level.
  • Wait states and timing in broad terms.

Related topics: memory cycles, I/O cycles, control pins, interfacing.

No topic matches the search and filter.