Memory Reference Instructions

Table of Content

·         Memory Reference Instructions: An Introduction

·         What do you get by a Memory Reference?

·         What are recognized to be Memory Reference Instructions?

o               LDA

o               STA

o            AND

o           ADD

o           BUN

o            BSA

o           ISZ

·         Why do we are in need of Memory Reference Instructions?

·         Example of Memory Reference Instructions

·         What do you mean by Instruction Cycle?

·         What is an Instruction Format?

·         Conclusion

·         More Readings


1. Introduction of Memory Reference Instructions

There can be a far better acknowledgment that a computer dwells of both software and hardware. All that need is to bringing in them synchronize with each other and expending computer programs, constructing the hardware to do the task and that is an authentic dispute. At the instant, let us converse about some chores that are executed by machines while taught by software programs. A stepper motor spreads out at an exacting time intervals.

So, why are we discoursing of all these examples and how are these concerned with the memory reference instruction? All right, by means of applying assembly language, we can carry out the above-mentioned tasks.

As per an assembly language, memory reference instructions are known to be one among the most vital and extensively used instructions in approximately every assembly programs. Consequently, let us talk concerning the memory reference instructions in computer architecture and that too in a thorough manner.

Memory Reference

2. What is a Memory Reference?

Memory Reference has in mind as to when there is a call for to contact data from a file or an evidence laid in a computer or in some storage device approximating hard disk, a reference to the memory is arrived at in order to entrée that data and that reference is known to be a “value” that appropriates a program to way in the commanded data. A memory reference is handled by the commands scripted by the programmer. So, what are those commands? Let us get a look below.

3. What are Memory Reference Instructions?

Memory reference instructions are those commands or instructions which are in the habit to construct a reference to the memory and consent to a program to have an access to the commanded data and that states as to from where the data is stashed away. It becomes very much necessary to make out that an instruction comprises of an operand and operand code is that which delimitates the data that is to be functioned or misrepresented.

An address is too an instruction part if it is very well expended in direct addressing mode and this address very well exemplifies the position of the value in the memory. There stay 7 memory reference instructions as mentioned below.

·         LDA

·         STA

·         AND

·         ADD

·         BUN

·         BSA

·         ISZ

For the memory reference instructions, you can very well measure up to the below flow chart with the figure below that constitutes the step by step operations executed to carry out each of these instructions and that too in the most proper manner.

Flow Chart for Memory Reference

Flowchart For Memory Reference Reference Instructions

a) LDA

LDA // this instruction gets utilized so as to stack the Accumulator with a worth that gets turned up at an explicit memory location. In addition to this, the approved practice of this command is when we write in an assembly language and is as follows:

Example of LDA 2500 H

This command articulates that load the value that is put in at the memory location 2500 into the accumulator. H constitutes that an enrolled address is a hexadecimal memory address. So, when a value gets salted away in the accumulator, further operations are executed as needed by the user on that particular value. Moreover, the changes ready to the value stored in the accumulator are modified in regular time intervals. In surplus, this instruction comes under direct addressing mode that is the address or memory location of the operand and is written in the instruction itself.

Opcode           Operand                                                                     Description

LDA               16 bit address                                                             Load the accumulator

b) STA

STA  //this instruction is accurately opposite to the exceeding one as this memory reference instruction stores the value that is at hand in the accumulator into a precise memory address that chipped into the instruction.

Example of STA 2600 H

This respective command pronounces that store the value that is put in the accumulator to the memory location 2600. When the accumulator is to be attributed with a new-fangled value and the present value is to be remitted to some memory location, this instruction is utilized. In excess, this instruction also comes under direct addressing mode.

Opcode           Operand                                 Description

STA                16 bit address                         Store accumulator direct

c) AND

AND //this instruction executes AND operation on the values laid in an accumulator and memory location and the outcome is put in the accumulator that is the preceding value in the accumulator and is informed with this new result. In assembly language, this instruction is not written as AND but is victimized as written in the example below:

Example of ANA M //don’t confuse, AND is written as ANA but not AND.

This command enounces that to perform logical AND operation on the value stored in an accumulator and at the memory location defined by M as an operand. At this point, in the above example, the rightmost A in ANA represents accumulator and M stands for memory location exemplified with H-L pair. Examine the below table.







Logical AND with register or memory with accumulator

d) ADD

ADD //this instruction executes an arithmetic operation on the values stored in the accumulator and memory location. The follow-on after the addition is put in the accumulator by substituting the older value. Not only this, the instruction is written as below in order to carry out addition on two values.

Example of  ADD B

This respective command executes contributes the value stored in the accumulator with value at memory location defines by B as an operand. The operand can be a letter that makes up the memory location of the value. At this point, it is taken as B. There is a range of types of additions which are hashed out below.






Put in register or memory to accumulator


Other additions and their examples that can be executed using this instruction are as follows:

ADC M  //this instruction executes addition with carrying by adding up the values in accumulator and memory location defined by M as an operand.

