/* >>:yam.h 9-6-83 */ #include "yamsys.h" /* installation specific stuff */ #ifndef XMODEM #define lprintf printf #endif /* * yam -Yet Another Modem program * Chuck Forsberg 10-18-81 * * Design goals: A general program performing the functions * of MODEM and XMODEM, easily portable to non-timesharing * computer systems. YAM facilitates communications and s/w exchange * via timesharing, RCP/M, and Bulletin Board systems. * * Coding style is/was aimed at portability and clarity. * File transfer routines are written without timing assumptions * allowing error free high speed operation even if view selected * * Comments to me at: * Chuck Forsberg * Computer Development Inc * 6700 S.W. 105th * Beaverton OR 97005 503/646-1599 * Home 503/621-3406 Voice * RBBS RCP/M 503/621-3193 * At 300, 450, or 1200 bps(212a modem) Random hours * CBBS NW 503/284-5260 * Compuserve 70715,131 * * Files: * yam.h header and globals * yamsys.h Modem port adresses, installation specific data * yam1.c First time initialization * Main command decoding * yam2.c Christensen protocol handler * yam3.c Conversation with data capture * File xmsn w/o error checking. * * yam4.c CIS A Protocol handler (see MYSYSYTEM below) * yam5.c Misc modem related functions, such as baudrate * (see yam5ap.c yamtrsbk.csm, etc.) * yam7.c Disk i/o open,close, directory * Wild card expansion, O/S related stuff * yam8.asm CRCK calculation routine. * yam9.csm CRC calculation routine, yterm(). * yam9.c C version of yam[89].asm for non-8080 CPU's. * yam10.c USQ and some time critical functions * * compiled with -e 7500 for all files and -o for yam[2357] * and yam10. * (subsets of YAM can use a lower value for -e) * * These files should be linked with yam10 first, because it * the largest set of "local globals" (i.e., cheating!). */ #ifdef CPM char defdisk; /* default disk */ char user; #define PATHLEN 20 /* plenty long */ #endif #ifdef BDSC #define FLAG char struct _buf fin,fout; int logfd; /* used by logfile */ #define stdin 0 #define stdout 1 #define stderr 4 char cfast; /* BDS C fastest access is to extern's */ char checksum; /* delcared here for speed */ unsigned oldcrc; /* accumulates CRC checksum */ int wcj, firstch, errors; FLAG firstsec; /* first sector, C instead of NAK for crc */ #endif #ifndef IOTYPE /* may be char* or unsigned for memory mapped i/o */ #define IOTYPE char #endif #define CMDLEN 132 #define SNARFBUNCH 2056 /* minimum size of buffer arranged by snarfbuf() */ #define LOWWATER 2000 /* low water value causes term to send XOFF */ #define SOH 1 #define STX 2 #define ETX 3 #define EOT 4 #define ENQ 5 #define ACK 6 #define SO 016 #define SI 017 #define DLE 020 #define XON 021 #define XOFF 023 #define NAK 025 #define CAN 030 #define ESC 033 #define WANTCRC 0103 /* send C not NAK to get crc not checksum */ #define TIMEOUT (-2) #define ERRORMAX 5 #define RETRYMAX 5 #define KSIZE 1024 /* block length with k option */ /* declare all globally used functions not returning int */ char getcty(), putcty(), *index(), *cisubstr(); unsigned getfree(); char *Version; /* version number and rev date, pointer to */ FLAG Quiet; char Ttycol, Lpcol; /* column for tab expansion */ unsigned Numsecs; /* Number of 128 byte sectors, used by compsec */ unsigned Numblks; /* Number of CP/M blocks, used by compsec */ unsigned Numfiles; /* Total number of files expanded */ unsigned Secpblk; /* Number of sectors per block */ FLAG Onetrip; /* causes exit before next prompt */ FLAG Rfile; /* receiving into a file */ FLAG Tfile; /* transmitting from a file */ FLAG Crcflg; /* 1 if using crc, 0 otherwise */ FLAG Batch; /* Batch (multi-file) xfer */ char Wcsmask; /* 7 or 8 bit mask for Christensen Protocol */ FLAG Creamfile; /* true means o.k. to blast old file on rx */ int blklen; /* length of blocks for s and r, usually 128 */ unsigned totsecs; /* accumulator of number of sectors sent/received */ unsigned toterrs; /* total number of errors in xfer(s) */ FLAG Txgo; /* file sending start/stop (XON/XOFF) */ FLAG Dumping; /* not Squelched ^R */ FLAG Pflag; /* printing the rx stuff */ FLAG Twxmode; /* Respond to a/b requests */ FLAG Cis02; /* Special functions for CIS02 access to Compuserve */ FLAG Ctlview; /* Term function shows control chars as ^char */ FLAG Jovemode; /* EMACS compatible mode for term() */ FLAG View; /* View data being transmitted/received if file xfer */ FLAG UsePutchar; /* Putcty usees putchar, allowing ^P to LST:, etc. */ FLAG Echo; /* Echo modem data back to itself only in chat */ FLAG Hdx; /* Half Duplex connection -no echo from far end */ FLAG Chat; /* treat kbd \r as crlf when chatting */ FLAG Gototerm; /* go to term after file xfer */ FLAG Exoneof; /* exit from term() when finished with file */ /* Following flags affect data as it is written to file, not captured */ FLAG Image; /* Tell it like it is. */ FLAG Zeof; /* Terminate data capture & close file on ^Z */ FLAG Squelch; /* Turn capture on after ^R, off before ^T */ char GOchar; /* normally \n; resumes sending in EOL _ CRWAIT mode */ char *Txmoname; /* asciz string corresponding to Txeoln mode */ FLAG Txeoln; /* what to do at the end of a line */ #define EOL_NOTHING 0 /* send it all as is */ #define EOL_CR 1 /* send /r only */ #define EOL_NL 2 /* send \n only */ #define EOL_CRWAIT 3 /* send \r then wait for GOchar echo */ #define EOL_CRPROMPT 4 /* send \r then wait for silence. */ #define TX_BINARY 0200 /* don't stop on CPMEOF or whatever **/ /* For controls based on time since last RX char mostly */ unsigned Timeout; /* measure of how long since last rx char */ unsigned Tpause; /* when ++Timeout==Tpause, do something ... */ FLAG Xoffflg; /* !=0 if we sent XOFF to stop the bubble machine */ FLAG Waitecho; /* Wait for echo to stop when sending file */ /* If Waitbunch, Wait for Throttle loops each waitnum tx chars */ FLAG Waitbunch; unsigned Waitnum; /* do Waitecho each time chars_sent == Waitnum */ unsigned Throttle; FLAG Txwait; /* used with throttle */ unsigned Txtimeout; /* counted down to 0, then Txwait becomes false */ unsigned T1pause; /* for setting 0.1 second timeout for readline */ char Exitchar; /* 0 or special character for exiting from term */ char Lastrx; /* last char received, for detecting CAN CAN */ /* * start, end, input, output, printer-output pointers and marker * used with data capture */ char *bufst, *bufend, *bufcq, *bufcdq, *buffcdq, *bufpcdq, *bufmark; char *lkbufcq; /* value of bufcq when last kbd char sent */ char *reptr; /* local used by replot for speed */ char *abptr; /* pointer to string to be sent, else 0 */ char *abend; /* first character after string to be sent */ unsigned Lskcnt; /* Count of lines received since last kbd char */ unsigned Nfree; /* Number of characters free in capture buf */ unsigned Bufsize; FLAG Wrapped; /* Buffer insertion pointer has wrapped around */ IOTYPE Dport; /* data port address */ IOTYPE Sport; /* status port address */ char Mstatus; /* contents of modem error register if modem error */ unsigned Baudrate; /* current baudrate */ FLAG Originate; /* Originate mode requested */ FLAG Parity; #define SEND8 0 /* RAW on Unix */ #define NORMAL 1 /* cooked o.k. on Unix */ /* following would be CBREAK on Unix */ #define EVEN7 2 #define ODD7 3 #define EVEN8 4 #define ODD8 5 #ifndef KBMASK #define KBMASK 0177 /* default strip parity bits from console kbd */ #endif char cmdbuf[CMDLEN+2], *cp; /* for commands entered directly (not argv) */ char Rname[PATHLEN], Tname[PATHLEN]; /* saved file names */ /* Some declarations for USQ feature */ #define SQMAGIC 0xFF76 /* SQueezed file prefix */ #define NUMVALS 257 /* 256 data values plus SPEOF*/ union { FILE ufbuf; char ubuf[KSIZE]; /* Decoding tree for usq feature */ struct { int children[2]; /* left, right */ } dnode[NUMVALS - 1]; } Utility; char Phone[80]; /* phone number read in from file */ /* * Unix is a trademark of Western Electric * CP/M, Digital Research * Coherent, Mark Willams Co., Chicago IL * IDRIS, Whitesmiths Co. */ /* Some #DEFINES you should know about: USERINIT this generates a call to userinit() from init() IOBYTE define this unsigned to point to memory mapped ports DEFBAUD if not defined, baudrate is read from the port USQ includes code to automatically type SQUEEZED files RESTRICTED disallows downloading of $SYS|TAG2 files, upload .com>.obj LOGTX log file name for completed file transmissions omit for no log LOGRX likewise, for files received omit for no log LOGFILE must be defined if logrx or logtx is defined. LOGUSER user number for log and lastcalr LASTCALR pathname for current caller (lastcalr with entbbs) TERMINIT string initializes terminal to default mode. TERMREPLOT string sets mode for replot; should disable line wrap. TERMRESET string sets terminal to mode for conversation with remote. PHONES file with phone numbers MYSYSTEM is string required by CIS A protocol ESC I request. If not defined, yam4 is not needed. FLIP define this if you have a "flip" routine (see yam5pmmi.c) */