指针和索引在英特尔8086大会 [英] Pointers and Indexes in Intel 8086 Assembly

查看:121
本文介绍了指针和索引在英特尔8086大会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个指向数组的指针,DI

I have a pointer to an array, DI.

是否有可能去的价值指向两个DI和另一个指针?

Is it possible to go to the value pointed to by both DI and another pointer?

例如:

mov bl,1           
mov bh,10
inc [di+bl]
inc [di+bh]

和,与此相关的,是有一条线运code交换两个寄存器的值? (在我而言,BX和BP?)

And, on a related note, is there a single line opcode to swap the values of two registers? (In my case, BX and BP?)

推荐答案

有关16位程序,唯一支持的寻址方式是:

For 16-bit programs, the only supported addressing forms are:

[BX+SI]
[BX+DI]
[BP+SI]
[BP+DI]
[SI]
[DI]
[BP]
[BX]

每个这些可能包括8位或16位的等速位移。

Each of these may include either an 8- or 16-bit constant displacement.

(来源:英特尔开发人员手册卷2A ,第38页)。

(Source: Intel Developer's Manual volume 2A, page 38)

与所提供的例子的问题是, BL BH 八个位寄存器,不能用作基指针。但是,如果您设置 BX 来那么所需的值 INC [二+ BX] (用合适的尺寸说明符指针)是有效的。

The problem with the example provided is that bl and bh are eight-bit registers and cannot be used as the base pointer. However, if you set bx to the desired value then inc [di+bx] (with a suitable size specifier for the pointer) is valid.

至于交换寄存器的高低位,<一个href=\"http://stackoverflow.com/questions/3384346/pointers-and-indexes-in-intel-8086-assembly/3384358#3384358\">J-16 SDiZ年代建议 ROR BX,8 是罚款交换 BL BH (IIRC和,它是这样做的最佳方式)。不过,如果你想交换的第0位(说) BL BL 的第7位,则需要比这更逻辑。

As for swapping "the high and low bits of a register," J-16 SDiZ's suggestion of ror bx, 8 is fine for exchanging bl and bh (and IIRC, it is the optimal way to do so). However, if you want to exchange bit 0 of (say) bl with bit 7 of bl, you'll need more logic than that.

这篇关于指针和索引在英特尔8086大会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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