0% found this document useful (0 votes)
35 views

Assembly Language Programs

The document contains 6 assembly language programming problems: 1) Write a program to subtract two double precision numbers. 2) Write a program to multiply two positive numbers. 3) Write a program to swap two numbers using a temporary variable. 4) Write a program to logically OR two numbers without using the OR instruction. 5) Write a program to multiply two positive numbers using repeated addition. 6) Write a program which uses the service of an interrupt.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Assembly Language Programs

The document contains 6 assembly language programming problems: 1) Write a program to subtract two double precision numbers. 2) Write a program to multiply two positive numbers. 3) Write a program to swap two numbers using a temporary variable. 4) Write a program to logically OR two numbers without using the OR instruction. 5) Write a program to multiply two positive numbers using repeated addition. 6) Write a program which uses the service of an interrupt.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1)Write an assembly language program to subtract two double precision

numbers.

2)Write an assembly language program to multiply two positive numbers


 Write an ALP for swapping two numbers.

ORG 100
LDA A
STA TMP
LDA B
STA A
LDA TMP
STA B
HLT
A, DEC 3
B, DEC 4
TMP, DEC 0
END
4) Write the program to logically OR the two numbers without using “OR”
instruction.

/Origin of program is HEX


1 ORG 100 100
2 LDA A /Load first operand
3 CMA /Complement A
4 STA AD /Store at AD
5 LDA B /Load second operand
6 CMA /Complement B
7 AND AD /And A and B
8 CMA /Complement the result
9 STA RES /Store the result
10 HLT /Halt
11 A, DEC 5 /First operand
/This location reserved A
12 AD, HEX 0 complement
13 B, DEC 4 /Second operand
/This location reserved for
14 RES, HEX 0 Result
15 END /End of symbolic program
5) Write the program to multiply two positive numbers by a repeated addition
method. For ex., to multiply 5 x 4, the program evaluates the product by adding
5 four times, or 5+5+5+5
/Origin of program is HEX
1 ORG 100 100
/Load first address of
2 LDA X operands
3 STA PTR /Store in pointer
/Load minus second
4 LDA NBR operand
5 STA Y /Store in counter
6 CLA /Clear accumulator
7 LOP, ADD PTR I /Add an operand to AC
8 ISZ Y /Increment counter
9 BUN LOP /Repeat loop again
10 STA MUL /Store sum
11 HLT /Halt
12 X, DEC 5 /First operand
/This location reserved for a
13 PTR, HEX 0 pointer
14 NBR, DEC -4 /Second operand
/This location reserved for
16 CTR, HEX 0 a counter
MUL
17 , HEX 0 /Sum is stored here
18 END /End of symbolic program
6) Write a program which uses the service of an interrupt

You might also like