[Dev-C++] assembly & outportb (was 'assembly' and 'implicit declaration')
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Daniel K. O. <dan...@ya...> - 2003-10-29 01:26:59
|
Just trying to help some poor souls out there... :) In Dev-C++, the compiler that is bundled is MinGW (go to www.mingw.org for more info). MinGW compiles Win32 apps. A Win32 app shouldn't access the hardware, only use the Win32 API to do what they need. So, there's no outportb, outport, outb, or whatever function to acess directly the I/O ports. Even if you "hack" it to do something like this, it won't be portable for another windows version, like Win2k or WinXP. Go read the Win32 API (like the "CreateFile" func). OR try to find a library that emulates those funcions. If you still think those funcions are needed, you can go back to DOS, using DJGPP, or even better, Turbo C++ 3.0, so you can play around with everything by yourself. AND, if anyone is still trying to use "asm with Dev-Cpp" (actually it's "asm with gcc"), please read the message I posted on Oct 24 (bellow); AND please: could the developers put some of these questions inside the help menu (in a way the user can remove them latter): * How to unsubscribe from the Dev-Cpp's mailing list (*IMPORTANT*) * Keeping the window open to read the output * How to use the serial/paralel port * How to use assembly with Dev-Cpp [quote from Oct 24] First: GCC uses AT&T syntax by default, but it accepts Intel as well. You can set which syntax you want to use by default, with the "-masm=x" compiler option, where "x" can be: "att" -> for AT&T syntax "intel" -> for Intel syntax (d'oh....) So, with -masm=intel you can write: --- char hello[] = "Hello"; __asm( "mov ebx, _hello \n" "more intel asm here... \n" ); --- And with -masm=att (the default) you can do: --- char hello[] = "Hello"; __asm( "mov $_hello, %ebx \n" "more at&t asm here... \n" ); --- If you want to mix ASM code, you can use ".intel_syntax" and ".att_syntax" to change the syntax for the next lines. Just don't forget to change it back to the default syntax: Option -> -masm=att (default) --- char hello[] = "Hello"; __asm( ".intel_syntax \n" "mov ebx, _hello \n" "more intel asm here... \n" ".att_syntax \n" // back to default syntax ); --- Also, check: http://www.codeproject.com/useritems/gccasm.asp And also the Dev-Cpp's FAQ. [/quote] Daniel K. O. |