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 Rate Thread Display Modes
      #1    
    Old April 8th, 2005, 12:12 AM
    Jeb99 Jeb99 is offline
    Junior Member
     
    Join Date: Apr 2005
    Posts: 2
    Jeb99 is an unknown quantity at this point (<10)
    emulating assembely commands in c++

    Hi, I was wondering if anyone knows how to emulate assembly commands in c++.
    Like for instance, there is the command LDA# which is load directly into the accumulator at whatever the address specified is. The only problem is i have no idea how to do this in c++. So what i need help with is taking the LDA# and recreating it in c++(or any other command for that matter). If anyone knows how to do this could you please help me out.

    Thanks
    Reply With Quote
      #2    
    Old April 8th, 2005, 05:48 AM
    NoHero's Avatar
    NoHero NoHero is offline
    Moderator
     
    Join Date: Mar 2004
    Location: (Upper-) Austria
    Posts: 2,899
    NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)
    Re: emulating assembely commands in c++

    The inline assembler depends on your compiler... On MSVC++ and on Borland C++ the __asm keyword is used to write inline assembler. On the Gnu Compiler systems the __asm__ keyword is used. Often in combintion with the volatile and the AT&T syntax.

    Microsoft VC++ & Borland:

    Check out: http://msdn.microsoft.com/library/de...m/msmod_35.asp

    Code:
    // Example of the __asm keyword
    __asm                  // __asm block
    {
       mov eax, 01h
       int 10h
    }
    
    __asm mov eax, 01h      // Separate __asm lines
    __asm int 10h
    
    // Multiple __asm statements on a line
    __asm mov eax, 01h   __asm int 10h
    GCC with AT&T: http://www.cs.virginia.edu/~clc5q/gcc-inline-asm.pdf
    __________________
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!
    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 05:00 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