简体   繁体   English

将C程序转换为IA32程序集(非常快)

[英]Translate C program into IA32 assembly (very quick)

Just have one little thing I got stuck on while translating this C code into assembly. 在将此C代码转换为程序集时,我遇到了一点麻烦。 This is the line of code I am stuck on. 这是我坚持的代码行。

if (input == '\n')

My assembly code thus far(for this line) is 到目前为止,我的汇编代码(针对此行)是

movl input, %eax    #%eax = input
cmpl ___, %eax

How do I compare input to '\\n'? 如何将输入与“ \\ n”进行比较? Do I just compare it outright or do I move it into the memory first? 我是将其完全比较还是先将其移入内存? Thanks. 谢谢。

Try 尝试

cmp 0x0D,%eax

0x0D is the ascii code for carriage return, or you can try 0x0A for line feed. 0x0D是回车的ASCII码,或者您可以尝试使用0x0A换行。

直接比较它, cmp允许立即值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM