Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6981605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:10:44+00:00 2026-05-27T18:10:44+00:00

I would like to port C’s outb function to D. static __inline void outb

  • 0

I would like to port C’s outb function to D.

static __inline void outb (unsigned char value, unsigned short int port)
{
    __asm__ __volatile__ ("outb %b0,%w1"
                          :
                          :
                         "a" (value),
                          "Nd" (port));
}

This is D version.

extern(C) 
{
    void outb (ubyte value, ushort port)
    {
        // I couldn't figure out this part
   }

}

These are some links about the subject.

D Inline Assembler

http://dlang.org/iasm.html

GCC-Inline-Assembly-HOWTO

http://ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html

But I don’t know assembly language so I need some help. Any help would be appreciated. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:10:44+00:00Added an answer on May 27, 2026 at 6:10 pm

    The outb instruction should only be called as outb %al, %dx where %al is the value and %dx is the port.

    D uses Intel syntax for x86, as opposed to GNU assembler which uses the AT&T syntax by default. The corresponding Intel syntax would be out dx, al, and corresponding code in D would look like:

    void outb (ubyte value, ushort port)
    {
        asm {
            mov AL, value;
            mov DX, port;
            out DX, AL;
        }
    }
    

    Note that you don’t need to write the assembly at all, because druntime has the core.bitop.outp function which perform the same instruction.

    void outb (ubyte value, ushort port)
    {
        import core.bitop;
        outp(port, value);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to port a few applications that I use on Linux to
I've written some C code that I would like to port to python, as
Would like to know the c# code to actually retrieve the IP type: Static
I would like to port this question to Python (Windows + Linux + Mac
I have a couple c++ utilities that I would like to port over to
I would like to Sniff/Listen on port 80 requests/responses. Can it be done with
I'm a websphere newbie and would like to change the port number. I read
I would like to port an ActiveX of mine (to Silverlight) that have the
I'd like to port the Emacs Psychotherapist to C :) but I would like
I have the following regex in PHP: /(?<=\')[^\'\s][^\']*+(?=\')|(?<=)[^\s][^]*+(?=)|[^\',\s]+/ and I would like to port

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.