So I am running and creating this program for homework where I input a couple of chars where I then compare it to 7 and keep count of how many 7s have been input until the # sign ends the program. For some reason, I somehow get stuck in this infinite loop. I feel like my logic is okay, but I simply do not understand what is causing it to be stuck in an infinite loop.
main: LDX 0, i ;load 0 to acc
STX charCoun, d ;store 0 to charcount
while: CHARI charIn, d ;get char input
LDA charIn, d ;load input to acc
CPA 35, i ;compare to char #
BREQ endWhile ;if it equals to # branch to end while
CPA 55, i ;compare to char 7
BREQ count7 ;branch to count 7 if equal to char 7
BR while ;otherwise loop