Register-Memory

 

Code Example: To store the sum of memory variables A and B

into location C of memory:

 

Load R1,A ;copy A from memory into register R1.

Add R1,B ;add B from memory to register R1.

Store C,R1 ;store register R1 into memory location C.

Benefits: Instruction format is easy to encode and has good

density. Memory data can be accessed without extra load

instructions.

Disadvantages: An arithmetic result overwrites a source operand.

Long memory address may only allow a short register

field so number of registers may be restricted. Wasted time and/or

space when source address is another register.