Untitled
#include <dos.h> #include <stdlib.h> #include <conio.h> #include <stdio.h> #include <string.h> #define LPT1_ADDR 0x408 #define LPT2_ADDR 0x40A #define LPT3_ADDR 0x40C void checkparallelports(){ printf("Checking installed parallel ports...\n"); unsigned int lpt1 = *(unsigned int far*)MK_FP(0,LPT1_ADDR); unsigned int lpt2 = *(unsigned int far*)MK_FP(0,LPT2_ADDR); unsigned int lpt3 = *(unsigned int far*)MK_FP(0,LPT3_ADDR); if (lpt1){ printf("LPT1 Address: 0x%X\n",lpt1); } else { printf(" LPT1 not installed.\n"); } if (lpt2){ printf("LPT2 Address: 0x%X\n",lpt2); } else { printf(" LPT2 not installed.\n"); } if (lpt3){ printf("LPT3 Address: 0x%X\n",lpt3); } else { printf(" LPT3 not installed.\n"); } printf("Timeout constants are hardcoded\n"); } int main() { checkparallelports(); return 0; }
Leave a Comment