Chapter 7 of 8
Send a receipt, a tune, or a voice
Where would you look for a message that BASIC printed, but that never appeared on the screen? On a real CoCo you might have heard a printer start up at the other end of the serial cable. In VCC Plus you can catch that same stream of characters in a window. With another piece of equipment in a cartridge slot, the computer can also play a score or say a sentence out loud.
Print a receipt for CARGO
Start at OK in Disk BASIC, with the tape stopped. Open Media → Printer Output…, or click the little printer behind the cassette recorder. If the window already contains a print job you want to keep, stop capture and save it first. Choose Clear… and confirm when you are ready for an empty window. Click Start Capture. Return to the CoCo display and type this line, followed by Return.
PRINT #-2,"CARGO RECEIVED"
The CoCo returns to OK. Look in Printer Output for CARGO RECEIVED and 15 bytes. Count the five letters of CARGO, one space and eight letters of RECEIVED. That makes fourteen. The last byte is a carriage return. On paper it tells the printer that the line has ended; the Mac text preview displays a new line. The #-2 in BASIC's command chose the printer as its destination.
Click Stop Capture, choose Save Text…, and open your saved receipt in a Mac text editor. To keep the exact fourteen character codes and the end-of-line byte, choose Export Raw Bytes…. The 7-bit BASIC Text switch affects the text interpretation. A printer control code may appear as a marker in the text preview. Raw export keeps the code itself, useful when examining how an older program drove a printer.
You can close the window during a print job and open it again. Capture continues until you stop it. Clear… stops capture and discards the collected output after confirmation. Stop capture between jobs: other software can use the same output register, and a long-running capture can fill up. Print… opens the ordinary Mac print dialog if you would like a paper receipt.
Score and play William Tell
Orchestra-90 contains stereo sound hardware. Its optional program ROM turns the CoCo into a music editor with a score already in memory. If you have that ROM, you can go from a quiet desk to Rossini's William Tell Overture in a few keystrokes.
- Save anything important from guest RAM and note your practice profile. Open Cartridge → Cartridges…. Choose Orchestra-90 as the device in a free Multi-Pak slot. In that slot's details confirm the 8 KiB music program ROM, or choose yours. Set Startup slot to that slot, confirm the restart and resume the machine if paused.
- At the cartridge's opening screen, give the guest keyboard focus and tap Space. Look for WILLIAM TELL OVERTURE and BY ROSSINI. Those two lines are comments identifying the score the synthesizer will use.
- Type S and press Return. Give the cartridge time to score the music. Then type P and press Return to play it. Start at a comfortable volume. The left and right channels carry distinct parts. Esc sends the CoCo's Break key if you want to stop.
- If you can see the score but hear silence, confirm the machine is running at normal speed, app sound is enabled, and the Mac output volume is up. If you return to Disk BASIC immediately after restarting, check the music ROM and its startup slot. A program can use the stereo ports without the music ROM; this particular lesson uses the program in that ROM.
Have the computer introduce itself
The Speech/Sound Cartridge takes another approach. Leave your FD-502 in startup slot 4 so BASIC boots as usual. The speech board waits for a program to send it characters. In this exercise, you can watch BASIC send a short message and hear the cartridge read it.
- Return to your saved Disk BASIC practice profile. Open Cartridge → Cartridges… and assign Speech/Sound Cartridge to free slot 2. Keep Startup slot 4. Expand the speech board's details. It needs both its internal PIC firmware and its Speech ROM. If either is missing, use Choose PIC Firmware… for pic-7040-510.bin and Choose Speech ROM… for sp0256-al2.bin. Confirm any restart and resume at OK.
- Open VOICE.bas in BASIC Development. If reading in a browser, save the file first and open it in the BASIC workspace. Save anything you want to keep from guest RAM, then choose Run in that workspace.
- Look for SENDING GREETING, then GREETING SENT. The voice says “Hello from your Color Computer.” The second screen message means the last character made it through; the voice can still be finishing the sentence. CHECK SPEECH CARTRIDGE means the program timed out waiting for the board to accept another byte. Check the assignment and both ROMs before running it again.
10 REM A GREETING FOR THE SPEECH/SOUND CARTRIDGE
20 A=&HFF7E
30 M$="HELLO FROM YOUR COLOR COMPUTER. "+CHR$(13)
40 PRINT "SENDING GREETING"
50 FOR I=1 TO LEN(M$)
60 T=0
70 IF PEEK(A)>=128 THEN 100
80 T=T+1:IF T<500 THEN 70
90 PRINT "CHECK SPEECH CARTRIDGE":END
100 POKE A,ASC(MID$(M$,I,1))
110 NEXT I
120 PRINT "GREETING SENT"
Follow one letter through the loop. Line 70 checks whether the cartridge is ready for it. Line 100 converts the letter to a character code and sends it to the board. The carriage return at the end of the string closes the message. To try another greeting, change the words inside the quotes on line 30. Keep the space and the carriage return expression at the end.
When finished, reload your saved practice configuration and check the controller and FD0 assignment. Your receipt is a Mac file, VOICE.bas is editable source, and the music you heard came from the score in cartridge memory. Each can outlast a listening session in a different way.