SSC: Experimental support for 6551's status bits: DCD and DSR via -dcd[-invert] and -dsr[-invert] args (#386)
This commit is contained in:
parent
b377dc8afb
commit
abd99d109e
3 changed files with 54 additions and 10 deletions
|
@ -1034,6 +1034,22 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||
{
|
||||
g_bMultiMon = true;
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "-dtr") == 0) // GH#386
|
||||
{
|
||||
sg_SSC.SupportDTR(true, false);
|
||||
|
|
|
@ -721,10 +721,12 @@ BYTE __stdcall CSuperSerialCard::CommStatus(WORD, WORD, BYTE, BYTE, ULONG)
|
|||
if (!CheckComm())
|
||||
return ST_DSR | ST_DCD | ST_TX_EMPTY;
|
||||
|
||||
#ifdef SUPPORT_MODEM
|
||||
DWORD modemstatus = 0;
|
||||
GetCommModemStatus(m_hCommHandle,&modemstatus); // Returns 0x30 = MS_DSR_ON|MS_CTS_ON
|
||||
#endif
|
||||
DWORD modemStatus = 0;
|
||||
if ((m_hCommHandle != INVALID_HANDLE_VALUE) && (m_bCfgSupportDCD || m_bCfgSupportDSR))
|
||||
{
|
||||
// Do this outside of the critical section (don't know how long it takes)
|
||||
GetCommModemStatus(m_hCommHandle, &modemStatus); // Returns 0x30 = MS_DSR_ON|MS_CTS_ON
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
|
@ -757,13 +759,29 @@ 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_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
|
||||
| ((!bComSerialBufferEmpty || !m_qTcpSerialBuffer.empty()) ? ST_RX_FULL : 0x00)
|
||||
#ifdef SUPPORT_MODEM
|
||||
| ((modemstatus & MS_RLSD_ON) ? 0x00 : ST_DCD) // Need 0x00 to allow ZLink to start up
|
||||
| ((modemstatus & MS_DSR_ON) ? 0x00 : ST_DSR)
|
||||
#endif
|
||||
| (bIRQ ? ST_IRQ : 0x00);
|
||||
| DCD // Need 0x00 to allow ZLink to start up
|
||||
| DSR
|
||||
| (bIRQ ? ST_IRQ : 0x00);
|
||||
|
||||
if (m_hCommHandle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
|
|
@ -43,7 +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 SupportDTR(bool bEnable, bool bInvert) { m_bCfgSupportDTR = bEnable; m_bCfgInvertDTR = bInvert; }
|
||||
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 CommTcpSerialAccept();
|
||||
void CommTcpSerialReceive();
|
||||
|
@ -141,6 +143,14 @@ private:
|
|||
BYTE* m_pExpansionRom;
|
||||
UINT m_uSlot;
|
||||
|
||||
// DCD
|
||||
bool m_bCfgSupportDCD;
|
||||
bool m_bCfgInvertDCD;
|
||||
|
||||
// DSR
|
||||
bool m_bCfgSupportDSR;
|
||||
bool m_bCfgInvertDSR;
|
||||
|
||||
// DTR
|
||||
UINT m_uDTR;
|
||||
bool m_bCfgSupportDTR;
|
||||
|
|
Loading…
Add table
Reference in a new issue