谁能帮我理解这里到底发生了什么?我是汇编语言的新手,写了一个简单的代码如下:(我在 LINUX 上开发)
我想做的是从用户那里接受一个整数,然后只显示用户输入的内容。
.section .data
number:
.long 0
.section .text
.globl _start
_start:
movl $3, %eax #Read system call
movl $0, %ebx #file descriptor (STDIN)
movl $number, %ecx #the address to which data is to be read into.
movl $4, %edx #number of bytes to be read
int $0x80
#the entered number is stored in %ebx. it can be viewed using "echo $? "
movl number , %ebx
movl $1, %eax
int $0x80
但我没有得到预期的结果。相反,我得到了我输入的任何字符的 ASCII 码。
例如:
input - 2
output - 50
input - 1
output - 49
input - a
output - 97 .... and so on?
怎么了?我应该进行哪些更改才能获得预期的结果?我错过了理解的基本概念是什么。