I have a pointer to an array, DI.
Is it possible to go to the value pointed to by both DI and another pointer?
e.g:
mov bl,1
mov bh,10
inc [di+bl]
inc [di+bh]
And, on a related note, is there a single line opcode to swap the values of two registers? (In my case, BX and BP?)
For 16-bit programs, the only supported addressing forms are:
Each of these may include either an 8- or 16-bit constant displacement.
(Source: Intel Developer’s Manual volume 2A, page 38)
The problem with the example provided is that
blandbhare eight-bit registers and cannot be used as the base pointer. However, if you setbxto the desired value theninc [di+bx](with a suitable size specifier for the pointer) is valid.As for swapping “the high and low bits of a register,” J-16 SDiZ’s suggestion of
ror bx, 8is fine for exchangingblandbh(and IIRC, it is the optimal way to do so). However, if you want to exchange bit 0 of (say)blwith bit 7 ofbl, you’ll need more logic than that.