80 REM It will work with the Xerox as well as the Kaypro
90 REM FOR THE KAYPRO 
100 GOTO 280
110 X=(INP(STATUS)AND RMASK):RETURN
120 Y=INP(MODEM):RETURN
130 X=(INP(STATUS)AND SMASK):RETURN
140 OUT MODEM,Y:RETURN
150 GOSUB 130:IF X THEN 140 ELSE 150
160 GOSUB 110:IF X THEN 120 ELSE 160
170 GOSUB 110:IF X THEN GOSUB 120:PRINT CHR$(Y);:GOTO 170
180 Y$="":Y$=INKEY$:IF Y$=""THEN 170
190 IF Y$=T$ THEN Y$=DC3$ ELSE IF Y$=ESC$ THEN Y$=ETX$
200 IF Y$<>E$ THEN Y=ASC(Y$):GOSUB 140:GOTO 170
210 INPUT "ENTER FILE NAME TO RECEIVE? ",F$:OPEN "R",1,F$
220 FIELD 1,128 AS A$:Y=NAK:GOSUB 150:FOR I=1 TO 1E+06:PRINT I;CHR$(13);
230 C=0:GOSUB 160:IF Y=EOT THEN Y=ACK:GOSUB 150:CLOSE 1:PRINT CHR$(7):GOTO 170
240 GOSUB 160:J=Y:GOSUB 160:IF J+Y<>255 THEN C=13
250 FOR J=1 TO 128:GOSUB 160:MID$(B$,J,1)=CHR$(Y):C=C+Y:NEXT
260 GOSUB 160:C=(C AND 255):IF C<>Y THEN Y=NAK:GOSUB 150:GOTO 230
270 LSET A$=B$:PUT 1,I:Y=ACK:GOSUB 150:NEXT
280 MODEM=&H04:STATUS=&H06:RMASK=1:SMASK=4
290 B$=STRING$(128,0):ACK=6:NAK=21:E$=CHR$(5):WIDTH 255:EOT=4
300 ESC$=CHR$(27):ETX$=CHR$(3):DC3$=CHR$(19):T$="~":GOTO 170
