[su_box title=”Diamond Print” style=”bubbles” box_color=”#1d318d”]

; You may customize this and other start-up templates;
; The location of this template is c:emu8086inc_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

[/su_box]

Table of Contents

OutPut Screen:

Diamond Print in Assembly Language

 

Find More Assembly Codes Here!

1 COMMENT