SHARE
TWEET

Assemble Compare with user input

naeem043 Feb 15th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .MODEL SMALL
  2. .STACK 100H
  3. .DATA
  4.     MSG1 DB 10,13, 'ENTER THE FIRST NUMBER : $'  
  5.     MSG2 DB 10,13, 'ENTER THE SECOND NUMBER : $'
  6.     A DB 10,13, 'EQUAL :$'  
  7.     B DB 10,13, 'NOT EQUAL :$'      
  8.            
  9. .CODE
  10. MAIN PROC
  11.        
  12.     MOV AX, DATA
  13.     MOV DS, AX
  14.    
  15.     LEA DX, MSG1
  16.     MOV AH, 9
  17.     INT 21H
  18.    
  19.    
  20.     MOV AH, 1  
  21.     INT 21H             ;INPUT ONE
  22.     MOV BL, AL                      
  23.    
  24.     LEA DX, MSG2
  25.     MOV AH, 9
  26.     INT 21H
  27.        
  28.        
  29.     MOV AH, 1  
  30.     INT 21H             ;INPUT TWO
  31.     MOV CL, AL
  32.    
  33.     CMP BL,CL           ; COMPARE TWO INPUTS
  34.     ;ADD BL, 48 ;reduce when use big input as like 100 whose are greater than 9
  35.    
  36.     JE LEVEL1
  37.     JNE LEVEL2
  38.    
  39.     LEVEL1:
  40.         LEA DX, A
  41.         MOV AH, 9       ; IF EQUAL THEN SHOW
  42.         INT 21H
  43.         JMP EXIT
  44.      
  45.     LEVEL2:
  46.         LEA DX, B
  47.         MOV AH, 9
  48.         INT 21H         ; IF NOT EQUAL THEN SHOW
  49.         JMP EXIT
  50.            
  51.     EXIT:
  52.         MOV AH,4CH      ; EXIT FROM MAIN BODY
  53.         INT 21H    
  54.    
  55. MAIN ENDP
  56. END MAIN
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top