Board index » delphi » getting info from function written in ASM

getting info from function written in ASM

I found some mouse routine code on a CD I have the code was written in INLINE
with the comments describing the ASM code.

I copied the ASM code to some of my programs, neither the original or copied
code returns values processed in the function

example:

function mouse_installed : boolean;
  { return true if the mouse driver and hardware are installed.  Also
    resets mouse to default settings. }
Begin
  Inline
    ($B8/$00/$00/         {     MOV AX,0                                      }
     $CD/$33/             {     INT 33H                                       }
     $89/$46/$04);        {     MOV [BP+4],AX                                 }
End;

PROBLEM IS :

IF MOUSE_INSTALLED THEN WRITELN('Mouse installed.'); always returns true......

any help PLEASE!

 

Re:getting info from function written in ASM


In article <maestro.26.00014...@iquest.net>,

Quote
maes...@iquest.net (Dan Allen) wrote:
>function mouse_installed : boolean;
>  { return true if the mouse driver and hardware are installed.
>    Also resets mouse to default settings. }
>Begin
>  Inline
>    ($B8/$00/$00/         {     MOV AX,0                  }
>     $CD/$33/             {     INT 33H                   }
>     $89/$46/$04);        {     MOV [BP+4],AX             }
>End;

Well, I'm not used to write inline, but why move ax into [BP+4] ?

When I deleted all the inline stuff, your function worked as desired,
I am relying on the content of ax always beeing passed as function result:

function mouse_installed : boolean; assembler;
asm     MOV    AX,0
        INT    33H
end;

Erik Hjelme      Phone & fax      FidoNet BBS      E-mail
Denmark          +45 36461003     MCUG 2:235/15    hje...@login.dknet.dk

Other Threads