Advertisement
Farhana_Zaman

Untitled

May 19th, 2023
995
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.07 KB | None | 0 0
  1.                   .MODEL SMALL
  2. .STACK 100H
  3. .DATA
  4. CR EQU 0DH
  5. LF EQU 0AH
  6.  
  7. M1 DB CR,LF,' ENTER A HEXA DIGIT:$'
  8. M2 DB CR,LF,'IN DECIMAL IT IS:'
  9. C1 DB ?,'$'
  10. M3 DB CR,LF,'DO YOU WANT TO DO IT AGAIN?'
  11. DB 'Y/N','$'
  12. M4 DB CR,LF,'ILLIGEL CHARACTER-ENTER'
  13. DB '0..9OR A..F:','$'
  14. M5 DB CR,LF,'IN DECIMAL IT IS:1'
  15. C2 DB ?,'$'
  16.  
  17. .CODE
  18. MAIN PROC
  19.     MOV AX,@DATA
  20.     MOV DS,AX
  21.    
  22.     BEGIN:  MOV AH,9
  23.     LEA DX,M1
  24.     INT 21H
  25.    
  26.     NEW:  MOV AH,1
  27.     INT 21H
  28.    
  29.     CMP AL,'0'
  30.     JL ILLEGAL
  31.     CMP AL,'9'
  32.     JG ILLEGAL
  33.    
  34.     MOV C1,AL
  35.     MOV AH,9
  36.     LEA DX,M2
  37.     INT 21H
  38.    
  39.     MSG:  MOV AH,9
  40.     LEA DX,M3
  41.     INT 21H
  42.    
  43.     MOV AH,1
  44.     INT 21H
  45.     CMP AL,'Y'
  46.     JE BEGIN
  47.     CMP AL,'y'
  48.     JE BEGIN
  49.     JMP ENDD
  50.    
  51.     ILLEGAL:  CMP AL,'A'
  52.     JL ILLEGAL2
  53.     CMP AL,'F'
  54.     JG ILLEGAL2
  55.     SUB AL,11H
  56.     MOV C2,AL
  57.    
  58.     MOV AH,9
  59.     LEA DX,M5
  60.     INT 21H
  61.    
  62.     JMP MSG
  63.    
  64.     ILLEGAL2:  MOV AH,9
  65.     LEA DX,M4
  66.     INT 21H
  67.     JMP NEW
  68.    
  69.     ENDD:  MOV AH,4CH
  70.     INT 21H
  71.    
  72.     MAIN ENDP
  73. END MAIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement