我想输入一个三(比方说)数字从通过INT 21H
(DOS)的用户数量,并保存在一个电阻。通常情况下,我们要做的是由用户输入一个字符。对应的代码是:
MOV AH,1
INT 21H
上面的代码需要从(从0到9)。该输入被保存在寄存器AL用户单个数字输入
但是,我能做些什么,如果我想用户的输入多位数? (说456)
谁能提供了一个示例代码?
看看这个你想要做什么?
Lea Di, The_Buffer ;Define this somewhere
CLD ;Incrementing direction
Get_another_byte:
Mov AH, 1 ;Ms.Dos code to get one char
Int 21h ;Ms.Dos does that for us and puts it in AL
Cmp AL, 0Dh ;Did he hit the return key ?
Je He_is_done ;Yes, now we can go on
Stosb ;Else no put the byte in the buffer
Jmp Get_another_byte ;He's not done, so keep on
He_is_done:
Nop ;Blah
Nop ;Blah
Nop ;Blah
Nop ;
Nop ;
Nop ;Replace this with your real stuff here
Nop ;
Nop ;
Nop ;
现在,关于CLD
指令,将各类小心,并确保你做到这一点。
Stack Overflow上THIS QUESTION有关于它的一些重要的建议,和你非常问题恰恰适用