Pattern
Pattern
model small
.stack 100h
.data
msg1 db 'Enter total number of UPPER rows: $'
msg2 db 'Star diamond below: $'
rCount db ?
rFinal db ?
.code
main proc
mov ax, @data
mov ds, ax
mov ah, 9
mov dl, offset msg1
int 21h
mov ah, 1
int 21h
sub al, 48
mov rFinal, al
mov ah, 9
mov dl, offset msg2
int 21h
;NEWLINE
mov ah, 2
mov dl, 13
int 21h
mov dl, 10
int 21h
;NEWLINE
mov ah, 2
mov dl, 13
int 21h
mov dl, 10
int 21h
;UPPER HALF
mov rCount, 0
;Pattern upper half design start
DesignUp:
mov cx, 0 ;to make CH = 0
mov dx, 0 ;to make DH = 0
inc rCount
;NEWLINE
mov ah, 2
mov dl, 13
int 21h
mov dl, 10
int 21h
;LOWER HALF
sub rFinal, 1 ;lower row = upper row - 1
mov rCount, 0
;Pattern lower half design start
DesignLow:
mov cx, 0 ;to make CH = 0
mov dx, 0 ;to make DH = 0
inc rCount
mov dl, 32
mov ah, 2
int 21h
loop spaceLow
breakSpaceLow:
;NEWLINE
mov ah, 2
mov dl, 13
int 21h
mov dl, 10
int 21h