• 1
    Bitu CDirectLPT::Read_PR() {
    	Bitu retval;
    	//ioctl(porthandle, PPRDATA, &retval);
    	return retval;
    Bitu CDirectLPT::Read_COM() {
    	Bitu retval;
    	//ioctl(porthandle, PPRCONTROL, &retval);
    	return retval;
    Bitu CDirectLPT::Read_SR() {
    	//Bitu retval;
    	//ioctl(porthandle, PPRSTATUS, &retval);
    	char b = wiringPiI2CReadReg8 (porthandle, 0x13);
    	char retval=(b&2)<<5|(b&4)<<5|(b&8)<<2 |(b&16)|(b&64)>>3;
    	LOG_MSG("printer raw status: %x",retval);
    	LOG_MSG("printer oldraw statustesrt: %x",b);
    	return retval;
    void CDirectLPT::Write_PR(Bitu val){
    	//ioctl(porthandle, PPWDATA, &val); 
    	 wiringPiI2CWriteReg8 (porthandle, 0x12, val);
    	 LOG_MSG("parallel%d: ",val); //Set all Datapins GPIOA
    void CDirectLPT::Write_CON(Bitu val) {
    	//ioctl(porthandle, PPWCONTROL, &val); 
    	 Bitu controlout = (val&1)|(val&2)<<4|(val&4)<<5; //sort Controlbyte to GPIOB Outputs, Automatic Write only outputs eg Register OLATB
         wiringPiI2CWriteReg8 (porthandle, 0x13,controlout);
    void CDirectLPT::Write_IOSEL(Bitu val) {
    	// switches direction old-style TODO
    	if((val==0xAA)||(val==0x55)) LOG_MSG("TODO implement IBM-style direction switch");
    void CDirectLPT::Timer2(void)
  • 2

    Parse Control and Status MCP Pins to Dosbox Parallel IO Registers:

    // Example program
    #include <iostream>
    #include <string>
    #include <bitset>
    int main()
     char a = 0b00000111; //Parallel Control Byte to Parport
     char ro = (a&1)|(a&2)<<4|(a&4)<<5; //MCP-Byte Control Out: 10100001
    std::bitset<8> x(ro);
    std::cout << x;
    std::cout << "\r\n";
     char b = 0b01011110; //Status In, Read status from MCP and parse bits as status Byte to Dosbox
     char ri = (b&2)<<5|(b&4)<<5|(b&8)<<2 |(b&16)|(b&64)>>3; //StatusByte MCP Read Return as Status: 11111000
    std::bitset<8> z(ri);
    std::cout << z;