title: Program in 8086 assembly language to compare two numbers
body: <p>The following is my code in assembly language to compare two numbers and print a test character to confirm if it's written correctly.</p>
  
  <pre><code>DATA SEGMENT
  
      NUM1 DB 50
      NUM2 DB 45
  DATA ENDS
  
  CODE SEGMENT
  
      ASSUME CS: CODE, DS: DATA
  START: MOV AX, DATA
  
      MOV DS, AX
      MOV AL, NUM1
      MOV BL, NUM2
      CMP AL, BL
      JLE TAG
      TAG: MOV DL, AL
           MOV AH, 02H
           MOV DL,  'T'
           INT 21H
      MOV AX, 4CH
      INT 21H
      CODE ENDS
      END START
  </code></pre>
  
  <p>My assumption is, CMP will compare AL to BL. If AL is smaller, JLE will be true and the code in the part 'TAG' will be executed. As you can see AL is not smaller, still, TAG is executed. </p>