我有一個問題,讓我的腦海裏面如何存儲用戶從提示輸入的8位無符號整數。我目前的代碼是:存儲一個8位無符號整數
lea dx, StrPrompt ;load prompt to display to the user
mov ah, 9h ;display string subroutine
int 21h ;interrupt for MS-DOS routine
mov ah, 1h ;Read character subroutine (will be stored in al)
int 21h ;Interrupt for MS-DOS
sub al, 30h ;Translate al from ASCII code to number
mov num, al ;Copy number to num (al will be overwritten later)
lea dx, StrMsg ;display the results to the user
mov ah, 9h
int 21h
mov al, num ;move the n value to the al
mov dl, al ;display the number
add dl, 30h ;add 30h to the ASCII table
mov ah, 2h ;store interrupt code
int 21h ;interrupt for MS-DOS routine
現在的問題是,我每次運行這段時間只會讓我進入像1,2,3,等我無法輸入一個整數在一個雙或三位數字像20或255.我怎麼去解決這個問題?
隨着「中間體21/AH = 0AH」我們可以得到一個緩衝輸入迴路:[鏈接] HTTP:// WWW .ctyme.com/intr/rb-2563.htm – 2014-11-09 09:09:16