Thread: MSVC inline ASM...

  1. #1
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227

    MSVC inline ASM...

    I know we've said it a million times - but let's all say it again, children! "MSVC's Inline ASM SUCKS!"

    here's what I'm trying to do, just in order to get some faster output...

    Code:
    void printmsg(char *name)
    {
        _asm
    	{
    		mov dx, name
    		mov ah, 9
    		int 21
    	}
    }
    
    int main(void) 
    { 
    	char *name = "hello, my name is ken!";
    	printmsg(name);
    	return 0;
    
    }

    /*note, I put this on the GD board cuz there's really nowhere else TO put it..unless we make a "*****ing about MS" forum */


    now is there some MSVC inline syntax I need to be aware of?

  2. #2
    Unregistered
    Guest
    isnt there 2 underscores before the asm keyword?

  3. #3
    Registered User dirkduck's Avatar
    Join Date
    Aug 2001
    Posts
    428
    forgot to sign in...that was me

  4. #4
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    works the same both ways, ducky
    but yeah, the 1~2 underscores don't matter - I guess they have 2 keywords that do the same thing...or they just allow for errors..

  5. #5
    Registered User dirkduck's Avatar
    Join Date
    Aug 2001
    Posts
    428
    well, thats M$ for you....

  6. #6
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    this from a man who uses a form of BASIC? ha!

  7. #7
    Registered User dirkduck's Avatar
    Join Date
    Aug 2001
    Posts
    428
    heh, well, what can I say, i like my simplicity

  8. #8
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    yeah, then use GWBASIC:

    10 PRINT "Muhahaha!"

    or QBASIC

    PRINT "MUHAHA"


  9. #9
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    yeesh, we all DO have short attn. spans.


    now back to my original Question!!

  10. #10
    Registered User dirkduck's Avatar
    Join Date
    Aug 2001
    Posts
    428
    hmm, never used GWBASIC...

  11. #11
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    Isn't int 21 a dos interupt? If windows is like linux you will
    probably want to do a window's syscall.

  12. #12
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    You will also need to use eax, ebx, ecx, edx as c pointers in windows are 4 bytes.

  13. #13
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912

    Back to Big Bad BASIC

    Yes, we do have short attention spans. Can we get back to badmouthing BASIC now? *whining. Pleeeeeeease?

  14. #14
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    why? when I do total ASM I never need a windows syscall...(btw, it was supposed to be int 21h...oops. but that didn't fix it)

    I tried using the extended regs, but that didn't work either...STUPID MSVC...

    sure...let's badmouth BASIC more...

    Code:
    for( ;; )
        printf("BASIC is of the devil!\n");
    
    //C
    
    FOR X=0 TO 900 STEP 1
    PRINT "BASIC SUCKS"
    NEXT X
    
    //QBASIC
    
    10 FOR X=0 TO 900 STEP 1
    20 PRINT "BASIC SUCKS"
    30 NEXT X
    
    //GWBASIC
    
    program BasicSux;
    var char1: char;
    begin
         writeln('Basic Sux!');
         read(char1);
    end.
    
    //Pascal
    
    <b><h1>Basic Sux</b></h1>
    
    //HTML
    
    MAIN:
        mov dx,msg	        
        mov ah,9                
        int 21h                 
    	
        mov ax,04C00H           
        int 21h                 
    
        msg db 13,10,"Damned BASIC, it SUCKS!",13,10,"$"
    
    //ASM
    ehh...can't think of anymore langs that I know..
    Last edited by -KEN-; 10-07-2001 at 07:54 PM.

  15. #15
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    i don't think DMA is allowed in windows... that includes the command prompt...
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 09:42 PM
  2. Certain functions
    By Lurker in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2003, 01:26 AM
  3. Inline asm
    By wavering in forum C Programming
    Replies: 2
    Last Post: 01-29-2002, 02:42 AM
  4. Inline asm - I love it!
    By wavering in forum C Programming
    Replies: 2
    Last Post: 01-08-2002, 02:19 PM
  5. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM