MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / CommDipSw

Method CommDipSw

source/SerialComms.cpp:898–953  ·  view source on GitHub ↗

NB. Some DIPSW settings can't be read: SSC-47: Three switches are not connected to the LS365s: . SW2-6: passes interrupt requests from ACIA to the Apple II . SW1-7 ON and SW2-7 OFF: connects DCD to the DCD input of the ACIA . SW1-7 OFF and SW2-7 ON: splices SCTS to the DCD input of the ACIA (when jumper is in TERMINAL position)

Source from the content-addressed store, hash-verified

896// . SW1-7 ON and SW2-7 OFF: connects DCD to the DCD input of the ACIA
897// . SW1-7 OFF and SW2-7 ON: splices SCTS to the DCD input of the ACIA (when jumper is in TERMINAL position)
898BYTE __stdcall CSuperSerialCard::CommDipSw(WORD, WORD addr, BYTE, BYTE, ULONG)
899{
900 BYTE sw = 0;
901
902 switch (addr & 0xf)
903 {
904 case 1: // DIPSW1
905 sw = (BaudRateToIndex(m_DIPSWCurrent.uBaudRate)<<4) | m_DIPSWCurrent.eFirmwareMode;
906 break;
907
908 case 2: // DIPSW2
909 // Comms mode: SSC-23
910 BYTE SW2_1 = m_DIPSWCurrent.uStopBits == TWOSTOPBITS ? 1 : 0; // SW2-1 (Stop bits: 1-ON(0); 2-OFF(1))
911 BYTE SW2_2 = m_DIPSWCurrent.uByteSize == 7 ? 1 : 0; // SW2-2 (Data bits: 8-ON(0); 7-OFF(1))
912
913 // SW2-3 (Parity: odd-ON(0); even-OFF(1))
914 // SW2-4 (Parity: none-ON(0); SW2-3 don't care)
915 BYTE SW2_3,SW2_4;
916 switch (m_DIPSWCurrent.uParity)
917 {
918 case ODDPARITY:
919 SW2_3 = 0; SW2_4 = 1;
920 break;
921 case EVENPARITY:
922 SW2_3 = 1; SW2_4 = 1;
923 break;
924 default:
925 _ASSERT(0);
926 // fall through...
927 case NOPARITY:
928 SW2_3 = 0; SW2_4 = 0;
929 break;
930 }
931
932 BYTE SW2_5 = m_DIPSWCurrent.bLinefeed ? 0 : 1; // SW2-5 (LF: yes-ON(0); no-OFF(1))
933
934 BYTE CTS = 1; // Default to CTS being false. (Support CTS in DIPSW: GH#311)
935 if (CheckComm() && m_hCommHandle != INVALID_HANDLE_VALUE)
936 CTS = (m_dwModemStatus & MS_CTS_ON) ? 0 : 1; // CTS active low (see SY6551 datasheet)
937 else if (m_hCommListenSocket != INVALID_SOCKET)
938 CTS = (m_hCommAcceptSocket != INVALID_SOCKET) ? 0 : 1;
939
940 // SSC-54:
941 sw = SW2_1<<7 | // b7 : SW2-1
942 0<<6 | // b6 : -
943 SW2_2<<5 | // b5 : SW2-2
944 0<<4 | // b4 : -
945 SW2_3<<3 | // b3 : SW2-3
946 SW2_4<<2 | // b2 : SW2-4
947 SW2_5<<1 | // b1 : SW2-5
948 CTS<<0; // b0 : CTS
949 break;
950 }
951
952 return sw;
953}
954
955//===========================================================================

Callers 1

SSC_IOReadMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected