简体   繁体   English

如何在x86汇编代码,at&t语法中复制单词

[英]How to copy a word in x86 assembly code, at&t syntax

So i am working on a project to help me learn assembly and ran into a problem. 因此,我正在从事一个项目,以帮助我学习组装并遇到问题。 I need to take a word that was entered by keyboard and copy it so that i can manipulate it after, replace parts of it. 我需要输入一个由键盘输入的词并将其复制,以便以后可以对其进行操作,更换其中的一部分。 I know i have to use a for loop and maybe a stack. 我知道我必须使用for循环,也许是堆栈。 I have tried several ways but all my code was wrong and didnt compile. 我尝试了几种方法,但是我所有的代码都是错误的并且没有编译。 I got the rest of the code to work just not this part, any help would be greatly appreciated in regards to this problem and and good books or websites to help learn assembly would be very welcome. 我得到了其余代码的全部内容,而不仅仅是这部分,对于此问题,我们将不胜感激,并且非常欢迎能帮助您学习汇编的好书或网站。 Thank you. 谢谢。

mov $0, $edi

Loop:
  cmp $4, %edi
  jg End

  mov $33, Text(%edi)
  add $1, %edi
  jmp Loop
End:

i tried this code to replace every other letter with a !, i think the process to copy would be the same, i am new to this concept. 我尝试使用此代码将所有其他字母替换为!,我认为复制过程将相同,这是我的新概念。 The copy and the ! 副本和! replace are the last two parts i am having trouble with the other parts i got. 替换是我遇到的其他两个部分遇到的最后两个部分。 Thank you. 谢谢。

This assembles with GNU as: 这与GNU组装为:

mov $0, %edi

Loop:
  cmp $4, %edi
  jg End

  movb $33, Text(%edi)
  add $1, %edi
  jmp Loop
End:

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

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