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

Assembly Programs

Uploaded by

Dhruti Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Assembly Programs

Uploaded by

Dhruti Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Practical - 1 Write an assembly language program to swap the content stored at

memory location 2000 and 2001.


Code:
LDA 2000
MOV B,A
LDA 2001
STA 2000
MOV A,B
STA 2001;
Hlt

Memory before execute code:

Output:
Memory after execution of code:

Practical – 2 Write an assembly language program to add two numbers stored


at location 100 and 101, store the result at memory location 200.
Code:
LDA 100
MOV B,A
LDA 101
ADD B
STA 200
HLT

Input:

1|Page Patel Sneh – 23C21534


Output:

Practical – 3 Write an assembly level program to perform subtraction using 2’s


complement.
Code:
LDA 301
CMA
INR A
MOV B,A
LDA 300
ADD B
STA 302
HLT
Output:

Practical – 4 Write an assembly level program to perform addition of 10 natural


numbers.
Code:
LXI H, 100
MVI B, 0
MVI C, 10

ADD_LOOP: MOV A, M
ADD B
MOV B, A
INX H
DCR C
JNZ ADD_LOOP
STA 111

2|Page Patel Sneh – 23C21534


HLT
Output:

Practical – 5 Write an assembly level program to perform addition, subtraction


and multiplication using subroutine.
Code:
;<Add,Sub,Mul using subroutine>

LDA 2050
CALL Add
MVI C,00
LDA 2051
CALL Sub
LXI H,2058;
CALL Mul
HLT

Add: MOV B,A


LDA 2051
ADD B
STA 2052
RET ;

3|Page Patel Sneh – 23C21534


Sub: MOV B,A
LDA 2050
SUB B
JNC LOOP
CMA
INR A
INR C
LOOP: STA 2054
MOV A,C
STA 2055
RET ;

Mul: MOV B,M


MVI A,00
MOV C,A
INX H
cont: ADD M
JNC skip
INR C
skip: DCR B
JNZ cont
STA 2060
MOV A,C
STA 2061
RET ;

Output:

4|Page Patel Sneh – 23C21534

You might also like