Addressing Modes 1 Immediate n 2 Register Direct

  • Slides: 6
Download presentation
Addressing Modes 1. Immediate n 2. Register Direct n n 3. #<data> or Imm

Addressing Modes 1. Immediate n 2. Register Direct n n 3. #<data> or Imm data is part of the instruction data is in a register the register number is part of the instruction Memory Direct n n Dn or An (xxx). W or (xxx). L data is in a memory location the address of the memory location is part of the instruction

Addressing Modes 4. Address Register Indirect (An) operand is written as (An) n the

Addressing Modes 4. Address Register Indirect (An) operand is written as (An) n the address of the data is in the address register n instruction n <ea> = (An) registers memory

Indirect Addressing n … initializing An to load an address into an address register

Indirect Addressing n … initializing An to load an address into an address register 1. 2. the following will not work: MOVEA. L NUM, A 1 MOVE. L NUM, (A 1) n Assume: A 1 contains $3000, and ORG $600 NUM DC. L 2005

e. g. Write a program to count the number of 6’s in a list.

e. g. Write a program to count the number of 6’s in a list. The number of items in the list is provided. input: list_len = 20 list = 1, 6, 4, 5, 5, 6, 2, 5, 6, 7, 6, 6, 6, 1, 3, 5, 9, 6, 7, 5 output: algorithm:

e. g. Sum the numbers in an array given the length of the array.

e. g. Sum the numbers in an array given the length of the array. [To be added later: check if there is data and if sum is in range. ] input: array_l output: sum algorithm:

Expectations: n n you can use both the LEA and MOVEA techniques to correctly

Expectations: n n you can use both the LEA and MOVEA techniques to correctly initialize an address register for use with indirect addressing later, you can do the above initialization to traverse the list/array in either direction you can use indirect addressing correctly you can do operations on the data in a list, e. g. find min/max, count, arithmetic operations