This file contains instructions for capturing and then tokenizing a
simple terminal program that will allow you to use Xmodem to download another
program of your choice.  The tokenizing instructions are from John Iannetta,
73510,2152; the communications program was written by Gary Farmaner,
76703,3050.

     Use your capture buffer to store this information to a disk, if at all
possible.  You may wish to print it out for reference after you've captured
it.  If you don't have a capture buffer, press control-S to stop the screen
while you copy down the information, then press control-Q to start the scroll
again.

To tokenize the file into a BASIC program, type in the following
lines:

500 printchr$(147);"run500"
550 poke152,1
600 get#8,a$:printa$;
650 ifa$=chr$(13)then800
700 ifstthenclose8:end
750 goto600
800 poke631,19:poke632,17:poke633,13
850 poke634,19:poke635,13:poke198,5

    With that program in memory, in direct mode, type in:

open8,8,8,"filename"  (using whatever you have called your disk file of
                       SIMPLE.TXT)

and press return.  Then RUN the program.

     You should wind up with the tokenized form of SIMPLE.TXT in memory,
followed by:

450 end

and then the above lines.  That program can then be SAVEd to disk.

     If you are using a CBM 1670 modem, you will probably have to press
Commodore-H right after running the program.  Otherwise, the modem will try to
connect at 1200 bps.

Here is the program listing for SIMPLE.TXT:
     This is a very simple Xmodem terminal program.  If you did not use the
tokenizing instructions, type it in exactly as written, and make sure you
proofread thoroughly before you run it.  C128 owners be sure to note the
necessary changes in lines 30 and 430.

    This runs in 300 baud only.  If you have a Hayes compatible modem, you
can use the AT commands to dial and connect.  If you have an auto-dial modem
that is not Hayes compatible (like a 1660, 1650, Mitey Mo, Westridge, etc)
you should run the program, then dial the telephone yourself as though you
were making a voice phone call, and when CIS answers, switch your modem to
Originate.  When CIS tells you to begin the Xmodem transfer, press
Commodore-D to begin.

10 rem simple Xmodem terminal by Gary Farmaner 76703,3050
20 :
30 rem make this line FAST:BANK15 for C128 mode (80 columns)
40 open2,2,0,chr$(6)+chr$(0)
50 poke 56579,38:printchr$(14)
60 :
70 get#2,c$:if c$="" then150
80 c=asc(c$)and127:if c>96 then c=c-32:goto130
90 if c>64 and c<91 then c=c or128:goto130
100 if c=13 then printchr$(13)chr$(145);:goto150
110 if c=10 then c=17:goto130
120 if c=8 then c=20
130 printchr$(c);:goto70
140 :
150 getk$:if k$="" then70
160 k=asc(k$):if k=172 then gosub260:goto70
170 if k=180 then p=peek(56577):poke56577,(pandnot32)or(notpand32):goto70
180 if k=20 then k=8:goto220
190 if k<65 then 220
200 if k>64 and k<91 then k=k+32:goto220
210 if k>128 then k=kand127
220 print#2,chr$(k);:goto70
230 :
240 rem download using Xmodem
250 :
260 n$="":input"Filename";n$:if n$="" then return
270 print "Device number 8"chr$(157)chr$(157)chr$(157);:inputdv
280 printchr$(17)"Downloading: ";n$
290 open8,dv,8,n$+",p,w":b=1:print
300 v$=chr$(21)
310 :
320 print#2,v$;:poke161,0
330 ifpeek(161)=3 then330
340 get#2,c$:if c$="" then330
350 if c$=chr$(4) then close8:print#2,chr$(6);:print:print"Done":return
360 if c$<>chr$(1) then340
370 gosub430:b1=c:gosub430:ck=0
380 for x=0to127:gosub430:poke49152+x,c:ck=(ck+c)and255:next
390 gosub430:if b<>b1 or c<>ck then print"*";:goto300
400 for x=0to127:print#8,chr$(peek(49152+x));:next
410 print"-";:v$=chr$(6):b=(b+1)and255:goto320
420 :
430 if peek(667)=peek(668)then430:rem peek(2584),peek(2585) for C128
440 get#2,c$:c=asc(c$+chr$(0)):return

