Docsity

Microprocessor Programming : 8086 Pins, Memory Banking, Segmentation and Min/Max Mode, Study notes of Computer science

Toggle sidebar
bg1
1. Introduction to Intel 8086
● Intel 8086 was launched in 1978.
● It was the first 16-bit microprocessor.
● It had a major improvement over the execution speed of the 8085.
● It is available as a 40-pin Dual-Inline-Package (DIP).
● Available in three versions: 8086 (5 MHz), 8086-2 (8 MHz), 8086-1 (10 MHz).
● It consists of 29,000 transistors.
● It has a 16-line data bus and a 20-line address bus.
● It could address up to 1 MB of memory.
● It has more than 20,000 instructions.
● It supports multiplication and division.
2. Pin Configuration of 8086 (DIP)
8086 is a 16-bit microprocessor. It is the first processor available in a 40-pin package (Dual-In-
Package). It is available in 40-pin Dual-In-Line Package (DIP).
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Microprocessor Programming : 8086 Pins, Memory Banking, Segmentation and Min/Max Mode and more Study notes Computer science in PDF only on Docsity!

1. Introduction to Intel 8086

● Intel 8086 was launched in 1978. ● It was the first 16-bit microprocessor. ● It had a major improvement over the execution speed of the 8085. ● It is available as a 40-pin Dual-Inline-Package (DIP). ● Available in three versions: 8086 (5 MHz), 8086-2 (8 MHz), 8086-1 (10 MHz). ● It consists of 29,000 transistors. ● It has a 16-line data bus and a 20-line address bus. ● It could address up to 1 MB of memory. ● It has more than 20,000 instructions. ● It supports multiplication and division.

2. Pin Configuration of 8086 (DIP)

8086 is a 16-bit microprocessor. It is the first processor available in a 40-pin package (Dual-In- Package). It is available in 40-pin Dual-In-Line Package (DIP).

2.1 Power Supply and Clock Signal

● Vcc → +5V DC supply at pin 40. ● GND → Ground at pin numbers 1 and 20. ● CLOCK → at pin 19; clock frequency ranges from 5 MHz – 10 MHz.

2.2 Address / Data Bus [AD0 – AD15]

● 16 address lines and data lines are multiplexed to minimize the number of pins in the IC. ● AD0 – AD14 → Pins 2 to 16. ● AD15 → Pin 39. ● During the first clock cycle, it carries the address, and then it carries data. ● Data bus → 16 bits (multiplexed first 16 data lines to minimize the number of pins). ● Address bus → 20 bits.

2.3 Address / Status Bus

● A16/S3, A17/S4, A18/S5, A19/S6 → Pins 38, 37, 36, 35 respectively (demultiplexed status signals). ● S3 and S4 → status flags used to select the segment type (segment register). S3 S4 Select Segment Type 0 0 ES – Extra Segment 0 1 SS – Stack Segment 1 0 CS – Code Segment 1 1 DS – Data Segment

● S5 → Interrupt flag value / content. ● S6 → Status of the master bus (future purpose, reserve logic value '0').

2.4 HE / S7 Pin 34

● HE → us High Enable — an active low signal. ● Used to indicate the transfer of data using the (higher-order) data bus — it gets activated when the input is low.

As per Pin-Configuration notes (Page 1):

A0 Data Active 0 0 16-bit (D0 – D15) 0 1 8-bit (D8 – D15) 1 0 8-bit (D0 – D7) 1 1 Idle

Pin No. Maximum Mode Minimum Mode 30 RQ/GT1 HLDA 31 RQ/GT0 HOLD

2.10 Minimum Mode Signals — Detailed

● INTA → Interrupt Acknowledgement Pin 24 : When the microprocessor receives this signal, it acknowledges the interrupt. ● ALE → Address Latch Enable Pin 25 : If ALE 1, it provides the address; if ALE 0, it is a data line. This signal indicates the availability of a valid address on the AD lines. ● DEN → Data Enable Pin 26 : To enable the transceiver (8286) to separate data from the AD bus. ● DT/R → Data Transmit / Receive Pin 27 : Indicates the direction of data flow through the transceiver. 1 – Transmit, 0 – Receive. ● M/IO Pin 28 : Memory / Input-Output device. When M/IO 1 → memory operation; when M/IO 0 → I/O operation. ● WR → Write Pin 29 : Active low signal, used to write data into memory or an output device. ● HOLD [Pin 30]: Indicates to the processor that an external device is requesting to access the address/data bus. ● HLDA [Pin 31]: Hold Acknowledgement — issued after receiving the HOLD signal.

● TEST [Pin 23]: Checks the WAIT instruction / status of the math co-processor 8087 (the BUSY pin of 8087 is connected to this pin). If low, execution continues; else the microprocessor is in a wait state. ● NMI [Pin 17]: Non-Maskable Interrupt — the programmer cannot control this interrupt; it is edge-triggered (used for emergency handling, e.g., hardware failure, power failure, watchdog timer timeout). ● INTR [Pin 18]: Interrupt Request — the programmer can control this interrupt; it is level- triggered (e.g., mouse, keyboard, printer).

