CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Other Programming > Assembly
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Assembly Questions and Answers for Assembly here!

    Reply
     
    Thread Tools Search this Thread Rating: Thread Rating: 73 votes, 5.00 average. Display Modes
      #1    
    Old November 3rd, 2004, 12:07 PM
    Vadiu Vadiu is offline
    Junior Member
     
    Join Date: Sep 2004
    Location: Portugal
    Posts: 17
    Vadiu is an unknown quantity at this point (<10)
    return value in C code

    I've made an assembly function in a C program. Now I'd like that function to return a value stored in AX, BX, CX, or DX. Does someone know how to do that?
    Thanks...
    Reply With Quote
      #2    
    Old November 4th, 2004, 10:30 AM
    indiocolifa's Avatar
    indiocolifa indiocolifa is offline
    Member +
     
    Join Date: Dec 2002
    Location: La Plata, Buenos Aires
    Posts: 604
    indiocolifa is on a distinguished road (30+)
    Re: return value in C code

    Suppose the following function which is written by asm (this is very simple, just to show):

    Code:
    void asmcode ( int param1, int* result)
    {
            __asm {
    
             mov ax, param1
             mov bx, 2
             add ax, bx
             mov result, ax         }
    }
    That loads AX with param1 value, BX with 2, does AX+BX->AX and returns the value of AX in result parameter.

    Hope that helps.
    __________________
    Visit my page: http://usuarios.lycos.es/hernandp and my blog... http://hernandp.blogspot.com

    Last edited by indiocolifa; November 4th, 2004 at 10:33 AM.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Other Programming > Assembly


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 12:15 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009