MSVC++ :: Calling 'cout' w/ ASM

This is a discussion on MSVC++ :: Calling 'cout' w/ ASM within the Game Programming forums, part of the General Programming Boards category; Hey! Thanks for reading. I hope you can help me out. I know a decent amount of ASM in C/C++, ...

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question MSVC++ :: Calling 'cout' w/ ASM

    Hey! Thanks for reading. I hope you can help me out. I know a decent amount of ASM in C/C++, but I can't figure this out. I am using MSVC++ 6.0 and I tried the 'Listing Files'. The listing files (.asm) look really weird.

    I am trying to call 'cout' in a console application with ASM. If you can help then please do. =)
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    You'll need to mov the address of cout into ecx (that's how this pointers are passes, iirc) and call operator<<. But before you can call it, you'll have to figure out how MSVC mangles the name of operator<<.

    Or you could just call printf
    Code:
    char name[] = "Eibro";
    char format[] = "Hello %s";
    
    __ asm
    {
            mov eax, offset name
            push eax
    
            mov eax, offset format
            push eax
    
            call printf
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I'm REALLY confused. Why isn't cout or cin working here?
    By niudago in forum C++ Programming
    Replies: 8
    Last Post: 02-15-2003, 04:53 PM
  2. Redirecting cout stream
    By Arrow Mk84 in forum C++ Programming
    Replies: 1
    Last Post: 10-08-2002, 04:17 PM
  3. asm mov
    By manu in forum C++ Programming
    Replies: 1
    Last Post: 12-15-2001, 11:59 AM
  4. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 05:05 PM
  5. I get a parse error everytime I use asm
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 11-09-2001, 12:17 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21