2.11 Maximum Mode Signals

● S0, S1, S2 Pins 26, 27, 28 — all active low; control signals for all operations are generated by decoding S2, S1 and S0. Status 0 0 0 Interrupt Acknowledgement 0 0 1 I/O Read 0 1 0 I/O Write 0 1 1 Halt 1 0 0 Opcode Fetch 1 0 1 Memory Read 1 1 0 Memory Write 1 1 1 Passive

● QS0 and QS1 Pins 24, 25 → Status of the instruction queue. QS1 QS0 Status 0 0 No operation 0 1 First byte of the queue 1 0 Empty the queue 1 1 Subsequent byte

● RQ/GT1 and RQ/GT0 Pins 30, 31 : Request / Grant signals used by other processors requesting the CPU to release the system bus. RQ/GT0 has higher priority than RQ/GT1. ● LOCK Pin 29 : Indicates to other processors not to ask the CPU to release the bus. ● CLK (pin 19 – covered above): At a time, data and address according to requirement are provided synchronously — this is called synchronization, done using the clock.

● 8086 has a 16-bit data bus, hence it should be able to access 16-bit data in one operation.

● But the memory chips available are normally such that each location has 8 bits, i.e., 1 byte.

● Hence, to read 16 bits it needs to access 2 memory locations.

● If both these memory locations are in the same memory chip, the address bus will have to provide two addresses sequentially and will require double the time — 16 bits would not be accessed simultaneously.

● To solve this problem, the memory of 8086 is divided into two banks; each bank provides 8 bits.

● One bank contains all even addresses, called the Even Bank; the other bank is called the Odd Bank, containing all odd addressing.

● At a time, only one address is generated by the microprocessor (μp).

● A19 – A1 addressing is common in memory addressing (16-bit data access); A0 and HE together select which bank(s) are active.

● Even bank (Lower add., active low, selected by A0) and Odd bank (Higher add., active low, selected by HE) — each of 512 KB.

HE – Bank Higher Enable (active low):

A0 Meaning 0 0 16-bit — higher byte 0 1 (D15 – D8) 8-bit (higher bank) 1 0 (D7 – D0) 8-bit (lower bank) 1 1 Idle (X) — no operation

4. Memory Segmentation in 8086

● The program, data, and stack are stored in separate blocks in memory, and hence they are organized in a modular fashion. ● It also helps in object-oriented programming to store the data of an object. ● Sharing of data, or passing data from one program to another, is easily possible due to segmentation. ● Segmentation also makes data relocatable, as the program uses only offset register pointers, while the segment register points to the base of a segment. ● Access 1 MB of memory using 16-bit registers. ● Proper management of instructions, data, and stack (programs).

4.4 Disadvantages of Segmentation

● It becomes complicated for the programmer, as multiple registers (segment and pointer registers) are needed to access a memory location. ● Although the total memory is 1 MB (i.e., 16 × 64 KB), at a time only 4 × 64 KB (i.e., 256 KB) can be accessed, since only the four segment registers (CS, SS, DS, ES) are active at once.

4.5 Supplementary: Memory Segmentation & Addressing

Source: SEGMENTATION.pdf (this material is not covered in HANDWRITENNOTESM-3.pdf, hence included as supplementary content)

● Related concepts: Von Neumann architecture & Harvard architecture; Program Memory & Data Memory.

Need for Segmentation:

● To implement Harvard architecture. ● Easy to debug. ● Same interfacing ICs can be used. ● To avoid overlap of the stack with normal memory. ● Compatible with 8085.

Memory Address Generation

The BIU (Bus Interface Unit) has a dedicated adder for determining physical memory addresses. The 16-bit Segment Register is appended with "0000" and added to the 16-bit Offset Value by this adder to produce the 20-bit Physical Address.

Segment : Offset Address

● Logical Address is specified as segment:offset. ● Physical address is obtained by shifting the segment address 4 bits to the left and adding the offset address.

Example — Logical Address A4FB:

A4FB0 + 4872 = A

Thus, the physical address of the logical address A4FB:4872 is A9822H.

Segments, Segment Registers & Offset Registers

● Segment size = 64 KB. ● Maximum number of segments possible = 4 (i.e., the 4 segment registers active at a time). ● Logical Address – 16 bits; Physical Address – 20 bits. ● 2 logical addresses are needed for each segment: Base Address (16 bits) and Offset Address (16 bits). ● Segment registers are used to store the base address of the segment. ● 4 Segments in 8086: Code Segment (CS), Data Segment (DS), Stack Segment (SS), Extra Segment (ES). Segment Segment Register

Offset Register

Code Segment CSR Instruction Pointer (IP)

5.1 Support Chips

