My program is stuck in an infinite loop when I try to print out the'#'s. How it should work is the user will input 2, 5, 8 and it should print:
Each # represents 1
##
#####
########
But if the max value is over 80, and for example, the input was 82, 10, 2 the output would be:
Each # represents 2
#########################################
#####
#
This is the broken up portion:
include pcmac.inc
.MODEL SMALL
.586
.STACK 100h
.DATA
Val DW 6
Count DW 3
Array DW 2, 3, 6
DisplayCH DB 13, 10, 'Each # respresents ' , '$'
.CODE
extrn GetDec:near
extrn PutDec:near
PrintChar Proc
_begin
mov ax, @data
mov ds, ax
mov cx, 3
sub si, si
lea bx, Array
mov bx, offset Array
jcxz Ended
mov cx, 3
For1: mov dx, [bx +si]
mov Count, cx
add si, 2
_Putstr tested
While1: mov ax, 0
cmp ax, dx
je EndWhile1
mov Val, dx
_PutCh '#'
mov dx, Val
dec dx
;inc ax
jmp While1
EndWhile1:
;add si, 2
mov cx, Count
dec cx
jnz For1
Ended: _exit 0
PrintChar endp
end PrintChar