Showing posts with label 80386 processor. Show all posts
Showing posts with label 80386 processor. Show all posts

Monday 5 December 2011

Registers of 80386

There are sixteen registers in 80386 which are used by general purpose programmers. These registers are grouped into these basic categories:
General registers
Segment registers
Status and instruction registers

General Registers
They are used primarily to contain operands for arithmetic and logical operations. There are 8 general purpose, 32-bit registers.
32-bit registers : EAX, EBX, ECX, EDX, EBP, ESP, ESI, EDI

The 32 bit regsiters are broken down into 16 bit or 8 bit.

The lower word of each of 32 bit register can be addressed as a separate unit. This is useful for handling 16-bit data items.
16-bit registers : AX, BX, CX, DX, BP, SP, SI, DI

Each byte of the 16-bit registers AX, BX, CX, and DX has a separate name and can be treated as a unit. This feature is useful for handling characters and other 8-bit data items.
8 bits registers :  AH, BH, CH, DH , AL, BL, CL, DL

All of the general-purpose registers are available for addressing calculations and storing the results of most arithmetic and logical calculations; however, a few functions are dedicated to certain registers.

Data Types of 80386

The fundamental datatypes of 80386 are
bytes
words
doublewords

1 Byte = 8 bits
1 Word = 2 contiguous bytes
1 doubleword = 2 contiguous words

A byte is eight contiguous bits starting at any logical address. The bits are numbered 0 through 7.Bit zero is the least significant bit.

A word is two contiguous bytes starting at any byte address. A word thus contains 16 bits. The bits of a word are numbered from 0 through 15. bit 0 is the least significant bit.
The byte containing bit 0 of the word is called the low byte and the byte containing bit 15 is called the high byte.
Each byte within a word has its own address, and the smaller of the addresses is the address of the word. The byte at the lower address contains the eight least significant bits of the word   and the byte at the higher address contains the eight most significant bits.

A doubleword is two contiguous words starting at any byte address. A doubleword thus contains 32 bits. The bits of a doubleword are numbered from 0 through 31; bit 0 is the least significant bit.
The word containing bit 0 of the doubleword is called the low word.The word containing bit 31 is called the high word.
Each byte within a doubleword has its own address, and the smallest of the addresses is the address of the doubleword.
The byte at the lowest address contains the eight least significant bits of the doubleword and the byte at the highest address contains the eight most significant bits.

Additional data types

Integer
    A signed binary numeric value contained in a 32-bit doubleword, 16-bit word, or 8-bit byte. All operations assume a 2's complement representation.
high-order bit is used for a sign. bit 7 in a byte, bit 15 in a word, and bit 31 in a doubleword are used as sign bit. The sign bit has the value zero for positive integers and one for negative.
The range :
8-bit integer : -128 through +127
16-bit integers : -2^(15) through +2^(15) -1
32-bit integers : -2^(31) through +2^(31) -1

Ordinal
    An unsigned binary numeric value contained in a 32-bit doubleword, 16-bit word, or 8-bit byte.
The range :
8-bit integer : 0 through 255   (2^(8) -1)
16-bit integers : 0 through 65,535   (2^(16) -1)
32-bit integers : 0 through 2^(32) -1

Near Pointer 
    A 32-bit logical address. A near pointer is an offset within a segment.Used in either a flat or a segmented model of memory organization.

Far Pointer
    A 48-bit logical address of two components: a 16-bit segment selector component and a 32-bit offset component. Used in Segmented model.

String
    A contiguous sequence of bytes, words, or doublewords. A string may contain from zero bytes to 2^(32) -1 bytes (4 gigabytes).

Bit field
    A contiguous sequence of bits. A bit field may begin at any bit position of any byte and may contain up to 32 bits.

Bit string
    A contiguous sequence of bits. A bit string may begin at any bit position of any byte and may contain up to 2^(32) -1 bits.

BCD
    A byte (unpacked) representation of a decimal digit in the range 0 through 9.

Packed BCD
    A byte (packed) representation of two decimal digits, each in the range 0 through 9

Memory Organization in 80386

The Physical memory of 80386 is organized as a sequence of bytes. Each byte is assigned a unique address that ranges from zero to a maximum of 2^(32) -1 (4 gigabytes). The logical memory of 80386 can address up to 2^(46) bytes (64 terabytes).
The two types of memory models in 80386 are


  • A "flat" address space consisting of a single array of up to 4 gigabytes.
  • A segmented address space consisting of a collection of segmants.
Both  model provides memory protection.

Flat Model
In a flat model , a programmer sees memory as a single array up to 4GB. The processor maps the 4 GB flat space onto the physical address space by the address translation mechanisms.
A pointer into this flat address space is a 32-bit ordinal number that may range from 0 to 2^(32) -1. Relocation of separately-compiled modules in this space must be performed by systems software (e.g., linkers, locators, binders, loaders)

Segmented Model
In Segmented model, address space is viewed as collection of segments. The segmented model can consist of 16,383 segments.
Applications programmers view the logical address space of the 80386 as a collection of up to 16,383 one-dimensional subspaces, each with a specified length. Each of these linear subspaces is called a segment. A segment is a unit of contiguous address space. Segment sizes may range from one byte up to a maximum of 2^(32) bytes (4 gigabytes).

A pointer in this address space consists of two parts:
  •  A segment selector, which is a 16-bit field that identifies a segment.
  •  An offset, which is a 32-bit ordinal that addresses to the byte level within a  segment. 

80386 processor: Introduction

The 80386 is an advanced 32-bit microprocessor optimised for multitasking operating systems.It is designed for applications needing very high performance.
The processor can address up to four gigabytes of physical memory and 64 terabytes (2^(46) bytes) of virtual memory.