Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 4. Explain using an example how a simple assembly language program is executed. The example given below illustrates/draw the execution of a simple code.

Question 4.

Explain using an example how a simple assembly language program is executed.

The example given below illustrates/draw the execution of a simple code.

You need to add two numbers that are in memory locations FF0 and FF1, and finally store the result in memory location FF2.

To perform the addition following operations have to be accomplished.

  1. Contents of memory location FF0 has to be loaded into accumulator. Let us assume that 5 is present in FF0.
  2. Contents of memory location FF1 have to be read and should be added to value in accumulator. Result of the addition should be stored back in accumulator. Let us assume that 7 is present in FF1. So, 5 and 7 have to be added and the result should be stored in accumulator.
  3. The result of the addition which is stored in accumulator must be written into memory location FF2. In this example, result of addition (12) have to be written into memory location FF2.

The assembly language program is as follows:

1st Instruction LDA FF0:

The contents in memory location FF0 are loaded into accumulator. After the

instruction is executed accumulator stores value 5.

2nd Instruction ADD FF1:

The contents in memory location FF1 is added to accumulator. The final result is stored in accumulator. So 5+7 addition is performed and result 12 is stored in accumulator.

3rd Instruction STA FF2:

This instruction stores the contents of accumulator in memory location FF2.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions