遍历内存编辑每个字节
我正在编写汇编代码,提示用户输入一串小写字符,然后输出包含所有大写字符的相同字符串。我的想法是迭代从特定地址开始的字节,并从每个字节中减去 20H(将小写变为大写),直到到达具有特定值的字节。我对 Assembly 相当缺乏经验,所以我不确定这样的循环的语法是什么样的。
谁能提供一些示例代码或指导我在哪里可以找到此类语法的示例?
非常感谢任何帮助!
I'm writing assembly code that prompts the user for a string of lower-case characters then outputs the same string with all UPPER-CASE characters. My idea is to iterate through the bytes starting at a specific address and subtract 20H (turns a lower case to upper-case) from each one until I reach a byte with a specific value. I'm fairly inexperienced with Assembly so I'm not sure what the syntax for such a loop would look like.
Can anyone provide some sample code or direct me where I can find examples of such syntax?
Any help is greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常,字符串以 null(十六进制的 0x00)结尾。假设这就是您选择执行的操作,下面是一些示例代码。我不确定您使用的是哪种汇编器,甚至不确定哪种语法,但是这个 x86 代码应该在 MASM 中工作:
Typically, a string is terminated with a null (0x00 in hex). Assuming this is what you choose to do, here's some sample code. I'm not sure which assembler you're using, or even which syntax, but this x86 code that should work in MASM:
好吧,一个简洁的(但不是当前处理器性能的最佳选择)是:
Well, one concise (but not optimal for performance on current processors) choice would be: