Since parallel ports don't have the number of lines required to handle an 8 bit bidirectional signal + control lines like the Comms-Link board, that is 16 data lines + control, the Freewing IF nibbles bytes it trasfers to the AR/GS. That is, it must cut a byte (8 Bits) into two 4 bit nibbles. But then a cleaver combo of Hardware/sofware should be used to construct/deconstruct these nibbles back and forth into the AR/GS cartridge.
The following is the Freewing software driver if we wanted to send /get some data to/from our AR/GS.
From Parts.txt found on par_hard.lzh:
void DelayLPT(void);
//==============================================
int ParOutInpDataLPT_PC(uint AnOutData, uint &AnInpData)
{
int bFlag = NG;
uint nCount = 30000;
uint n = 0x00100;
uchar bDatXor = 0x00b;
bDatXor = 0x000;
outp(0x0378+2, 0x002 ^ bDatXor);
DelayLPT();
outp(0x0378, AnOutData); // SET DATA
DelayLPT();
outp(0x0378+2, 0x003 ^ bDatXor); // STROBE
DelayLPT();
outp(0x0378+2, 0x002 ^ bDatXor);
DelayLPT();
Dprintf("o:%02X\n", AnOutData);
while (nCount--) {
AnInpData = inp(0x0378+1); // STATUS
if (GSbParDebugPrintf == ON) {
if (n != AnInpData) {
Dprintf("s:%02X\n", AnInpData);
n = AnInpData;
}
}
if ( (AnInpData & 0x080) ) { // ACK ?
bFlag = OK;
break;
}
}
outp(0x0378+2, 0x00a ^ bDatXor);
DelayLPT();
n = inp(0x0378+1);
AnInpData = (n >> 3) & 0x00f; // GET DATA L
outp(0x0378+2, 0x008 ^ bDatXor);
DelayLPT();
n = inp(0x0378+1);
n = (n << 1) & 0x0f0; // GET DATA
H
AnInpData |= n;
outp(0x0378+2, 0x002 ^ bDatXor);
Dprintf("i:%02X\n", AnInpData);
return (bFlag);
}
void DelayLPT(void)
{
return; // DUMMY WAIT
}