You are on page 1of 3

Memory Organization

Address
- the number, assigned to a byte that indicates its position in the memory
- the first byte has an address of 0
Low end of memory
- those bytes close to byte 0
high end of memory
- those bytes close to the byte with the highest address
Most significant bits
- the leftmost bits within a byte
- aka high order bits
least significant bits
- the rightmost bits within a byte
- aka low order bits
word boundary
- an address that is a multiple of 2
doubleword boundary
- an address that is multiple of 4
quadword boundary
- an address that is multiple of 8
paragraph boundary
- an address that is multiple of 16
primary memory
- RAM
- Memory that the processor can work with directly
Secondary memory
- resides on the disks
- memory that the processor cannot work with directly

Memory Addresses
- computer memory is organized by bytes.
- All the bytes are numbered, starting from 0
- When the processor needs to read a byte (data saved in a byte) it sends the address to the memory
- The memory then sends the data found in the specified address to the processor
- When the processor needs to write a byte, it sends two signals to the memory, the address of the byte
and the data to be written.
- The memory then copies the data to the specified byte.
- Ex. If the processor wants to store the letter D (44h) in the byte with the address 64AB1h. The processor
sends the address 64AB1h and the data 44h to the memory.
- Bytes are stored in order, one on top of the other with the byte at address 0 being on the bottom
- You refer to a byte by its address
- When you refer to a word, doubleword, quadword or paragraph you use the address of its first byte

How words are stored


- processors transfer data to and from the memory either by bytes or by words (2 bytes)
- when bytes are written to memory, they are stored in a straightforward manner
- when words are written, the two bytes of each word are stored in reverse order
- Example: if the processor writes a word that contains 1234h to memory address 500h
- The bytes will be stored at address 500h and 501h
- You would expect that the information would be stored as:
o 34h will be stored at location 501h
o 12h will be stored at location 500h
- However, it is actually stored as:
o 12h will be stored at location 501h
o 34h will be stored at location 500h
- when the processor requests a word, it will automatically change the order of the bytes

Boundaries
- sometimes data needs to be stored so that it starts at a particular type of address, called a boundary
- boundary is an address that is a multiple of a specific number
- all the addresses that are multiples of 2 are said to be word boundaries
- starting with address 0h every second byte in the memory is on a word boundary (every even hex
numbers)
- Ex. 0h, 2h, 4h, 6h etc
- If the first byte of some data has such address, we say that the data is aligned to a word boundary that
means it starts on a word boundary.
- Ex. Data that starts at address 108A6h is aligned to a word boundary and data that starts at address
108A7h is not aligned to a word boundary
- Similarly, every fourth byte starting from 0h is said to be a doubleword boundary
- Summary of Boundary Alignments
Boundary Definition All Addresses that Ends in…
Word Every 2nd byte 0h, 2h, 4h, 6h, 8h, Ah, Ch, Eh
th
DoubleWord Every 4 byte 0h, 4h, 8h, Ch
QuadWord Every 8th byte 0h, 8h
th
Paragraph Every 16 byte 0h

Primary and Secondary Memory


- Generally every computer has 2 kinds of memory, primary and secondary
- The processor can work directly only with primary memory
- RAM is used to hold most of the primary memory
- When you write a program, the instructions along with the data areas, will be loaded into RAM
- Secondary memory resides on the disks
- The processor cannot directly access the data in a secondary memory
- Before such data can be used, it must be transferred first into primary memory

Registers
- There is a small amount of memory built in to the processor
- This memory consists of 14 (28 bytes) words of RAM
- Each of these word is called a register
- Each register has its own name and own purpose
- When you program refer to each register using their abbreviation
Name Abbreviation Category
Accumulator AX(AH, AL) General Register
Base Register BX(BH, BL) General Register
Count Register CX(CH, CL) General Register
Data Register DX (DH, CL) General Register
Base Pointer BP Offset Register
Instruction Pointer IP Offset Register
Stack Pointer SP Offset Register
Destination Index DI Offset Register
Source Index SI Offset Register
Data Segment Register DS Segment Register
Extra Segment Register ES Segment Register
Stack Segment Register SS Segment Register
Code Segment Register CS Segment Register
Flags Register none none

The General Registers


- There are four general registers AX, BX, CX, DX
- This registers offer convenient temporary storage for any type of data
- AX is the principal register used by arithmetic instructions
- AX is often used to accumulate the results of a calculation
- BX is called the base register because it can be used to hold a base address
- CX is used with certain instructions that perform operations repeatedly
- In Such cases CX, must contain the number of times you want to repeat the operations
- DX is called the data register because it is used to hold data for general purposes
- When you copy information to a register, you LOAD data into that register
- When you copy information from a register, it said that you STORE the data
- Since all registers contain 2 bytes (16 bits) you load and store 2 bytes at a time
- However, the processor allows you to load and store only 1 byte to a general register
- You can refer to the alternate names of each half register
- Ex. AH (high)and AL(low)
- AH refers to the high order bits of AX (the left byte)
- AL refers to the low-order bits of AX (the right byte)
- AX is used to access the whole register
- Ex. If AX contains 1234h, then AH contains 12h, AL contains 34h
- If in AH we store 00h
- AX becomes 0034h
- The same is true with the other general registers but not to the offset and segment registers

You might also like