Help needed with assembler code..

delphi package - full disassembler

Help needed with assembler code..

Postby Claes » Fri Jul 30, 2004 3:50 pm

Can anyone help make the below code work?

Code: Select all
function MakeWord(L, H: Byte): Word;
{ macro creates a word from low and high bytes }
inline(
  $5A/            { pop dx }
  $58/            { pop ax }
  $8A/$E2);       { mov ah, dl }

It seems that Delphi no longer understand "inline"...? Anyhow I'm no assembler guy AT ALL, so I can't make it work...

The function is taken from the library SendKeys that I found somewhere on the net, and the code is part of Delphi Developers Guide by Steve Teixeira
Claes
 
Posts: 52
Joined: Thu Apr 22, 2004 10:52 pm
Location: Denmark

Postby Claes » Fri Jul 30, 2004 3:52 pm

Will this work?

Code: Select all
function MakeWord(L,H: Byte): Word;
begin
  MakeWord := (H shl 8) + L;
end;
Claes
 
Posts: 52
Joined: Thu Apr 22, 2004 10:52 pm
Location: Denmark

Postby nildo » Fri Jul 30, 2004 5:30 pm

Code: Select all
function MakeWord(L, H: Byte): Word;
{ macro creates a word from low and high bytes }
begin
   asm
      pop dx
      pop ax
      mov ah, dl
   end;
end;


?
nildo
 
Posts: 249
Joined: Mon Mar 22, 2004 11:32 am

Postby madshi » Sat Jul 31, 2004 10:02 am

Is this still 16bit code? In Delphi you usually use "asm" instead of "inline", it's much nicer anyway.

But I'd do it like this:

Code: Select all
function MakeWord(L, H: Byte) : Word;
begin
  result := Word(H) shl 8 + L;
end;
madshi
Site Admin
 
Posts: 9339
Joined: Sun Mar 21, 2004 5:25 pm

Postby Claes » Sun Aug 01, 2004 4:11 pm

Thanks, guys! ;)
Claes
 
Posts: 52
Joined: Thu Apr 22, 2004 10:52 pm
Location: Denmark


Return to madDisAsm

Who is online

Users browsing this forum: No registered users and 1 guest