ADI 45 H // this instruction utter to add instant the value stored in the accumulator with the 8-bit data.

ACI 45 H //this instruction says that add immediate the length of with carrying.

DAD B   // If we want to make a hexadecimal addition, we use this instruction. This instruction performs addition of the 16-bit value in the register pair with the value in H-L pair.

e) BUN

BUN  // BUN stands for branch unconditionally and this instruction bears in mind for one to decide on an instruction from a program and contributes him to have an admittance to revise the program as he needs to. Example of how to write this instruction in programs is as follows:

Example of D4T4: PC <- AR, SC <- 0 //Observe the below table to comprehend the functionality of BUN instruction.

Opcode           Operand                                 Description

BUN 16-bit address                         Branch unconditionally

f) BSA

BSA // BSA instruction in computer architecture holds still for branch and save return address which has in mind that it executes two functions. Branching intends the instruction is currently being carried out and may have subroutines or procedures inside it and giving back the address in the sense that it entrepots the address of the instruction which should be performed right away after it and is stashed away as the program counter.

Example of  D5T4 : M[AR] <- PC, AR <- AR + 1 // increases the value of address register (AR) and returns the value of the program counter

D5T5 : PC <- AR, SC <- 0

Opcode           Operand                     Description

BSA                16 bit address             Branch and save the return address

Difference between branch unconditionally and branch and save return address:

Difference between a bun and be is that in a BUN, unconditional branching and no saving of address but countenances program alteration while in BSA, Branching and saving the delivered address but no program modification is bored in mind.

g) ISZ

ISZ //ISZ stands for Increment and skip if zero and this instruction is expended for incrementing the worth at the precise address and if the worth at that address is detected to be zero, then this instruction constructs the program counter gets incremented by 1.

Example of D6T4: DR <- M[AR] // by attributing the memory location applied by address register to data register.

D6T5: DR <- DR + 1  //increments the value of data register.

D6T4: M[AR] <- DR (if  DR = 0, then PC = PC+1 and SC=0)  //incremented address in data register is now attributed back to address register.

Opcode           Operand                     Description

ISZ                  16 bit address             Increment and skip if zero

Take a look at the following table to be acquainted with the instructions and their symbolic explanation.


Operation Decoder

Symbolic Description



AC  ←  AC  /\  M[AR]



AC  ←  AC + M[AR] →, E ← Cout



AC  ←  M[AR]



M[AR]  ←  AC



PC  ← AR



M[AR] ←  PC , PC ← AR + 1



M[AR] ←  M[AR] + 1,

if M[AR]   + 1 = 0 then PC ← PC + 1

4. Why do we need Memory Reference Instructions?

For the sake of carrying out a definite task, we necessitate the instructions to be carried out and for an impermanent or permanent purpose, they need to be stored and called up from a memory location either registers or accumulators. Thus, to perform these memories associated tasks that are storing, retrieval of values from accumulator and registers is managed by these memory reference instructions.


How do we implement memory reference instructions?


If one is found enthusiastic to inscribe for these instructions and endeavor out new tasks to perform, he/she need to be excellent in assembly language. An uncomplicated accomplishment of this assembly language code is that we can turn around a stepper motor utilizing these instructions which are depicted in the section below.

5. Example of Memory Reference Instructions

Let us obtain an example of the stepper motor which can be circumvolved using a piece of code in assembly language which is given below:

Example on Memory Reference Instructions

OUT 20, AL
CALL 2000  // Used to make a postponement in rotation of the rotor.
OUT 20, AL 
CALL 2000
OUT 20, AL
CALL 2000
OUT 20, AL
CALL 2000
JMP 1004  //This can be seen that an instruction assists the whole code run endlessly time and time again by climbing up to the preliminary memory location.
HLT           //This dismisses the program.

6. What do you mean by Instruction Cycle?

Instruction Cycle is the process compiled by the computer which necessitates in what way it recovers an instruction and what does the instruction intended to do and accomplish that exacting work. It can also be aforementioned that the fundamental process of a computer is to execute a range of operations.

Instruction Cycle

 7. What is the Instruction Format?

This is recognized to be a specific format wherein which an instruction complies is experienced as an instruction format. For example, an instruction comprises opcode and operand just as the instructions we have collected the above section

15             14                                 12   11






The above format is used by the16 bit instructions in which first 12 bits are of address or operand and next three bits are of opcode and the last bit is to classify the addressing mode.

If I=0, direct addressing mode

Else if I=1, indirect addressing mode.

Memory Reference and Register Reference Instructions:

In Memory Reference Instruction format, seven 3 bit opcodes are accompanied by the 12-bit memory address of the operand while in the register reference format 0111 is followed by the 12-bit memory address.

Memory Reference and Register Reference Instructions

8. Conclusion Memory Reference Instructions in computer organization and intend are very imperative to put into practice cautiously since if not properly used, they may result in the whole program in a conflict of memory locations and may not provide you with the necessitated amount produced.


If you need more help in memory-reference-instructions

Click here

Become an Online Tutor