Advertisement
Michelangelo-Pucci

Input di numeri > 9 in Assembly x86 - Michelangelo Pucci

Jan 7th, 2020
2,325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. org 100h
  2. .code
  3.  
  4. getInput PROC
  5.  
  6. MP_input:
  7.    
  8.     mov ah, 01h
  9.     int 21h
  10.    
  11.     ; Esco dal programma alla pressione dell'invio
  12.     cmp al, 0dh
  13.     je MP_fine
  14.    
  15.     ; ASCII -> NUMERO
  16.     sub al, 30h
  17.    
  18.     ; AH = 0 poiche uso AX come fosse AL
  19.     mov ah, 0
  20.     mov number, ax
  21.    
  22.    
  23.     mov al, 10
  24.    ;AX = newNum * 10
  25.     mul newNum
  26.    
  27.    
  28.     add ax, number
  29.    
  30.     mov newNum, ax
  31.     jmp MP_input
  32.    
  33. MP_fine:
  34.     mov ax, newNum
  35.     ret
  36.    
  37.     newNum dw ?
  38.     number dw ?
  39. getInput ENDP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement