Print Hollow Triangle – Assembly Language Code

0

[su_box title=”Hollow Triangle” style=”bubbles” box_color=”#1d318d”]

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

[/su_box]

Table of Contents

OutPut Screen:

Find More Assembly Codes Here!

Leave A Reply