Dosbox cant Printing to Linux Machines without real Printerport, The Page Layout dont Match. We need any virtual parallel Port.
I tried to use Dosbox with internal OrangePi PC Serial Ports for ControlUnit Communication on old Industry Machine (Not Realtime, only SPS Data).. it was all good after some Modifications of SVN Code, but Printing a Certificate with Statistics of Work looks Bad. The Problem is a Postscript Parser as Printer Solution.
So i Bypassed all Parallel Port Registers in Software to mcp23017 i2C Gpio Expander directly in Dosbox Direct Printer Support.
First Ideas in Pics.
The Ready Project Sources are available on Github, linked here.
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 TODOif((val==0xAA)||(val==0x55)) LOG_MSG("TODO implement IBM-style direction switch");
}
void CDirectLPT::Timer2(void)
{
}
2
Step 2
Parse Control and Status MCP Pins to Dosbox Parallel IO Registers:
// Example program#include <iostream>#include <string>#include <bitset>intmain(){
char a = 0b00000111; //Parallel Control Byte to Parportchar 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 Dosboxchar 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;
}