Newsgroup: it.comp.lang.c++
Titolo: outportb ed inportb in applicazioni windows

Salve!!
le due funzioni per il controllo di una porta non funzionano in windows!!
cosa devo usare?
P.S. : programmo in BCB 1.0
grazie!! :))
Demetrio Filocamo
(
dfil...@tin.it
)

...


#ifndef _PORTS_
#define _PORTS_
#pragma message Warning: port I/O not allowed in Windows NT
#pragma link "ports.obj"
file://#pragma link "outport.obj"
#ifdef __cplusplus
extern "C" {
#endif
unsigned char  inportb( unsigned short __portid );
unsigned short inport ( unsigned short __portid );
short int      inp( unsigned short __portid );
unsigned short inpw( unsigned short __portid );
void           outportb( unsigned short __portid, unsigned char __value );
void           outport ( unsigned short __portid, unsigned short __value );
short int      outp( unsigned short __portid, unsigned char __value );
unsigned short outpw( unsigned short __portid, unsigned short __value );
#ifdef __cplusplus
}
#endif
#endif
#include "ports.h"
file://---------------------------------------------------------------------
--
//  functions
//      inport  - inputs a word from a hardware port
//      inportb - inputs a byte from a hardware port
//      inp     - inputs a byte from a hardware port
//      inpw    - inputs a word from a hardware port
//
//      outport  - outputs a word to a hardware port
//      outportb - outputs a byte to a hardware port
//      outp     - outputs a byte to a hardware port
//      outpw    - outputs a word to a hardware port
file://---------------------------------------------------------------------
--
unsigned short inport(unsigned short port)
{
    asm     mov     dx,port
    asm     in      ax,dx
        return _AX;
}
unsigned char inportb(unsigned short port)
{
    asm     mov     dx,port
    asm     in      al,dx
    asm     xor     ah,ah
        return _AX;
}
unsigned short inpw(unsigned short port)
{
    asm     mov     dx,port
    asm     in      ax,dx
        return _AX;
}
short int inp(unsigned short port)
{
    asm     mov     dx,port
    asm     in      al,dx
    asm     xor     ah,ah
        return _AX;
}
void outport(unsigned short port, unsigned short val)
{
    asm     mov     dx, port
    asm     mov     ax, val
    asm     out     dx, ax
}
void outportb(unsigned short port, unsigned char val)
{
    asm     mov     dx, port
    asm     mov     al, val
    asm     out     dx, al
}
unsigned short outpw(unsigned short port, unsigned short val)
{
    asm     mov     dx, port
    asm     mov     ax, val
    asm     out     dx, ax
        return (_AX);
}
short int outp(unsigned short port, unsigned char val)
{
    asm     mov     dx, port
    asm     mov     al, val
    asm     out     dx, al
    asm     xor     ah, ah
        return (_AX);
}
Prova un po'
CIAO

cosa devo usare?
Scriverti un device driver...
Le funzioni cui ti riferisci sono utilizzabili sotto dos, non sotto windows che
non consente l'accesso diretto all'hardware.
Comunque prova a cercare tra le api windows se trovi qualcosa che
ti possa andare bene.
Paolo
-----------------------------------------------------------------
  Paolo Marotta
  Computer Science, University of Pisa
  home:   
http://www.cli.di.unipi.it/~marotta
-----------------------------------------------------------------