0% found this document useful (0 votes)
472 views3 pages

Q3:-Print Diamond Shape in Assembly?

This program prints a diamond shape pattern in assembly language. It uses two nested loops to print 7 lines, with the middle line containing the most asterisks and each preceding and following line containing fewer. It initializes variables to store the number of spaces and asterisks to print on each line. On each iteration of the loops, it outputs the appropriate number of spaces, then asterisks, before moving to the next line.

Uploaded by

Homi Malik
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)
472 views3 pages

Q3:-Print Diamond Shape in Assembly?

This program prints a diamond shape pattern in assembly language. It uses two nested loops to print 7 lines, with the middle line containing the most asterisks and each preceding and following line containing fewer. It initializes variables to store the number of spaces and asterisks to print on each line. On each iteration of the loops, it outputs the appropriate number of spaces, then asterisks, before moving to the next line.

Uploaded by

Homi Malik
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/ 3

Q3:-

Print diamond shape in assembly?


;Title:Diamond pattern
org 100h
.model small
.data
space dw 11
star dw 1
space1 dw 5
star1 dw 13

.code
main proc
mov cx,7
outer:
mov bx,cx ;store

mov cx,space

k:
mov dl,32
mov ah,02
int 21h

loop k
dec space
mov cx,star
l:
mov dl,'*' ;3;5;7
mov ah,02
int 21h
loop l
inc star ;add space,2
inc star

mov dl,0Ah
mov ah,02
int 21h
mov dl,0Dh
mov ah,02
int 21h

mov cx,bx

loop outer
mov cx,7
outer1:
mov bx,cx ;store

mov cx,space1

j:
mov dl,32
mov ah,02
int 21h
loop j
inc space1
mov cx,star1
s:
mov dl,'*' ;3;5;7
mov ah,02
int 21h
loop s
dec star1 ;add space,2
dec star1

mov dl,0Ah
mov ah,02
int 21h
mov dl,0Dh
mov ah,02
int 21h

mov cx,bx

loop outer1:

ret
end main
endp

You might also like