 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Marcello Lenci Guest
|
Posted: Sun Feb 05, 2006 4:00 pm Post subject: lds problem |
|
|
I am trying an assembler function:
function DoSomething(s:string):string;
asm
push ds
lds si,s
......
end;
Compiling an error rise: operand size mismatck.
if I change lds si,s with lds esi,s rise the error: invalid combination of
opcode operands
Somebody can help me ?
Thanks by now
Marcello |
|
| Back to top |
|
 |
Avatar Zondertau Guest
|
Posted: Sun Feb 05, 2006 4:00 pm Post subject: Re: lds problem |
|
|
| Quote: | I am trying an assembler function:
function DoSomething(s:string):string;
asm
push ds
lds si,s
.....
end;
Compiling an error rise: operand size mismatck.
if I change lds si,s with lds esi,s rise the error: invalid
combination of opcode operands Somebody can help me ?
|
In this case s is stored in EAX. Since a register is not an acceptable
argument to LDS (should be a memory location) this is not possible.
Why do you want to use LDS? It is useless in Win32 since it uses a flat
memory space in which CS, DS, ES and SS all point to the same memory.
It is even more meaningless in this case since the string data does not
include any segment selectors.
--
The Fastcode Project: http://www.fastcodeproject.org/ |
|
| Back to top |
|
 |
Marcello Lenci Guest
|
Posted: Tue Feb 07, 2006 6:02 am Post subject: Re: lds problem |
|
|
| Quote: | Why do you want to use LDS? It is useless in Win32 since it uses a flat
memory space in which CS, DS, ES and SS all point to the same memory.
It is even more meaningless in this case since the string data does not
include any segment selectors.
|
My targets are: learn basm and build an encrypting routine of a string>
thanks
Marcello |
|
| Back to top |
|
 |
Avatar Zondertau Guest
|
Posted: Tue Feb 07, 2006 8:04 am Post subject: Re: lds problem |
|
|
| Quote: | Why do you want to use LDS? It is useless in Win32 since it uses a
flat memory space in which CS, DS, ES and SS all point to the same
memory. It is even more meaningless in this case since the string
data does not include any segment selectors.
My targets are: learn basm and build an encrypting routine of a
string
|
The LDS instruction (and all other segment-related instructions) will
not be of any use to you. For learning BASM i would recommend that you
read Dennis Christensen's "BASM for Beginners". There is a link to it
on the Fastcode site, which is in my sig.
For checking the meaning of instructions i would recommend you use the
IA-32 Intel Architecture Software Developer's Manual, Volume 2. This is
also linked to on the page in my sig.
As for building a function that encrypts strings: i would recommend
that you make such a function in Pascal first and then, if it's
performance isn't enough, translate it into BASM and optimize it.
BTW if you truly want to encrypt the string it would be recommendable
that you use a library for this that uses one of the standard
encryption methods, such as AES or RSA (depending on your needs). This
will ensure that people can only read your data if they have the key.
--
The Fastcode Project: http://www.fastcodeproject.org/ |
|
| Back to top |
|
 |
|
|
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
|
|