● 8284 — Clock Generator: provides CLK, RESET, and READY signals to the processor. ● 8282 — Address Latch (8-bit latch): used for demultiplexing (separating) the address. AD0– AD19 are latched using ALE = 1 (Address Latch Enable). Latch stores ( 1 ) the address; OE is active low ( 0 ) when the output needs to be enabled. ● 8286 — Data us Transceiver (8-bit latch): used for demultiplexing (separating) the data. DT/R: Data transmit → 1, Receive → 0. DEN → 0 and OE → active when transferring data (this decides whether the bus is carrying address or data). ● 74138 — 3:8 Decoder: decodes M/IO, RD, and WR to generate the control-bus signals. Signal Generated 0 0 1 IOR (I/O Read) 0 1 0 IOW (I/O Write) 1 0 1 MEMR (Memory Read) 1 1 0 MEMOR / MEMW (Memory Write)

5.2 Key Points

● The signals AD0–AD15, A16/S3 – A19/S6, and HE/S7 are multiplexed. ● These signals are demultiplexed by external latches and the ALE signal. ● The latches are generally buffered, output D-type, like the 8282. These latches provide increased output-drive capacity. ● The DEN signal indicates that valid data is available on the data bus, while DT/R is responsible for indicating the direction of data to or from the processor. ● At the time of data transfer, the OE (Output Enable) pin should be active low. ● The 8284 clock generator provides clock pulses at a constant frequency. The clock generator is synchronized with the READY signal and some external signals. ● The RES signal initializes the system with clock pulses. ● The status of the lines M/IO, RD, and WR decides the type of operation — I/O read, I/O write, memory read, or memory write. ● The HOLD and HLDA signals are used to interface with other bus masters. ● The INTR and INTA signals are used to increase the interrupt-handling capacity of the

6. Functioning of 8086 in Maximum Mode

● In maximum mode, the processor works at the same time along with the system bus (supports multiple processors, e.g., the 8087 numeric co-processor). ● MN/MX 0 (Pin 33) → Maximum Mode.

6.1 8288 Bus Controller

● The 8086 CPU acts as the Default us Master; RQ0/GT0 and RQ1/GT1 lines are used to Request/release the bus with other processors, such as the 8087. ● LOCK: relates to instruction execution time — request for bus control work. The instruction is executed first, and then the bus control is granted to the requester. ● S0, S1, S2 → inputs to the 8288 us Controller, which generates the control signals. ● MN/MX 0 for maximum mode.

DEN and DT/R actions:

Action 0 X Transreceiver is disabled 1 0 Received data 1 1 Transmit data

Signal Function during Memory Read Operation ALE (Address Latch Enable)

Goes HIGH during T1 to latch the lower 16-bit address (AD0– AD15) into an external latch because these lines are multiplexed. M/IO Remains HIGH to indicate that the current operation is a memory operation, not an I/O operation. RD (Read) Goes LOW to enable the addressed memory device to place data onto the data bus. WR (Write) Remains HIGH (inactive) because no write operation is performed during a memory read. DEN (Data Enable) Goes LOW to enable the external data bus transceiver, allowing data transfer from memory to the processor. DT/R (Data Transmit/Receive)

Remains LOW to configure the data transceiver in Receive mode, so the processor can receive data from memory.

7.2 The 8086 I/O Write Cycle in Minimum Mode

T1 (Address Phase)

● The processor places the 16-bit I/O port address on the multiplexed address/data bus (AD0– AD15). ● ALE goes HIGH to latch the address into an external latch. ● M/IO LOW, indicating an I/O operation.

T2 (Control Signal Activation)

● The address bus is released, and the data bus is prepared. ● DT/R HIGH, indicating the processor will transmit data. ● DEN LOW enables the external data bus transceiver. ● WR LOW signals the selected I/O device to accept data.

T3 (Data Transfer)

● The processor places the data on the data bus. ● The addressed I/O device reads and stores the data while WR remains LOW.

T4 (Completion)

● WR returns HIGH, ending the write operation. ● DEN is deactivated, and the data bus enters the high-impedance state. ● The processor completes the I/O write cycle and prepares for the next operation.

Summary of Write-Cycle Signals

Signal Function ALE Latches the I/O address during T1. M/IO LOW indicates an I/O operation. WR LOW enables writing data to the selected I/O device. RD Remains HIGH (inactive) during the write operation. DEN Enables the external data bus transceiver. DT/R HIGH configures the transceiver for Transmit mode (CPU → I/O device).

8. Minimum Mode vs Maximum Mode — Comparison

Key Maximum Mode Minimum Mode MN/MX Pin Set to logic 0 to operate in max mode.

Connected to logic 1 to operate in min mode. Number of processors

Supports multiple processors. Supports only a single processor.

Circuit design Complex circuit design. Simpler circuit design. Multiprocessing Supports multiprocessing. Does not support multiprocessing. Performance Enhanced performance. Relatively low performance. Additional bus controller

Uses an additional 8288 bus controller.

Does not require any additional bus controller. ALE signal Provided by the 8288 bus controller.

Provided by the 8086 microprocessor itself. System cost Higher system cost. Lower system cost. Co-processor support

Supports up to 3 co-processors. Does not support co-processors.

Use case Used in multiprocessor systems. Used in single-processor systems.