388
Using
Peripheral
Devices
20
P0KE64784,(PEEK(64784)0R64)
30
FORI=1TO5OO:1TEXT
40
PRIITTCHR$(145)//WAITINGP0RCALL//
50
IPPEEK(64784)A]SrD128THEMr50
60
PRI1TT"CALL
RECEIVED77
70
P0KE64784,(PEEK(64784)AUD191)
80
PRINT''CALL
ANSWERED"
90 OPEN1,2,O,CHR$(22)+CHR$(5)
100
GET#lrAt:IPA$O////THEITPRimiA$;
110
GETA$:IFA$=""THElT100
120
IPA$=CHR$(171)THEW150
130
PRINT#l,A$;:PRim'A$;
140
GOTO100
150
CL0SE1
160
P0KE64784,(PEEK(64784)0R64)
Line-by-Line
Explanation
10
Remind
the
user
he
or
she
is
answering.
20
Hang
up
the
phone.
30
Wait.
40
Print
the
wait
message.
50
Wait
for
a
ring.
60
Print the
received
message.
70
Pick
up
the
phone.
80
Print
the
answered
message.
90
Open
the
RS232
port.
100
Get
a
byte
from
the
RS232
buffer;
if
not
a
null,
print
it
on
the
screen.
110
Get
a
byte
from
the
keyboard;
if
a
null,
go
back
to
100.
120
Check
for
Q
key
pressed
with
Q
key
to
quit.
130
Send
the
character
to
RS232.
140
Go
back
to
100.
150
Close
the
RS232
port.
160
Hang
up
the
phone.