Advertisement
Tusohian

Compare in ASM

Nov 16th, 2018
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .MODEL SMALL
  2. .STACK 100H
  3.  
  4. .DATA
  5. MSG1 DB 10, 13, 'Enter a number: $ '
  6. MSG2 DB 10,13, 'greater $'
  7. MSG3 DB 10,13, 'smaller $'
  8. MSG4 DB 10,13, 'equal $'
  9.  
  10.  
  11.  
  12. .CODE
  13. MAIN PROC
  14.  
  15. MOV AX,@DATA
  16. MOV DS,AX
  17.  
  18. LEA DX,MSG1
  19. MOV AH,9
  20. INT 21H
  21.  
  22.  
  23. MOV AH,1
  24. INT 21H
  25. MOV BL,AL
  26.  
  27. SUB BL,48
  28.  
  29. CMP BL,5
  30. JL L1
  31. JE L2
  32.  
  33. LEA DX,MSG2
  34. MOV AH,9
  35. INT 21H
  36. JMP EXIT
  37.  
  38.  
  39. L1:
  40. LEA DX,MSG3
  41. MOV AH,9
  42. INT 21H
  43. JLE EXIT
  44.  
  45. L2:
  46. LEA DX,MSG4
  47. MOV AH,9
  48. INT 21H
  49. EXIT:
  50.  
  51.  
  52.  
  53. MOV AH, 4CH
  54. INT 21H
  55.  
  56.  
  57. MAIN ENDP
  58. END MAIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement