Program to print hollow square in assembly 8086:
; 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
num dw 8
temp dw ?
nw db 0Ah,0Dh,'$'
space dw 0h
.code
mov cx,num
mov temp,cx
mov bx,num
sub cx,2
mov num,cx
xor cx,cx
mov cx,bx
mov space,bx
sub bx,2
mov space,bx
xor bx,bx
for:
mov ah,2
mov dl,"*"
int 21h
loop for
cmp bx,num
je exit
jmp newline
newline:
lea dx,nw
mov ah,9
int 21h
cmp bx,space
mov cx,temp
je for
for1:
mov ah,2
mov dl,"*"
int 21h
mov cx,space
space1:
mov dl,' '
mov ah,2
int 21h
loop space1
mov ah,2
mov dl,"*"
int 21h
inc bx
jmp newline
exit:
mov ah,4ch
int 21h
ret
Comments
Post a Comment