Diamond Print

; You may customize this and other start-up templates;
; The location of this template is c:\emu8086\inc\0_com_template.txt

org 100h

.data

n dw 5 ;number of lines of stars

s dw 13
str dw 1
res dw 0

.code
mov ax,n
mov bx,2
div bx ;ax/bx
mov res,ax

; 1st Part:

mov cx,res

outer:
mov bx,cx
mov cx,s

spaces:
mov dl,32
mov ah,2
int 21h
loop spaces

sub s,1

mov cx,str

stars:
mov dl,’*’
mov ah,2
int 21h
loop stars

add str,2

mov dl,0ah
mov ah,2
int 21h

mov dl,0dh
mov ah,2
int 21h

mov cx,bx
loop outer

; 2nd Part:

add res,1
mov cx,res

outer1:
mov bx,cx
mov cx,s

spaces1:
mov dl,32
mov ah,2
int 21h
loop spaces1
add s,1
mov cx,str

stars1:
mov dl,’*’
mov ah,2
int 21h
loop stars1

sub str,2

mov dl,0ah
mov ah,2
int 21h

mov dl,0dh
mov ah,2
int 21h

mov cx,bx
loop outer1

ret
ret

ret

OutPut Screen:

Diamond Print in Assembly Language

 

Find More Assembly Codes Here!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.