
jmp start
mess1 db 10,13, "Enter a value [0-9 only]: $"
mess2 db 10,13, "There is nothing to display $"
mess3 db 10,13, "Do you want to continue (y/n): $"
space db " $"
lincar db 10,13, "$"
value db 0
counter db 0
start:
xor ax,ax
xor bx,bx
xor cx,cx
mov ax,3
int 10h
lea dx,mess1
mov ah,9
int 21h
mov ah,1
int 21h
sub al,30h
cmp al,0
je zero_bridge
cmp al,0
jl start
cmp al,9
jg start
mov value,al
lea dx,lincar
mov ah,9
int 21h
mov ah,0
mov al,value
mov cx,ax
mov counter,1
mov bh,counter
mov bl,1
jmp display
zero_bridge:
call zero
display:
cmp bh,bl
jg next
mov dl,'*'
mov ah,2
int 21h
lea dx,space
mov ah,9
int 21h
inc bh
jmp display
next:
inc bl
mov bh,counter
lea dx,lincar
mov ah,9
int 21h
loop display
;-----------------------------------second half-------------------------------------
mov al,value
sub al,1
cmp al,0
je continue
mov ah,0
mov cx,ax
mov counter,1
mov bh,counter
mov bl,al
mov al,0
display2:
cmp bh,bl
jg next2
mov dl,'*'
mov ah,2
int 21h
lea dx,space
mov ah,9
int 21h
inc bh
jmp display2
next2:
dec bl
inc al
mov bh,counter
lea dx,lincar
mov ah,9
int 21h
loop display2
jmp continue
zero:
lea dx, mess2
mov ah,9
int 21h
continue:
xor dx,dx
lea dx,mess3
mov ah,9
int 21h
mov ah,1
int 21h
cmp al,'y'
je start_bridge
cmp al,'n'
je quit
jmp continue
start_bridge:
call start
quit:
int 20h
No comments:
Post a Comment