Color Computer Speech and Sound Cartridge - Appendix H
Speech to Text (with screen editor)

Like the program on Page 7, this program converts text into speech. Included in this program, however, is a built-in screen editor that lets you type in a line of a maximum of 252 characters, and then alter it by typing only corrections--not the entire line.

After you type a line, you can use the following commands to move the cursor and insert and delete characters:

<left arrow>		moves cursor left (does not erase
			the character)
<right arrow>		moves cursor right
<SHIFT><left arrow>	deletes character under the cursor
<SHIFT><right arrow>	inserts a space at the cursor position
<up arrow>		moves cursor up 1 line (or to the beginning
			if used in the top line)
<down arrow>		moves cursor down 1 line (or to the end if
			used in the bottom line)
<SHIFT><up arrow>	moves cursor to the first
			character of the line
<SHIFT><down arrow>	moves cursor to the last
			character of the line
<CLEAR>			erases all characters from the
			cursor to the end of the line

(After you type a line and press <ENTER> to convert it to speech, the cursor always returns to the first character of the line.)

	10 CLS: CLEAR 2000
	20 X=&HFF00; Y=&HFF7E: POKE X+1,52
	30 POKE X+3,63: POKE X+35,60
	40 POKE (&HFF7D),1: POKE (&HFF7D,0)
	50 CF$="": FOR X=1 TO 10: READ A
	60 CF$=CF$ + CHR$(A): NEXT: B=0
	70 GOSUB 120: Z$=IN$ + " " + CHR$(13)
	80 FOR Z=1 TO LEN(Z$)
	90 IF PEEK (Y) AND 128=0 THEN 90
	100 POKE Y,ASC(MID$(Z$,Z,1))
	110 NEXT Z: B=0: GOT0 70
	120 B$=STRING$(254,32)
	130 MID$(B$,1,253)=IN$ + " "
	140 C=LEN(IN$)
	150 PRINT@ 0,B$
	160 PRINT@ B,CHR$(142);
	170 A$=INKEY$: IF A$="" THEN 170
	180 IF C<B THEN C=B
	190 PRINT@ B,MID$(B$,B+1,1);
	200 CF=INSTR(CF$,A$): IF CF THEN 250
	210 D=ASC(A$): IF D<32 OR D>96 THEN 160
	220 IF B<252 THEN B=B+1 ELSE 160
	230 PRINT@ B-1,A$;
	240 MID$(B$,B,1)=A$: GOT0 160
	250 ON CF GOT0 310,330,350,370
	260 ON CF-4 GOT0 390,420,460,470
	270 IF CF=9 THEN 290
	280 IN$=MID$(B$,1,B): C=B: GOT0 120
	290 IN$=MID$(B$,1,C)
	300 IF C>0 THEN RETURN
	310 IF B>0 THEN B=B-1
	320 GOT0 160
	330 IF B<C THEN B=B+1
	340 GOT0 160
	350 IF B>31 THEN B=B-32 ELSE B=0
	360 GOT0 160
	370 IF B<(C-32) THEN B=B+32 ELSE B=C
	380 GOT0 160
	390 MID$(B$,B+1) = MID$(B$,B+2)
	400 MID$(B$B+1,1) = ""
	410 C=C-1-(C<1): GOT0 150
	420 MID$(B$,B+2)=MID$(B$,B+2)
	430 MID$(B$,B+1,1) = " "
	440 MID$(B$,253,1) = " "
	450 C=C+1+(C>251): GOT0 150
	460 B=0: GOT0 150
	470 B=C: GOT0 150
	480 PRINT@ 0,B$: GOT0 160
	490 DATA 8,9,94,10,21,93,95,91,13,12