我正在学习一些汇编语言(x86 Irvine.32 windows7),并有一个关于如何从用户输入的问题。我所写的这本书并没有深入讨论它。我想提示用户:基本的用户输入
myfirst BYTE "Welcome! This program calculates the sum of a list of numbers.", 0dh, 0ah, 0dh, 0ah ; greeting
BYTE "How many integers will be added? : "
那么用户会输入X.我怎样读取用户输入的内容并将其放入一个变量?
是化繁为简:
INVOKE ReadConsole, SomeVairable
凡SomeVairable中。数据定义了一个字节?
编辑:
INCLUDE Irvine32.inc
BufSize = 80
.data
buffer BYTE BufSize DUP(?)
stdInHandle HANDLE ?
bytesRead DWORD ?
myfirst BYTE "Welcome! This program calculates the sum of a list of numbers.", 0dh, 0ah, 0dh, 0ah ; greeting
BYTE "How many integers will be added? : "
mysecond BYTE "Please enter the "
.code
main PROC
mov edx, OFFSET myfirst ;move the location of myfirst into edx
call WriteString
; Get handle to standard input
INVOKE GetStdHandle, STD_INPUT_HANDLE
mov stdInHandle,eax
; Wait for user input
INVOKE ReadConsole, stdInHandle, ADDR buffer,
BufSize, ADDR bytesRead, 0
exit
main ENDP
END main
什么平台/操作系统? – kuba 2012-04-05 17:44:05
刚编辑原稿。 – Nogg 2012-04-05 17:47:34
这应该可以帮助你http://stackoverflow.com/questions/523185/a-simple-assembly-input-question – 2012-04-05 17:55:35