现在我的代码给了我 1846 倒退。我不知道如何反转数组以打印出 1846 而不是 6481。我想我需要一个循环来反转它,但我不知道如何去实现它。任何帮助,将不胜感激。谢谢你。
.data
enter_message:
.ascii "Enter a binary value:\n"
enter_message_length:
.int 22
name:
.space 50
buffersize:
.int 0
someLength:
.int 50
array:
.space 50
.text
.global _start
_start:
mov $1846, %eax
mov $10, %ebx
mov $0, %edi
While_Loop:
cmp $0, %eax
je Convert_to_ASCII
mov $0, %edx
div %ebx
add $48, %edx
movb %dl, buffersize(%edi)
add $1, %edi
jmp While_Loop
Convert_to_ASCII:
mov $4, %eax
mov $1, %ebx
mov $buffersize, %ecx
mov %edi, %edx
int $0x80
mov $1, %eax
int $0x80