Generic Hollow Rectangle

; 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
A db 0
B db 0
L db ?
W db ?
C db 0ah
D db 0dh
str0 db ‘Donot Enter Less than 3’,0dh,0ah,’Enter width ‘,0Ah,0Dh,’$’
str1 db 0Ah,0Dh,’Enter length ‘,0Ah,0Dh,’$’
str2 db ‘*’

.code

;Enter Width No
lea dx,str0
mov ah,9
int 21h

;Taking Width
mov ah,1
int 21h
;Saving in ‘W’
mov W,al
sub W,48
;Enter length No
lea dx,str1
mov ah,9
int 21h

;Taking Length
mov ah,1
int 21h
;Saving in ‘L’
mov L,al
sub L,48
mov cl,W
;For Next Line
mov dl,c
mov ah,2
int 21h
mov dl,d
mov ah,2
int 21h

;For Line of *
;mov cx,5
label:
mov dx,’*’
mov ah,2
int 21h
loop label

;For * * Line
mov cl,L
sub cl,2
label1:
mov bx,cx

;For Next Line
mov dl,c
mov ah,2
int 21h
mov dl,d
mov ah,2
int 21h

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

mov cl,W
sub cl,2
label2:
mov dx,’ ‘
mov ah,2
int 21h
loop label2

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

mov cx,bx
loop label1

;For Next Line
mov dl,c
mov ah,2
int 21h
mov dl,d
mov ah,2
int 21h

mov cl,W
label4:
mov dx,’*’
mov ah,2
int 21h
loop label4

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.