SSC: Added -modem switch (for dcd,dsr,dtr) and removed invert switches (#386)

This commit is contained in:
tomcw 2017-03-23 21:36:26 +00:00
parent 82302c19ce
commit 1bd85e123e
3 changed files with 17 additions and 43 deletions

View File

@ -1036,27 +1036,21 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
}
else if (strcmp(lpCmdLine, "-dcd") == 0) // GH#386
{
sg_SSC.SupportDCD(true, false);
}
else if (strcmp(lpCmdLine, "-dcd-invert") == 0) // GH#386
{
sg_SSC.SupportDCD(true, true);
sg_SSC.SupportDCD(true);
}
else if (strcmp(lpCmdLine, "-dsr") == 0) // GH#386
{
sg_SSC.SupportDSR(true, false);
}
else if (strcmp(lpCmdLine, "-dsr-invert") == 0) // GH#386
{
sg_SSC.SupportDSR(true, true);
sg_SSC.SupportDSR(true);
}
else if (strcmp(lpCmdLine, "-dtr") == 0) // GH#386
{
sg_SSC.SupportDTR(true, false);
sg_SSC.SupportDTR(true);
}
else if (strcmp(lpCmdLine, "-dtr-invert") == 0) // GH#386
else if (strcmp(lpCmdLine, "-modem") == 0) // GH#386
{
sg_SSC.SupportDTR(true, true);
sg_SSC.SupportDCD(true);
sg_SSC.SupportDSR(true);
sg_SSC.SupportDTR(true);
}
else // unsupported
{

View File

@ -75,8 +75,9 @@ CSuperSerialCard::CSuperSerialCard() :
m_aySerialPortChoices(NULL),
m_uTCPChoiceItemIdx(0),
m_uSlot(0),
m_bCfgSupportDTR(false), // GH#386 - don't support by default until we have confirmed it works
m_bCfgInvertDTR(false)
m_bCfgSupportDCD(false),
m_bCfgSupportDSR(false),
m_bCfgSupportDTR(false)
{
memset(m_ayCurrentSerialPortName, 0, sizeof(m_ayCurrentSerialPortName));
m_dwSerialPortItem = 0;
@ -518,16 +519,8 @@ BYTE __stdcall CSuperSerialCard::CommCommand(WORD, WORD, BYTE write, BYTE value,
if (m_bCfgSupportDTR) // GH#386
{
// Legacy comment - inaccurate? (see docs\SSC Memory Locations for Programmers.txt)
// . Note that, although the DTR is generally not used in the SSC (it may actually not be connected!),
// it must be set to 'low' in order for the 6551 to function correctly.
// Data Terminal Ready (DTR) setting [0=set DTR high (indicates 'not ready')]
const bool bDTR_Ready = (m_uCommandByte & 0x01) ? true : false;
if (bDTR_Ready)
m_uDTR = !m_bCfgInvertDTR ? DTR_CONTROL_ENABLE : DTR_CONTROL_DISABLE;
else
m_uDTR = !m_bCfgInvertDTR ? DTR_CONTROL_DISABLE : DTR_CONTROL_ENABLE;
m_uDTR = (m_uCommandByte & 0x01) ? DTR_CONTROL_ENABLE : DTR_CONTROL_DISABLE;
}
UpdateCommState();
@ -762,19 +755,13 @@ BYTE __stdcall CSuperSerialCard::CommStatus(WORD, WORD, BYTE, BYTE, ULONG)
BYTE DCD = 0;
BYTE DSR = 0;
if ((m_hCommHandle != INVALID_HANDLE_VALUE) && (m_bCfgSupportDCD || m_bCfgSupportDSR))
if ((m_hCommHandle != INVALID_HANDLE_VALUE) && (m_bCfgSupportDCD || m_bCfgSupportDSR)) // GH#386
{
if (m_bCfgSupportDCD)
{
DCD = (modemStatus & MS_RLSD_ON) ? 0x00 : ST_DCD;
if (m_bCfgInvertDCD) DCD = (DCD == 0) ? ST_DCD : 0;
}
if (m_bCfgSupportDSR)
{
DSR = (modemStatus & MS_DSR_ON) ? 0x00 : ST_DSR;
if (m_bCfgInvertDSR) DSR = (DSR == 0) ? ST_DSR : 0;
}
}
BYTE uStatus = ST_TX_EMPTY

View File

@ -43,9 +43,9 @@ public:
char* GetSerialPortName() { return m_ayCurrentSerialPortName; }
void SetSerialPortName(const char* pSerialPortName);
bool IsActive() { return (m_hCommHandle != INVALID_HANDLE_VALUE) || (m_hCommListenSocket != INVALID_SOCKET); }
void SupportDCD(bool bEnable, bool bInvert) { m_bCfgSupportDCD = bEnable; m_bCfgInvertDCD = bInvert; } // Status
void SupportDSR(bool bEnable, bool bInvert) { m_bCfgSupportDSR = bEnable; m_bCfgInvertDSR = bInvert; } // Status
void SupportDTR(bool bEnable, bool bInvert) { m_bCfgSupportDTR = bEnable; m_bCfgInvertDTR = bInvert; } // Control
void SupportDCD(bool bEnable) { m_bCfgSupportDCD = bEnable; } // Status
void SupportDSR(bool bEnable) { m_bCfgSupportDSR = bEnable; } // Status
void SupportDTR(bool bEnable) { m_bCfgSupportDTR = bEnable; } // Control
void CommTcpSerialAccept();
void CommTcpSerialReceive();
@ -143,16 +143,9 @@ private:
BYTE* m_pExpansionRom;
UINT m_uSlot;
// DCD
// Modem
bool m_bCfgSupportDCD;
bool m_bCfgInvertDCD;
// DSR
bool m_bCfgSupportDSR;
bool m_bCfgInvertDSR;
// DTR
UINT m_uDTR;
UINT m_uDTR;
bool m_bCfgSupportDTR;
bool m_bCfgInvertDTR;
};