Monday, 5 December 2011

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