/*
SCCEMDEV.c
Copyright (C) 2012 Philip Cummins, Weston Pawlowski,
Michael Fort, Paul C. Pratt
You can redistribute this file and/or modify it under the terms
of version 2 of the GNU General Public License as published by
the Free Software Foundation. You should have received a copy
of the license along with this file; see the file COPYING.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
license for more details.
*//*
Serial Communications Controller EMulated DEVice
additions for LocalTalk networking support
Copyright 2011-2012, Michael Fort
enabled with "EmLocalTalk"
-- original description: --
Emulates the Z8530 SCC found in the Mac Plus.
But only the minimum amount needed to emulate
normal operation in a Mac Plus with nothing
connected to the serial ports.
(and not even that much is complete yet)
This code adapted from "SCC.c" in vMac by Philip Cummins.
With additional code by Weston Pawlowski from the Windows
port of vMac.
Further information was found in the
"Zilog SCC/ESCC User's Manual".
*/#ifndef AllFiles#include"SYSDEPNS.h"#include"MYOSGLUE.h"#include"EMCONFIG.h"#include"GLOBGLUE.h"#endif#include"SCCEMDEV.h"/*
ReportAbnormalID unused 0x0721, 0x0722, 0x074D - 0x07FF
*/#define SCC_dolog (dbglog_HAVE && 0)#define SCC_TrackMore 0/* Just to make things a little easier */#define Bit0 1#define Bit1 2#define Bit2 4#define Bit3 8#define Bit4 16#define Bit5 32#define Bit6 64#define Bit7 128/* SCC Interrupts */#define SCC_A_Rx 8 /* Rx Char Available */#define SCC_A_Rx_Spec 7 /* Rx Special Condition */#define SCC_A_Tx_Empty 6 /* Tx Buffer Empty */#define SCC_A_Ext 5 /* External/Status Change */#define SCC_B_Rx 4 /* Rx Char Available */#define SCC_B_Rx_Spec 3 /* Rx Special Condition */#define SCC_B_Tx_Empty 2 /* Tx Buffer Empty */#define SCC_B_Ext 1 /* External/Status Change */typedefstruct{blnrTxEnable;blnrRxEnable;blnrTxIE;/* Transmit Interrupt Enable */blnrTxUnderrun;blnrSyncHunt;blnrTxIP;/* Transmit Interrupt Pending */#if EmLocalTalkui3rRxBuff;#endif#if EmLocalTalk/* otherwise TxBufferEmpty always true *//*
though should behave as went false
for an instant when write to transmit buffer
*/blnrTxBufferEmpty;#endif#if EmLocalTalk || SCC_TrackMoreblnrExtIE;#endif#if SCC_TrackMoreblnrWaitRqstEnbl;#endif#if SCC_TrackMoreblnrWaitRqstSlct;#endif#if SCC_TrackMoreblnrWaitRqstRT;#endif#if SCC_TrackMoreblnrPrtySpclCond;#endif#if SCC_TrackMoreblnrPrtyEnable;#endif#if SCC_TrackMoreblnrPrtyEven;#endif#if SCC_TrackMoreblnrRxCRCEnbl;#endif#if SCC_TrackMoreblnrTxCRCEnbl;#endif#if SCC_TrackMoreblnrRTSctrl;#endif#if SCC_TrackMoreblnrSndBrkCtrl;#endif#if SCC_TrackMoreblnrDTRctrl;#endif#if EmLocalTalk || SCC_TrackMoreblnrAddrSrchMd;#endif#if SCC_TrackMoreblnrSyncChrLdInhb;#endif#if SCC_TrackMoreui3rClockRate;#endif#if SCC_TrackMoreui3rDataEncoding;#endif#if SCC_TrackMoreui3rTRxCsrc;#endif#if SCC_TrackMoreui3rTClkSlct;#endif#if SCC_TrackMoreui3rRClkSlct;#endif#if SCC_TrackMoreui3rRBitsPerChar;#endif#if SCC_TrackMoreui3rTBitsPerChar;#endif#if EmLocalTalk || SCC_TrackMoreui3rRxIntMode;#endif#if EmLocalTalk || SCC_TrackMoreblnrFirstChar;#endif#if EmLocalTalk || SCC_TrackMoreui3rSyncMode;#endif#if SCC_TrackMoreui3rStopBits;#endif#if 0 /* AllSent always true */
blnr AllSent;
#endif
#if 0 /* CTS always false */
blnr CTS; /* input pin, unattached, so false? */
#endif
#if 0 /* DCD always false */
blnr DCD; /* Data Carrier Detect */
/*
input pin for mouse interrupts. but since
not emulating mouse this way, leave false.
*/
#endif
#if EmLocalTalk/* otherwise RxChrAvail always false */blnrRxChrAvail;#endif#if 0 /* RxOverrun always false */
blnr RxOverrun;
#endif
#if 0 /* CRCFramingErr always false */
blnr CRCFramingErr;
#en