Is it normal for M$VC++ to.....

This is a discussion on Is it normal for M$VC++ to..... within the C Programming forums, part of the General Programming Boards category; compile C code with in-line assmebly without errors and then execute it but the DOS shell crashes when it pops-up???...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    35

    Is it normal for M$VC++ to.....

    compile C code with in-line assmebly without errors and then execute it but the DOS shell crashes when it pops-up???

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    35
    well this is it

    Code:
    #include <stdio.h>
    
    void main()
    {
    	char major,minor;
    
    	_asm mov ah,30h
    	_asm int 21h
    	_asm mov major,al
    	_asm mov minor,ah
    
    	printf("This is DOS version %i, release %i\n",major,minor);
    }
    is it wrong, because it compiles without a problem!

  3. #3
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    Haha - C For Dummies...

    It's correct, but it all has to do with MSVC stuff...try compiling it with something else (not DJGPP! They use AT&T Syntax! It's terrible!!)

    Or you might want to try extended registers....

  4. #4
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    try tasm
    ??
    Monday - what a way to spend a seventh of your life

  5. #5
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    tasm can't compile that...it has C in it. Plus, I think the point was to learn how to write INLINE asm oh well...I still say extended regs are the way to go.

  6. #6
    Registered User Esss's Avatar
    Join Date
    Aug 2001
    Posts
    133
    > is it wrong, because it compiles without a problem!

    Yes. VC compiles applications for Windows, and you've written a program that calls a DOS software interrupt. It's not DOS; how do you expect to read the DOS version?
    Code:
    #include <stdio.h>
    #include <windows.h>
    
    int main()
    {
    	long version, major, minor;
    
    	version = GetVersion();
     
    	// Get the Windows version.
    
    	major = LOBYTE(LOWORD(version));
    	minor = HIBYTE(LOWORD(version));
    	printf("Windows version %d.%d\n", major, minor);
    	return 0;
    }
    Ess
    Like a rat in a maze who says,
    "Watch me choose my own direction"
    Are you under the illusion
    The path is winding your way?
    - Rush

  7. #7
    Registered User
    Join Date
    Aug 2001
    Posts
    35
    Yup its from the extended Dummies book site thing!!!!

    OK thank you for your input but i have fixed the asm problem (and other problems as well), F*** M$, i found Borland 3.1 and it works on it.... so life is good!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. inet_aton()... Noob needs help with sockets :|
    By Maz in forum C++ Programming
    Replies: 3
    Last Post: 11-22-2005, 03:33 PM
  2. OpenGL normal mapping.
    By psychopath in forum Game Programming
    Replies: 8
    Last Post: 01-27-2005, 10:32 AM
  3. HUGE fps jump
    By DavidP in forum Game Programming
    Replies: 23
    Last Post: 07-01-2004, 10:36 AM
  4. Is this normal?
    By Daniel in forum Tech Board
    Replies: 5
    Last Post: 07-02-2003, 04:19 PM
  5. difference between register int and normal int
    By GanglyLamb in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 02-25-2003, 03:01 PM

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