Write the SRC assembly language program to evaluate the following expression.

Vu Old Solved Programming Based Assignments Codes are Available in this Section.
Post Reply
User avatar
ALI RAZA
★★★★★★★★★★★★★
★★★★★★★★★★★★★
Posts: 177
Joined: Fri Dec 22, 2017 8:10 am
Location: Lahore
Has thanked: 6 times
Been thanked: 7 times
Contact:
Status: Offline

Write the SRC assembly language program to evaluate the following expression.

Post by ALI RAZA » Thu Dec 13, 2018 7:45 am

Q 1. Write the SRC assembly language program to evaluate the following expression.
X = 4(7+c) – 8*d + 64(21+e)
Where c=11, d=17 and e= 23
Note: X, c, d and e are memory labels

Solution:
Source program with Assembler directives


Code: Select all

.ORG	200		; start the next line at address 200
c:	DW	11      		
d:	DW	17      		
e:	DW	23      		
X:	DW	0

.ORG	400		; start the code at address 400
ld R1, c						
addi R2, R1, 7						
shl R3, R2, 2
ld R1, d
shl R2, R1, 3
sub R1, R3, R2
ld R2, e
addi R3, R2, 21
Shl R4, R3, 6 
add R3, R1, R4
st R3, X						




Post Reply

Last 10 Members Who Visited This Topic

User avatar ALI RAZA (3)

  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 1 guest