此汇编代码中的此步骤需要什么 - x86

时间:2017-11-04 14:33:24

标签: assembly x86-16

这是一个用户输入一些字符的程序,它将输出用户键入的内容。

go vet -shift=false yourfile.go

我不明白为什么 ; Section to store variables section .data string_msg: db "Enter a string (Max=64 Characters)", 0xD, 0 string_in: times 65 db 0h ; max = 64 char, last ch=null string_out: times 65 db 0h ; max = 64 char, last ch=null ; Start of program global _main section .text _main: mov ebp, esp; for correct debugging PRINT_STRING string_msg NEWLINE GET_STRING string_in, 65 ; init value to process input string xor ebx, ebx start: mov al, byte[string_in + ebx] mov byte[string_out + ebx], al PRINT_CHAR al cmp al, 0h je end inc ebx jmp start end: xor eax, eax ; terminate program ret 为什么?这是什么意思?

非常感谢你的帮助!

1 个答案:

答案 0 :(得分:2)

您所指的指令(PRINT_STRING string_out )只是复制输入的字符串。

由于字符串使用PRINT_CHAR一次显示一个字符,因此显示器并不真正需要它。

如果这个程序被扩展为使用替代输出方法,那么这个副本可能就变成了所需要的。

PRINT_CHAR al
cmp al, 0h
je end
cmp al, 0
je  end
PRINT_CHAR al

这可能是一个小错误!终止零通常不应显示在屏幕上。测试最好在之前打印。

[homepage][1]:-

Notice: Use of undefined constant DIR_CACHE - assumed 'DIR_CACHE' in /home/msgcl/public_html/ocart/system/library/cache/file.php on line 9
Notice: Use of undefined constant DIR_CACHE - assumed 'DIR_CACHE' in /home/msgcl/public_html/ocart/system/library/cache/file.php on line 25
Notice: Use of undefined constant DIR_CACHE - assumed 'DIR_CACHE' in /home/msgcl/public_html/ocart/system/library/cache/file.php on line 63
Notice: Use of undefined constant DIR_CACHE - assumed 'DIR_CACHE' in /home/msgcl/public_html/ocart/system/library/cache/file.php on line 47
Notice: Use of undefined constant DIR_CACHE - assumed 'DIR_CACHE' in /home/msgcl/public_html/ocart/system/library/cache/file.php on line 25
Error: A theme has not beeareassigned to this store!