1HOME
2DIM a$(5001), b1$(13)
5ONERR  GOTO 3000
6REM         public domain...please share any modifications you  make!
7REM        
8REM        
9REM        
10REM        
11REM          VERSION    NAME and Changes
12REM          1.0/G.Meyer              
13REM          1.1/Jim McQuillan   
14REM           1.2/Durick Elliott
15REM        
16REM         if you change the program add name to list and up  the version number 
17REM        
18REM        
19REM        
20? "Enter Any Message. When Done   Hit <'> "
21? "if you want your message to    to type out press SMARTKEY I."
22FOR z=1 TO 5000
24GET a$(z):IF a$(z)="" THEN 24
25IF a$(z)="'" THEN 93
26? a$(z); :NEXT z
30REM 
31REM 
32REM  store a message in a$
33REM 
34REM 
93LOMEM :29000:REM          reserve space for machine code
94 location=28000: length=75
95REM          28000=begin of Machine Code. 75=length of machine  code...change these if modified  
96FOR i=location TO location+length
97READ d
98POKE i, d
99NEXT i
100REM         
101REM        
110 fetch=28000: cin=28061: cntrl=28007: numbout=28013: dump=28062: chrout=28075
111 ustat=28048: cdstat=28037: carrier=28047
120POKE 16149, 255:POKE 16150, 255:REM           removes         Coleco's   poke limitations so we can reset key buffer       lat
130GOSUB 250:REM    
135GOSUB 1001
136REM  
140REM    
150CALL cntrl
160GOSUB 170:GOTO 230:REM         wait for carrier then when     found  goto emulator
170?:?:? "Waiting for Carrier..."
180FOR i=1 TO 5000:REM           leave time for other system to  answer
190CALL cdstat:REM           carrier heard yet?
200IF PEEK(carrier)=255 THEN RETURN
205IF PEEK(64885)=27 THEN 360:REM  jumps.... to Hang-up
210NEXT i
220?:?:? "-+->No Carrier!":GOTO 360:REM            hang up     
230? "":HOME:INVERSE:? "ON-LINE":NORMAL
240GOTO 430:REM            send to terminal routine. 
248REM          
249REM          
250REM           This routine intializes the UART chip
260POKE numbout, 128:REM           null
270CALL cntrl
280POKE numbout, 64:REM           internal reset
285CALL cntrl
290POKE numbout, 79
300CALL cntrl
310FOR i=1 TO 10:NEXT i:REM           give the UART time to      catch   up.
320POKE numbout, 55
330CALL cntrl
340POKE carrier, 0:REM           set so can be detected later
345POKE numbout, 37:CALL cntrl:REM         make sure it's hung   up
350RETURN:REM           all done! everything back to normal
358REM          
359REM          
360REM           HANG-UP routine
370POKE numbout, 37
380CALL cntrl
390?:?:? "-+-> On Hook"
400?:? "Press <d> to begin over,<e> to end.":GET k$:IF k$="e" OR k$="E" THEN END
410IF k$="d" OR k$="D" THEN GOTO 100
420GOTO 400:REM           neither E nor D was pressed
428REM          
429REM          
430REM           TERMINAL EMULATOR MAIN LOOP START
440POKE 64885, 0:REM           clear keypress register
450GOSUB 570:REM            check to see if we still have        carrier  
460IF PEEK(64885)=0 THEN 500:REM            no key pressed see   if   something is coming in     
465IF PEEK(64885)=27 THEN GOTO 360:REM         <ESC>             pushed...jump  to hang up
467IF PEEK(64885)=129 THEN 2000
470 y=PEEK(64885):POKE chrout, y:REM           the keypress is   now  ready to be sent out to modem
480CALL dump:REM           send it out!
490POKE 64885, 0:REM           reset keypress register so next   one  will be detected even if same key again
500CALL ustat:REM           check for incoming data from modem
510IF PEEK(cin)=0 THEN 450:REM            no new incoming data   so   back to start of loop. 
520 q=PEEK(cin):REM           put data value so it can be        printed   easy
530IF q=16 THEN  q=64:REM           print '@' instead of ^P.     Other  filters can go here too!
531REM         needs to filter out line feeds
540? CHR$(q); :REM           show what it is
550POKE cin, 0:REM           re-set incoming flag so next pass   will be okay
560GOTO 450:REM           more torture!
568REM          
569REM          
570REM           CARRIER TEST ROUTINE
580POKE carrier, 0:REM           reset flag
590CALL cdstat
600IF PEEK(carrier)=255 THEN RETURN:REM           still on-line
610?:?:?:? "-+->CARRIER LOST":?:?:GOTO 360
949END
980REM    
981REM   
982REM  turns the modem from dialing to answering.
983REM  if you just want to dial the phone by hand then when it askes you to dial hit <O> then hit <RETURN>
990REM  
991REM 
996POKE 28013, 10:CALL 28007
997POKE 28013, 39:CALL 28007
998GOTO 136
999END
1001? "Do You Wish To <A>nswer or     <O>riginate."
1002GET b1$
1003IF b1$="a" OR b1$="A" THEN 996
1004REM 
1005REM  askes if you would like to dial or answer
1006REM 
1007? "Enter Number"
1008POKE nu, 39:CALL cn
1009GET b$
1011IF b$<>STR$(VAL(b$)) THEN RETURN
1013 b=VAL(b$)
1015IF b=0 THEN  b=10
1017FOR a=1 TO b
1020POKE nu, 37:CALL cn
1023FOR c=1 TO 50:NEXT c
1025POKE nu, 39:CALL cn
1027FOR c=1 TO 50:NEXT c
1030NEXT a
1040? b; 
1050GOTO 1009
1100END
1200REM  
1210REM  
1220REM  this is where the message that you typed in at the first of the program is sent out.
1230REM 
1240REM 
2000FOR i1=1 TO z: y=VAL(a$(i1))
2010 y=PEEK(64885):POKE chrout, y
2020CALL dump
2030IF y=0 OR y=32 THEN RETURN
2040NEXT i1
2100IF x$="a" OR x$="A" THEN POKE numbout, 7
2101? x$
2102GOTO 136
3000REM  POKE nu, 37: CALL cn: PRINT "Error": END
10000REM         ** start of Machine Code **
10001DATA         219,94,50,102,109,201
10002DATA         0,58,109,109,211,95,201
10003DATA         0,58,109,109,211,94,201
10004DATA         0,219,95,50,102,109,201
10005DATA                                                        0,219,95,183,203,79,192,195,124,109,219,95,203,127,200,62
10006DATA                                                        255,50,143,109,255,219,95,183,203,79,200,219,94,50,157,109,201  
10007DATA                                                        0,0,219,95,203,87,202,158,109,58,171,109,211,94,201,0    
