Preview

12 - Addressing Modes

 1. You might notice that some instructions use a # and others don't. # = number and [no hash] = address

  True

  False

 2. The following code would load the number 10 into the accumulator, then adds the number 12, and then…
LOAD #10
ADD #12
STORE 12

  stores 10 and 12 in the addresses 10 and 12

  stores the result 22 into memory location 12

  adds 22 to 12

  stores the result 22 into memory location 22

 3. What is the difference between direct and immediate addressing?

  In immediate addressing the operand is the actual value we want.

  All of the above statements are true

  The address used in a direct address points to where the required data is stored

  The address in an indirect address points to a memory location

 4. What does the following assembly language code do?
LDR r1, 0
Loop CMP r1, #10
 BNE
 ADD r1, #1
 B (Loop)

  None of the above

  Creates a counter from 0 to 10 and then halts

  Creates a loop that prints A ..B…C

  Creates a program that adds two numbers and then asks for two more inputs

 5. Four different types of addressing are listed as follows. What is indirect addressing?
Direct Addressing
Indirect Addressing
Immediate Addressing
Index Addressing Relative Addressing

  Indirect addressing is where the operand is the address of the data we want

  It is where the operand is always zero (hence, indirect)

  It is where the operand is the data itself

  None of the above

 6. In index addressing, the address given is the base address. This is then added to the value in the index register

  TRUE

  FALSE

 7. Immediate addressing means that the data has to be hard coded into the instruction itself.

  TRUE

  FALSE

 8. Assuming ADC was the accumulator, the instruction to add 2 to the accumulator would be ADC 2

  TRUE

  FALSE

 9. Relative addressing is when a small ___________is added to the current address in the program counter.

  bit

  ASCII code

  offset

  Hex code

 10. What is the result (fill in the ?) when the following code (note there are no hash tags) is executed?
LOAD 10
ADD 12
STORE 12

Address	Contents
=================
10	9
11	2
12	7
13	10
14	12

After executing the code

Address	Contents
=================
10	9
11	2
12	__?
13	10
14	12

  22

  16

  12

  11

 11. A multi-core processor is an example of MIMD computing
Note: In computing, MIMD (multiple instruction, multiple data) is a technique employed to achieve parallelism

  True

  False

 12. What is the result when the following code is executed?
For the following memory space, what would it look 
like after executing the assembly code below:

Address	Contents
=================
10	1
11	4
12	4
13	100
14	5

LOAD 14
ADD #12
STORE 12

  The contents for address '12' will have 17 in it, instead of '4'

  The contents for address '12' will have 26 in it instead of '4'

  The contents for address '12' will have '38' in it, instead of '4'

  The contents for address 14 will have 22 instead of '4'

 13. What goes in address 214?
For the following memory space, what would it look like after 
executing the assembly code below:

Address	Contents
================
211	6
212	3
213	78
214	21

LOAD #100
STORE 213
LOAD 214
ADD 213
STORE 214

Answer>>
========
Address	Contents
211	6
212	3
213	100
214	???

  214

  121

  78

  178

 14. Write some assembly code to do the following: 34 + 35 and store in memory location 100

  LOAD 34, ADD 35, STORE 100

  LOAD 34, ADD #35, STORE #100

  LOAD #34, ADD #35, STORE 100

  LOAD 34, ADD 35, STORE #100

 15. Relative addressing means that the next instruction to be carried out is an offset number of locations away, relative to the address of the current instruction.

  FALSE

  TRUE

 16. Indexed addressing means that the final address for the data is determined by adding an offset to a base address. Fill in the blanks
The array has a 'base address' which is the location of the first element, 
then an ___________in order to fetch any other element within the array.

   'index' is used that adds an offset to the base address

  None of these options are valid

  0 or 1 is used

  'and' gate is used which serves to route bits correctly

 17. How does a programmer access the subroutines within the library if he does not know the starting address of each routine

  immediate addressing

  direct addressing

  indexed addressing

  indirect addressing

 18. The advantage of direct addressing is that it is fast (but not as fast as immediate addressing)

  FALSE

  TRUE

 19. You could use direct addressing on computers that are only running a single program.
 For example an engine management computer only ever runs the code the car engineers programmed into it, and so direct memory addressing is excellent for fast memory access.

  TRUE

  FALSE

 20. Instructions and data are located in memory by using addressing modes.

  FALSE

  TRUE

 21. Immediate and direct addressing are basically the same thing.

  FALSE

  TRUE

 22. In ___________ addressing the data in the operand is fixed - i.e it is immediately available for use.

  indexed

  immediate

  direct

  None of the above

 23. In ____________ addressing the code is directly referred to a memory location.

  immediate

  direct

  indexed

  None of the above

 24. _________ addressing is also called absolute addressing.

  None of the above

  indexed

  direct

  immediate

 25. The following example: ADD (1302) which adds the contents of memory location (1302) to the accumulator is an example of:

  direct

  indexed

  immediate

  None of the above

 26. The following example ADD 12 (adding 12 to the accumulator) is an example of:

  None of the above

  direct

  indexed

  immediate

 27. This disadvantage of ???????..is that the code cannot be relocated; therefore it is typically used on single-program systems (e.g. car engine fuel control system)

  direct

  indexed

  immediate

  None of the above

 28. The term addressing modes refers to the way in which the operand of an instruction is specified.

  FALSE

  TRUE

 29. Immediate addressing is useful in accessing static data. (preferred over Direct addressing)

  FALSE

  TRUE

 30. The effective address is a term that describes the address of an _________ that is stored in memory.

  opcode

  operand

  value

  variable