flat assembler
Message board for the users of flat assembler.

Index > Main > what does the operand to LODS (memory_8) do!?

Author
Thread Post new topic Reply to topic
hckr83



Joined: 12 Nov 2006
Posts: 86
Location: usa
hckr83 09 Dec 2006, 19:46
I have read the intel docs and a few other docs but none of them says what exactly the operand to LODS does
all that I got was it tells lods what type it is, but their are different opcodes that do that so what does the operand do if it doesn't load anything into SI?

_________________
x86 CPU Emulation library: http://sourceforge.net/projects/x86lib
Post 09 Dec 2006, 19:46
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat 09 Dec 2006, 19:56
LODS basically loads the contents of the source index (si) into a* (* meaning it varies with the size of the operand, i.e. LODSB moves whatever's in SI into AL, LODSW moves whatever's in SI into AX).

I will give you this help file. It's something I keep handy on my HD and helps me when I don't know what an opcode does.


Description:
Download
Filename: asmhelp.zip
Filesize: 161.19 KB
Downloaded: 370 Time(s)

Post 09 Dec 2006, 19:56
View user's profile Send private message Reply with quote
hckr83



Joined: 12 Nov 2006
Posts: 86
Location: usa
hckr83 09 Dec 2006, 20:49
so basically the lods [operand] thing is only in assembly, like truly it's just an assembly mnomec, so at the instruction(not assembly) level it doesn't have an operand?
Post 09 Dec 2006, 20:49
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger Reply with quote
Goplat



Joined: 15 Sep 2006
Posts: 181
Goplat 09 Dec 2006, 21:07
yep, the opcode is just AC for byte or AD for word/dword. I think the reason that assemblers allow the explicit operand form is so that you can use a segment override; with the "lodsb" form you'd have nowhere to put it.

Code:
lodsb             ; AC
lods byte [si]    ; AC
lods byte [cs:si] ; 2E AC
    
Post 09 Dec 2006, 21:07
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8367
Location: Kraków, Poland
Tomasz Grysztar 09 Dec 2006, 21:30
Goplat wrote:
I think the reason that assemblers allow the explicit operand form is so that you can use a segment override; with the "lodsb" form you'd have nowhere to put it.

Not only the segment and also size of the addressing register, like:
Code:
lods byte [si]
lods byte [esi]    

The LODSB is just a shortcut form that uses the default addressing for the given mode - DS:SI with USE16, DS:ESI with USE32.

You've this this kind of options not only with string operations, the other example is XLAT:
Code:
xlat byte [cs:bx]
xlat byte [fs:ebx]    

And analogously there's also a short form XLATB that uses the default addressing.
Post 09 Dec 2006, 21:30
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.