aboutsummaryrefslogtreecommitdiff
path: root/src/winNT_portio.c
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-06-09 11:46:16 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-06-09 11:46:16 +0000
commit9ed78bfa0ae3b18f2eef5746e80fac089f1e32b1 (patch)
treeefdb77f1e524576997fc038c46d45d7b0db4f712 /src/winNT_portio.c
parent0bc9a1ab651784b7ec245dfc41f32b7d623441a7 (diff)
ifdef'ed the assembler to be used only with M$-VC (doesn't work with mingw)
svn path=/trunk/externals/zexy/; revision=3136
Diffstat (limited to 'src/winNT_portio.c')
-rw-r--r--src/winNT_portio.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/winNT_portio.c b/src/winNT_portio.c
index 6eee64c..977395a 100644
--- a/src/winNT_portio.c
+++ b/src/winNT_portio.c
@@ -6,7 +6,7 @@
* to plug this on the usb bus.
* if the interface changes, only this file has to be adopted for the target system
*/
-#ifdef NT
+#ifdef __WIN32__
#include <stdio.h>
#include <windows.h>
@@ -21,20 +21,40 @@ int read_parport(int port)
{
// byte = _inp((unsigned short)port);
unsigned char value;
-
+#ifdef _MSC_VER
__asm mov edx,port
__asm in al,dx
__asm mov value,al
+#else
+ // hmm, i should read some documentation about inline assembler
+ post("lpt: cannot read from parport (recompile!)");
+ return 0;
+#endif
return (int)value;
}
void write_parport(int port, int invalue)
{
- // _outp((unsigned short)port, value);
- BYTE value = (BYTE)invalue;
- __asm mov edx,port
- __asm mov al,value
- __asm out dx,al
+ // _outp((unsigned short)port, value);
+ BYTE value = (BYTE)invalue;
+#ifdef _MSC_VER
+ __asm mov edx,port
+ __asm mov al,value
+ __asm out dx,al
+#else
+ // hmm, i should read some documentation about inline assembler
+ // and probably about assembler in general...
+ post("lpt: cannot write to parport (recompile!)");
+ /*
+ asm(
+ "mov %%edx,%0\n"
+ "mov %%al,%1\n"
+ "out %%dx,%%al\n"
+ :
+ : "a"(port),"b"(value)
+ );
+ */
+#endif
}
static LONG WINAPI HandlerExceptionFilter ( EXCEPTION_POINTERS *pExPtrs )
@@ -104,7 +124,7 @@ int open_port(int port)
return(0);
}
}
-#endif /* NT */
+#endif /* __WIN32__ */
void z_winNT_portio_setup(void)
{