ESI & 的目的EDI 寄存器? [英] Purpose of ESI & EDI registers?

查看:15
本文介绍了ESI & 的目的EDI 寄存器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

EDI & 的实际目的和用途是什么?汇编程序中的 ESI 寄存器?

What is the actual purpose and use of the EDI & ESI registers in assembler?

我知道它们用于一件事的字符串操作.

I know they are used for string operations for one thing.

谁能也举个例子?

推荐答案

有一些操作只能用 DI/SI(或它们的扩展对应物,如果你没有学习 ASM1985 年).其中

There are a few operations you can only do with DI/SI (or their extended counterparts, if you didn't learn ASM in 1985). Among these are

REP STOSB
REP MOVSB
REP SCASB

分别是重复(=大量)存储、加载和扫描的操作.您所做的是将 SI 和/或 DI 设置为指向一个或两个操作数,也许在 CX 中放置一个计数,然后让 'er rip.这些是一次处理一堆字节的操作,它们有点让 CPU 处于自动状态.因为您没有明确地编码循环,所以它们比手动编码的循环更有效(通常).

Which are, respectively, operations for repeated (= mass) storing, loading and scanning. What you do is you set up SI and/or DI to point at one or both operands, perhaps put a count in CX and then let 'er rip. These are operations that work on a bunch of bytes at a time, and they kind of put the CPU in automatic. Because you're not explicitly coding loops, they do their thing more efficiently (usually) than a hand-coded loop.

以防万一您想知道:根据您如何设置操作,重复存储可以很简单,例如将值 0 打入一个大的连续内存块;我认为 MOVSB 用于将数据从一个缓冲区(好吧,任何字节串)复制到另一个缓冲区;并且 SCASB 用于查找与某个搜索条件匹配的字节(我不确定它是否仅搜索相等性,或者什么– 你可以查找它:))

Just in case you're wondering: Depending on how you set the operation up, repeated storing can be something simple like punching the value 0 into a large contiguous block of memory; MOVSB is used, I think, to copy data from one buffer (well, any bunch of bytes) to another; and SCASB is used to look for a byte that matches some search criterion (I'm not sure if it's only searching on equality, or what – you can look it up :) )

这就是那些 reg 的大部分用途.

That's most of what those regs are for.

这篇关于ESI & 的目的EDI 寄存器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