BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

lds problem

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM
View previous topic :: View next topic  
Author Message
Marcello Lenci
Guest





PostPosted: Sun Feb 05, 2006 4:00 pm    Post subject: lds problem Reply with 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 ?
Thanks by now
Marcello
Back to top
Avatar Zondertau
Guest





PostPosted: Sun Feb 05, 2006 4:00 pm    Post subject: Re: lds problem Reply with quote



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





PostPosted: Tue Feb 07, 2006 6:02 am    Post subject: Re: lds problem Reply with quote



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





PostPosted: Tue Feb 07, 2006 8:04 am    Post subject: Re: lds problem Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.