.TH address "" "" Definition
.PC
.PP
An
.B address
is the location where an item of data is stored in memory.
.PP
On the i8086, a physical address is a 20-bit number.
The i8086 builds an address by
left-shifting a 16-bit segment address by four bits, and then
adding it to a 16-bit offset address.
The segment address points to a particular chunk of memory.
The i8086 uses four segment registers, each of which governs a
different portion of a program, as follows:
.DS
	CS	Address of code segment
	DS	Address of data segment
	ES	Address of \*(QLextra\*(QR segment
	SS	Address of stack segment
.DE
.PP
SMALL-model programs use only the offset address; hence, their
pointers are only 16 bits long, equivalent to an \fBint\fR.
LARGE-model programs use both segment and offset addresses.
Their addresses are 20 bits long, which must be stored in a 32-bit pointer,
equivalent to a \fBlong\fR.
\*(CO 286 supports SMALL model.
.PP
On the i80386, addresses start as 32 bits.
Segment registers are used to look up a segment descriptor.
The descriptor's base then defines
the address within a four-gigabyte virtual address space.
The page tables are
then used to translate this to a physical address.
For details, see the \fIIntel 386 Programmers Manual\fR.
.PP
On the M68000, an address is simply a 24-bit integer that is
stored as a 32-bit integer.
The upper eight bits are ignored; this is not
true with the more advanced microprocessors in this family, such
as the M68020.
The M68000 uses no segmentation; memory is organized as a ``flat
address space,'' with no restrictions set on the size of code
or data.
.PP
On machines with memory-mapped I/O, such as the 68000,
some addresses may be used to control or communicate
with peripheral devices.
.SH Example
The following printes the address and contents of a given byte of
memory.
.DM
#include <stdio.h>
.sp \n(pDu
main()
{
	char byte = 'a';
	printf("Address == %x\etContents == \e"%c\e"\en",
		&byte, byte);
}
.DE
.SH "See Also"
.Xr "data formats," data_form
.Xr pointer, pointer
.Xr "Programming COHERENT" programmi
