0% found this document useful (0 votes)
9 views5 pages

Assembly program algorithms - questions

The document outlines assembly programs for four different algorithms involving variables X, Y, and Z stored in specified memory locations. Each question presents a conditional structure that determines the computation of Z based on the values of X and Y, with corresponding assembly instructions for execution. The algorithms include operations such as squaring, multiplication, addition, and conditional jumps based on comparisons of the variables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views5 pages

Assembly program algorithms - questions

The document outlines assembly programs for four different algorithms involving variables X, Y, and Z stored in specified memory locations. Each question presents a conditional structure that determines the computation of Z based on the values of X and Y, with corresponding assembly instructions for execution. The algorithms include operations such as squaring, multiplication, addition, and conditional jumps based on comparisons of the variables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Write Assembly programs for the following algorithms.

Assume that X, Y, Z are


stored from 20, 21 and 22 memory locations.

Question 01

Start

If F
Z = X 2 – Y2
X== 0

T
Z=X

20 X
21 Y
22 Z
End
23

Memory Assembly Ins Acc


Address
40 LDA (20) X
41 JM0 (50) X=0
42 LDA (21) Y
43 MUL (21) Y2
44 STA (23) Y2
45 LDA (20) X
46 MUL (20) X2
47 SUB (23) X 2 – Y2
48 STA (22) X 2 – Y2
49 JMP (52) --
50 LDA (20) X
51 STA (22) X
52 HLT ----- --
Question 02

Start

If F
Z = 2X2 + Y
X == Y

Z=0

End

Memory Assembly Ins Acc


Address
70 LDA (20) X
71 SUB (21) X-Y
72 JM0 (79) X – Y == 0
73 LDA (20) X
74 ADA (20) 2X
75 MUL (20) 2X2
76 ADA (21) 2X2 + Y
77 STA (22) 2X2 + Y
78 JMP (80) --
79 STA (22)
80 HLT ---
81
82
Memory Assembly Ins Acc
Address
70 LDA (20) X
71 SUB (21) X-Y
72 JM0 (77) X – Y == 0
73 LDA (20) X
74 ADA (20) 2X
75 MUL (20) 2X2
76 ADA (21) 2X2 + Y
77 STA (22) 2X2 + Y
78 HLT --- --
79
80
81
82

Question 03

Start

F
2X2 < Y3 Z = X– 2Y

Z = 2X + Y

End

Memory Assembly Ins Acc


Address
50 LDA (21) Y
51 MUL (21) Y2
52 MUL (21) Y3
53 STA (23) Y3
54 LDA (20) X
55 ADA (20) 2X
56 MUL (20) 2X2
57 SUB (23) 2X2 – Y3
58 JMN (64) 2X2 – Y3 < 0
59 LDA (20) X
60 SUB (21) X-Y
61 SUB (21) X – 2Y
62 STA (22) X – 2Y
63 JMP (68) --
64 LDA (20) X
65 ADA (20) 2X
66 ADA (21) 2X + Y
67 STA (22) 2X + Y
68 HLT ---- --

Question 04

Start

F
Y3 > X3 + 2Y Z = Y3

Z = 2X2 / 2Y

End

Memory Assembly Ins Acc


Address
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy