Buggy inline assembler

Kristian kjkilpi at gmail.com
Sat Aug 19 01:13:53 PDT 2006


On Fri, 18 Aug 2006 22:59:05 +0300, Walter Bright  
<newshound at digitalmars.com> wrote:

> Heinz wrote:
>> Hi everyone, i've seen many bugs with the inline assembler in D. I've  
>> tried
>> many functions that work with other assemblers, simple functions such  
>> as print
>> to screen (i've seen D users complaining about this too).
>> I'm writing a block of code to make some sound through the pc speaker.  
>> It
>> compiles fine but at runtime i get a Win32 Exception.
>
> The problem has nothing to do with the inline assembler. You can use  
> OBJ2ASM to verify that the correct instructions are generated. The  
> problem is that executing IN and OUT instructions under Win32 will  
> generated an operating system exception.
>
> To print to screen, use the Win32 Console API functions. I don't  
> remember what the Win32 sound API is, but that has to be used to  
> generate sound.

There is a solution for calling the IN and OUT instructions under Win32:  
Inpout32.dll

http://www.logix4u.net/inpout32.htm

It works seamless with all versions of windows (98/NT/2000/XP).

I have succesfully used it in a C++ program of mine. (Don't ask _me_ how  
to use it in D, I'm still a rookie in the D world... ;) )



More information about the Digitalmars-d-bugs mailing list