Untitled

 avatar
unknown
plain_text
20 days ago
777 B
2
Indexable
#include <iostream.h>
#include <dos.h>

void main() {
    
    unsigned int basePortAddresses[3] = {0x0408, 0x040A, 0x040C}; 
    unsigned int timeoutAddress = 0x0412; 
    
    cout << "Installed Parallel Ports and Timeout Constants:" << endl;

    for (int i = 0; i < 3; i++) {
        
        unsigned int portAddress = *((unsigned int far*)MK_FP(0x40, basePortAddresses[i]));
        
        if (portAddress != 0) { 
            cout << "LPT" << (i + 1) << " Address: 0x" << hex << portAddress << endl;
        } else {
            cout << "LPT" << (i + 1) << " not installed." << endl;
        }
    }
    
    
    unsigned int timeoutConstant = *((unsigned int far*)MK_FP(0x40, timeoutAddress));
    cout << "Timeout Constant: 0x" << hex << timeoutConstant << endl;
}
Leave a Comment