title: Assembly comparing numbers
body: <p>I am using TASM MS-DOS to create a game where the user has to solve mathematical problems. I have managed to create a procedure that prints an exercise on the screen and lets the user type an answer. However, when I try to compare the user's answer and the correct answer, it always says that the user was wrong. Here is my code:</p>
  <pre><code>proc getInput
      
      READ:
      MOV AH, 1
      INT 21H
      
      CMP AL, 13
      JE ENDOFNUMBER
      
      MOV VALUE, AL
      SUB VALUE, 48
      
      MOV AL, [userAnswer]
      MOV BL, 10
      MUL BL
      
      ADD AL, VALUE
      
      MOV [userAnswer], AL
      
      JMP READ
  
      ENDOFNUMBER:   
  
      ret
  endp getInput
  
  proc Addition
  addition:
      call AddBreakLines
      call AddSpaces
      call generateBasicRandomNumber
      mov dl, [randomNumber]
      mov [basicRandomNumber1], dl  
      add  dl, '0'  
      mov ah, 2h  
      int 21h
      mov dx, offset plusSign
      call printStr
      push 1
      call sleep
      call generateBasicRandomNumber
      mov dl, [randomNumber]
      mov [basicRandomNumber2], dl
      add  dl, '0'  
      mov ah, 2h  
      int 21h
      push 1
      call sleep
      ;
      mov dl, [space]
      mov ah, 2h
      int 21h
      push 1
      call sleep
      mov dl, [equalSign]
      mov ah, 2h
      int 21h
      push 1
      call sleep
      mov dl, [space]
      mov ah, 2h
      int 21h
      ;
      call getInput
      mov al, [basicRandomNumber1]
      add al, [basicRandomNumber2]
      mov [result], al
      
      call CompareResultWithUserAnswer
      ;call CompareResultWithUserAnswer
      call printNewLine
      call printNewLine
      call printNewLine
      cmp [isCorrect], 0
      je INCORRECT_ADDITION
      CORRECT_ADDITION:
      mov dx, offset correctMsg
      mov ah, 09h
      int 21h
      jmp END_ADDITION_FUNCTION
      
      INCORRECT_ADDITION:
  
      mov dx, offset incorrectMsg
      mov ah, 09h
      int 21h
      END_ADDITION_FUNCTION:
      jmp END_ADDITION
      ret
  endp Addition
  
  proc CompareResultWithUserAnswer
      mov al, [userAnswer]
      cmp al, [result]
      jne NOT_CORRECT
      mov [isCorrect], 1
      jmp END_COMPARE
      NOT_CORRECT:
      mov [isCorrect], 0
      END_COMPARE:
      ret
  endp CompareResultWithUserAnswer
  
  proc generateBasicRandomNumber
       mov ax, 40h
       mov es, ax
       mov ax, [es:6Ch]
       and al, 00000111b
       mov [randomNumber], al
       ret
  endp generateBasicRandomNumber
  
  
  </code></pre>