mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-30 09:30:15 +00:00
SSC: Experimental support for 6551's DTR via -dtr or -dtr-invert args (#386)
This commit is contained in:
parent
5470febbf8
commit
6063d8e96f
@ -1034,6 +1034,14 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
||||
{
|
||||
g_bMultiMon = true;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "-dtr") == 0) // GH#386
|
||||
{
|
||||
sg_SSC.SupportDTR(true, false);
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "-dtr-invert") == 0) // GH#386
|
||||
{
|
||||
sg_SSC.SupportDTR(true, true);
|
||||
}
|
||||
else // unsupported
|
||||
{
|
||||
LogFileOutput("Unsupported arg: %s\n", lpCmdLine);
|
||||
|
@ -74,7 +74,9 @@ SSC_DIPSW CSuperSerialCard::m_DIPSWDefault =
|
||||
CSuperSerialCard::CSuperSerialCard() :
|
||||
m_aySerialPortChoices(NULL),
|
||||
m_uTCPChoiceItemIdx(0),
|
||||
m_uSlot(0)
|
||||
m_uSlot(0),
|
||||
m_bCfgSupportDTR(false), // GH#386 - don't support by default until we have confirmed it works
|
||||
m_bCfgInvertDTR(false)
|
||||
{
|
||||
memset(m_ayCurrentSerialPortName, 0, sizeof(m_ayCurrentSerialPortName));
|
||||
m_dwSerialPortItem = 0;
|
||||
@ -111,6 +113,8 @@ void CSuperSerialCard::InternalReset()
|
||||
m_qComSerialBuffer[0].clear();
|
||||
m_qComSerialBuffer[1].clear();
|
||||
m_qTcpSerialBuffer.clear();
|
||||
|
||||
m_uDTR = DTR_CONTROL_DISABLE;
|
||||
}
|
||||
|
||||
CSuperSerialCard::~CSuperSerialCard()
|
||||
@ -212,6 +216,7 @@ void CSuperSerialCard::UpdateCommState()
|
||||
dcb.ByteSize = m_uByteSize;
|
||||
dcb.Parity = m_uParity;
|
||||
dcb.StopBits = m_uStopBits;
|
||||
dcb.fDtrControl = m_uDTR;
|
||||
|
||||
SetCommState(m_hCommHandle,&dcb);
|
||||
}
|
||||
@ -511,10 +516,18 @@ BYTE __stdcall CSuperSerialCard::CommCommand(WORD, WORD, BYTE write, BYTE value,
|
||||
// interrupt request disable [0=enable receiver interrupts] - NOTE: SSC docs get this wrong!
|
||||
m_bRxIrqEnabled = ((m_uCommandByte & 0x02) == 0);
|
||||
|
||||
if (m_uCommandByte & 0x01) // Data Terminal Ready (DTR) setting [0=set DTR high (indicates 'not ready')]
|
||||
if (m_bCfgSupportDTR) // GH#386
|
||||
{
|
||||
// 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.
|
||||
// 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;
|
||||
}
|
||||
|
||||
UpdateCommState();
|
||||
|
@ -43,6 +43,7 @@ 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 CommTcpSerialAccept();
|
||||
void CommTcpSerialReceive();
|
||||
@ -139,4 +140,9 @@ private:
|
||||
|
||||
BYTE* m_pExpansionRom;
|
||||
UINT m_uSlot;
|
||||
|
||||
// DTR
|
||||
UINT m_uDTR;
|
||||
bool m_bCfgSupportDTR;
|
||||
bool m_bCfgInvertDTR;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user