开发者

shortest way to do a fetch in X86 assembler?

What is the shortest way to fetch a value from m开发者_开发知识库emory in X86 Assembler?


You mean other than mov register, [address]?


There is no workaround in assembler haw to do that. All assembler instructions are strictly dedicated.

mov AL, 0x12

will load immediate the value 0x12 to register AL

xor  AL,AL

the result of operation in AL register is 0

lodsb

will load byte from DS:[ESI] (or DS:[SI] under 16 bit CPU) memory address to AL

mov AL,[ESI]

will load byte from DS:[ESI] (or DS:[SI] under 16 bit CPU) memory address to AL

mov AL,[0xFFFF]

will load byte from DS:[0xFFFF] memory address to AL

pop AX

will load byte from SS:[ESP] (or SS:[SP] under 16 bit CPU) memory address to AL

in AL, 0x123

will load byte from port address 0x123

xlatb [EBX + AL]

will load byte from DS:[EBX + AL] memory address

...


OK, the shortest way is to pop registers, like pop eax, it's one byte instruction.
But that can be used only in special cases, where the stack pointer ESP will point to a buffer,
and probably you won't use the stack for other purpose until the code that uses it is done.

The standard way is to use the mov instruction.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