#include #include #include void main( int argc, char *argv[] ) { int src, dst; printf( "\n\n---------------------\n\n" ); printf( "JD soft.\nTest Program...\n\n" ); printf( "Usage:\n TestPort [src] [dst] \n and write character's to send...\n" ); printf( "or TestPort [src] 0 (To send 0xFF to [src]\n"); printf( "\nNote: [src] & [dst] on Hex\n\n---------------------"); if ( argc <= 1 ) return; char *endptr, key; int Reset = 1; src = strtoul( argv[1], &endptr, 16); dst = strtoul( argv[2], &endptr, 16); if ( argc == 3 ) { printf( "\n\nWriting: %X to %X \n(Press key to send)", src, dst ); while( (key=getch()) != 27 ) { printf ( "\nSend: %X (%c)", key, key ); outportb( src, key ); key = inportb( dst ); printf ( " and Receive: %X (%c)", key, key ); } } else { printf( "\n\nWriting: %X \n(Press key to switch bettewn 0 and 0xFF)", src ); while( (key=getch()) != 27 ) { if ( Reset ) { outportb( src, 0xFF ); printf ( "\nSend: 0xFF" ); } else { outportb( src, 0 ); printf ( "\nSend: 0" ); } Reset = !Reset; } } }