Hollow Triangle

org 100h

; add your code here
.data
space db ” $”
exspc dw 8
inspc dw -1
row db 8
line db 0dh,0ah,”$”
.code

body:
mov cx,exspc ;printing external spaces
outer_space:
mov ah,2
mov dl,space
int 21h
loop outer_space

mov ah,2
mov dl,’*’
int 21h

cmp row,8
je else:
mov cx,inspc ;printing internal spaces
inner_space:
mov ah,2
mov dl,space
int 21h
loop inner_space

mov ah,2
mov dl,’*’
int 21h

else:
mov ah,9 ;line feed
lea dx,line
int 21h

cmp row,1
je full
jne one
full:
mov cx,17
print:
mov ah,2
mov dl,’*’
int 21h
loop print
jmp finish
one:

inc inspc
inc inspc
dec exspc
dec row

jmp body
finish:
ret

 

OutPut Screen:

 

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.