x86 Assembly输入一组整数 [英] x86 Assembly Input a set of Integers

查看:83
本文介绍了x86 Assembly输入一组整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的代码要求用户输入整数,并且该代码会将相同的一组整数吐回给用户.

The code below asks a user to input integers and the code will spit the same set of integers back to the user.

include irvine32.inc 

.data 
    input dword ?
    prompt1 byte "Input your numbers: ",0 

.code 

mWriteNum Macro input  
    push ecx 
    push eax 
    mov eax, offset input 
    call writedec
    pop eax 
    push ecx
endM

mReadInput MACRO input 
    push ecx 
    push eax 
    mov eax, offset input 
    mov ecx, sizeof input 
    call Readint
    mov input, eax 
    pop eax 
    pop ecx 
endM 

main proc 

    call clrscr 
    mov edx, offset prompt1 
    call writeString 

    mReadInput input 

    call crlf 
    mWriteNum input 

exit 
main ENDP
end main

但是,这就是结果:

Input your numbers: 123

4210688

我在这里做什么?请帮忙.谢谢

What am I doing here? Please help. Thanks

推荐答案

您可以在 WriteDec 的文档,您应该提供要在 eax 中打印的值,而不是要打印的值的地址

As you can see in the documentation for WriteDec, you're supposed to provide the value to print in eax, not the address of the value to print.

这篇关于x86 Assembly输入一组整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