OCR F453 - Addressing Modes
-
Upload
mohammed-patel -
Category
Documents
-
view
222 -
download
0
Transcript of OCR F453 - Addressing Modes
-
8/12/2019 OCR F453 - Addressing Modes
1/7
Addressing modes
-
8/12/2019 OCR F453 - Addressing Modes
2/7
Addressing
Memory can be visualised as a series of pigeon-holes into which
instructions and data can be stored.
Each block of memory has a unique address.
Data can be written to or read from each address.
Addressing modes are the different ways in which theaddresses can be accessed.
For example, you may want to load the accumulator with a
particular value.
Depending on how and where the value is stored this will
require the use of different addressing modes.
-
8/12/2019 OCR F453 - Addressing Modes
3/7
Immediate addressing (relative
addressing) The value to be loaded is not stored in a memory address at all,but is included as part of the instruction.
For example:
LDAA #12H
LDAmeans load the accumulator
#indicates that it is a value that should be loaded and not an
address
12is the value to be loaded
Hindicates that in this case it is a hexadecimal number.
-
8/12/2019 OCR F453 - Addressing Modes
4/7
Direct addressing (absolute
addressing) Direct addressing tells the CPU the address that contains thedata you want to access.
For example: LDAA 100 means load the accumulator with the
data stored at memory address 100.
With an 8-bit address bus, only 256 different memory locationsare addressable.
Even with 32-bit, you are still limiting the amount of memory that
is addressable using this method.
-
8/12/2019 OCR F453 - Addressing Modes
5/7
Indirect addressing
Indirect addressing tells the CPU an address that contains
another address where the data is stored.
For example, LDAI 132:
points to memory address 132
there will be another address at this location
the accumulator is loaded with the data at this address.
This method makes it easier to alter the actions of a program, as
the data can be altered without having to adjust the original
program.
-
8/12/2019 OCR F453 - Addressing Modes
6/7
Index addressing
The address to be accessed is modified by the addition of a
number held in an index register.
For example, LDX R1 32:
LDXmeans load the accumulator (using indexed
addressing) R1is the register that contains the start number for the
address
32is the number to be added to the number at R1 to locate
the address where the data is stored.
This increases the amount of addressable memory.
This particular method is used for addressing data stored in an
array, as it will be stored in consecutive memory locations.
-
8/12/2019 OCR F453 - Addressing Modes
7/7
Base register addressing
This is the same as indexed addressing, except the start
address is held in a base register.
It uses a larger offset than index addressing.
The contents of this register rarely change during the execution
of the program (unlike index addressing).