SI
= Source Index
DI
= Destination Index
As others have indicated, they have special uses with the string instructions. For real mode programming, the ES
segment register must be used with DI
and DS
with SI
as in
movsb es:di, ds:si
SI and DI can also be used as general purpose index registers. For example, the C
source code
srcp [srcidx++] = argv [j];
compiles into
8B550C mov edx,[ebp+0C]
8B0C9A mov ecx,[edx+4*ebx]
894CBDAC mov [ebp+4*edi-54],ecx
47 inc edi
where ebp+12
contains argv
, ebx
is j
, and edi
has srcidx
. Notice the third instruction uses edi
mulitplied by 4 and adds ebp
offset by 0x54 (the location of srcp
); brackets around the address indicate indirection.
Though I can't remember where I saw it, but
this confirms most of it, and
this (slide 17) others:
AX
= accumulator
DX
= double word accumulator
CX
= counter
BX
= base register
They look like general purpose registers, but there are a number of instructions which (unexpectedly?) use one of them—but which one?—implicitly.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…