Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program code(assembly language) to calculate the following equation by using below commands. And compare the length of the program code(assembly language). X =

Write a program code(assembly language) to calculate the following equation by using below commands. And compare the length of the program code(assembly language).

X = (A + B) / ( (D - (E * F) ) + (G * H) )

ADD : Addition, SUB : subtraction, MUL : Multiplication, DIV : Division, MOV : Move data, LOAD : Load data, STOR : Store data

ex )

X = (A + B) x (C - D)

1-address instuction

LOAD A ; AC <-M[A]

ADD B ; AC <-AC + M[B]

STOR T ; M[T] <-AC

LOAD C ; AC <-M[C]

SUB D ; AC <-AC -M[D]

MUL T ; AC <-AC M[T]

STOR X ; M[X] <-AC

length of program code : 7

----------------------------------------------------------------------------

2-address instuction

MOV R1, A ; R1 <-M[A]

ADD R1, B ; R1 <-R1 + M[B]

MOV R2, C ; R2 <-M[C]

SUB R2, D ; R2 <-R2 -M[D]

MUL R1, R2 ; R1 <-R1 R2

MOV X, R1 ; M[X] <-R1

length of program code : 6

----------------------------------------------------------------------------

3-address instuction

ADD R1, A, B ; R1 <-M[A] + M[B]

SUB R2, C, D ; R2 <-M[C] -M[D]

MUL X, R1, R2 ; M[X] <-R1 R2

length of program code : 3

Q1. what is 1 Address instruction :

Q2. what is 2 Address instruction :

Q3. what is 3 Address instruction :

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_2

Step: 3

blur-text-image_3

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

define the term outplacement

Answered: 1 week ago