Board index » delphi » Function/Procedure Translation to Basm

Function/Procedure Translation to Basm


2005-05-24 09:37:13 PM
delphi68
Take this code below
function ScanArray(P: Pointer; Value, Count: Integer): Integer;
asm
{On entry: eax = P, edx = Value, ecx = Count}
how do you know eax = P edx = value and ecx = count?
For example if i did
Function RetString(S: String): String;
Begin
Asm
//where is S?
// what represents Result? Result:=S;
End;
End;
Yes I am a complete newb to BASM and would love to learn it, i understand the
basics, but i don't get the Delphi's passing of params to and from. for
example is eax where the result goes?
 
 

Re:Function/Procedure Translation to Basm

On Tue, 24 May 2005 23:07:13 +0930, "Craig" <XXXX@XXXXX.COM>
writes:
Quote
how do you know eax = P edx = value and ecx = count?
[...]
Yes I am a complete newb to BASM and would love to learn it, i understand the
basics, but i don't get the Delphi's passing of params to and from. for
example is eax where the result goes?
The Delphi Help is a good starting point :-)
I have D5, and do like this:
Help -->Delphi Help -->Contents -->Object Pascal Reference -->
Memory management
Program control
Parameters and function results
Inline assembler code
There's quite a lot to read.
Then you also have Dennis' papers "BASM for beginners":
dennishomepage.gugs-cats.dk/BASM-filer/BASMForBeginners.htm
--
Anders Isaksson, Sweden
BlockCAD: web.telia.com/~u16122508/proglego.htm
Gallery: web.telia.com/~u16122508/gallery/index.htm
 

Re:Function/Procedure Translation to Basm

Learning assembler with delphi might help too:
delphi.about.com/library/bluc/text/uc052501a.htm
Regards,
John.
"Craig" <XXXX@XXXXX.COM>a écrit dans le message de news:
XXXX@XXXXX.COM...
Quote
Take this code below

function ScanArray(P: Pointer; Value, Count: Integer): Integer;
asm
{On entry: eax = P, edx = Value, ecx = Count}

how do you know eax = P edx = value and ecx = count?

For example if i did
Function RetString(S: String): String;
Begin
Asm
//where is S?
// what represents Result? Result:=S;
End;
End;

Yes I am a complete newb to BASM and would love to learn it, i understand
the
basics, but i don't get the Delphi's passing of params to and from. for
example is eax where the result goes?
 

Re:Function/Procedure Translation to Basm

Quote
Take this code below

function ScanArray(P: Pointer; Value, Count: Integer): Integer;
asm
{On entry: eax = P, edx = Value, ecx = Count}

how do you know eax = P edx = value and ecx = count?

For example if i did
Function RetString(S: String): String;
Begin
Asm
//where is S?
// what represents Result? Result:=S;
End;
End;

Yes I am a complete newb to BASM and would love to learn it, i
understand the basics, but i don't get the Delphi's passing of params
to and from. for example is eax where the result goes?
Once you've read the resources pointed at by Ansers and JonJon you may
want to download the IA-32 IntelR Architecture Software Developer's
Manual here:
www.intel.com/design/pentium4/manuals/index_new.htm
This is a complete reference about the architecture of x86 CPUs.
Especially parts 2a and 2b are interesting, becuase they contain a full
list of all opcodes, including description.
 

Re:Function/Procedure Translation to Basm

Thanks for the help guys, I am downunder here and it is 2:11 in the morning,
so I will be checking out the links and everything a bit later on g'night
:)
 

Re:Function/Procedure Translation to Basm

"Craig" <XXXX@XXXXX.COM>writes
Quote
Yes I am a complete newb to BASM and would love to learn it, i understand
the
basics, but i don't get the Delphi's passing of params to and from. for
example is eax where the result goes?
"Using assembler in Delphi"
www.guidogybels.net/delphiasm.html
P.