You are on page 1of 7

1.Write a program to print ‘*’ 100 times using linefeed and carriage return.

CODE:
.model small mov cx, 100
.stack 100h callme:
newline macro mov dl, '*'
mov dl, 13 mov ah, 02
mov ah, 02 int 21h
int 21h newline
mov dl, 10 loop callme
mov ah, 02 mov ah, 4ch
int 21h int 21h
endm main endp
.code end main
main proc
OUTPUT:

2.Write a program to print ASCII characters from A-Z and Z-A

CODE:
.model small main proc
.stack 100h mov cx, 26
.code mov dl, 65
newline macro abc:
mov dl, 10 mov ah, 02
mov ah, 02 int 21h
int 21h inc dl
mov dl, 13 loop abc
mov ah, 02 newline
int 21h mov cx, 26
endm mov dl, 90
za: loop za
mov ah, 02 mov ah,4ch
int 21h int 21h
dec dl main end
OUTPUT:

3.Write a program to print ASCII characters from a-z and z-a

CODE:
.model small int 21h
.stack 100h inc dl
.code loop abc
newline macro newline
mov dl, 10 mov cx, 26
mov ah, 02 mov dl, 122
int 21h za:
mov dl, 13 mov ah, 02
mov ah, 02 int 21h
int 21h dec dl
endm loop za
main proc mov ah,4ch
mov cx, 26 int 21h
mov dl, 97 main endp
abc: end main
mov ah, 02
OUTPUT:
4.Write a program to print from 0-9 and 9-0

CODE:
.model small int 21h
.stack 100h inc dl
.code loop abc
newline macro newline
mov dl, 10 mov cx, 10
mov ah, 02 mov dl, 57
int 21h za:
mov dl, 13 mov ah, 02
mov ah, 02 int 21h
int 21h dec dl
endm loop za
main proc mov ah,4ch
mov cx, 10 int 21h
mov dl, 48 main endp
abc: end main
mov ah, 02

OUTPUT:
5.Write a program to print ASCII characters.

CODE:
.model small mov cx, 127
.stack 100h mov dl, 0
.code abc:
newline macro mov ah, 02
mov dl, 10 int 21h
mov ah, 02 inc dl
int 21h loop abc
mov dl, 13 mov ah,4ch
mov ah, 02 int 21h
int 21h main endp
endm end main
main proc

OUTPUT:

6.Write a program to print your name 10 times using linefeed and carriage return.

CODE:
.model small mov dl, 13
.stack 100h mov ah, 02
.data int 21h
myname db "AHSAN ALI KHAN$" endm
.code main proc
newline macro mov ax, @data
mov dl, 10 mov ds, ax
mov ah, 02 mov cx, 10
int 21h abc:
mov dx, offset myname mov ah,4ch
mov ah, 09 int 21h
int 21h main endp
newline end main
loop abc
OUTPUT:

7.Write a program that take two integers as input and display sum of the integers. Output will look like
as follows:
Input First Integer: 3
Input Second Integer: 2
Sum of Integers: 5
CODE:
.model small endm
.stack 100h newline macro
.data mov dl, 10
msg1 db "Input First Integer: $" mov ah, 02
msg2 db "Input Second Integer: $" int 21h
msg3 db "Sum of Integers: $" mov dl, 13
.code mov ah,02
frap macro p int 21h
mov ax, @data endm
mov ds, ax main proc
mov dx, offset p frap msg1
mov ah, 9 mov ah, 01
int 21h int 21h
sub al, 30h newline
mov bl, al frap msg3
newline mov dl, bl
frap msg2 mov ah, 2
mov ah, 01 int 21h
int 21h mov ah, 4ch
sub al, 30h int 21h
add bl, al main endp
add bl, 30h end main
OUTPUT:

You might also like