Chip Chat - Stephen Stratford (Your Spectrum-Issue 7-Page 69) NOTE: The correction to the m/code listing, printed in issue 9 on pages 14/15, has been included in CHIPCHAT.TAP. Talking Spectrums! Yes, it's possible - using this neat 82 byte machine code program. Any speech or noise recorded on a cassette can be reproduced on the Speccy; all that's needed is a bit of care and a few precautions. [Hex loader instructions omitted] [The auto-run program "Load Me" at the start of CHIPCHAT.TXT will load] [the m/code and execute the following actions for you. ] To use the program you must reserve some room for the speech data by typing CLEAR 32767 - this will provide space for about five seconds worth of speech data (being stored from location 32768 to 65099). You can always lower or raise RAMTOP if you wish to have longer or shorter periods of speech respectively. First of all, you must prepare a cassette recording of the five seconds of speech (or any other noise) that you wish to record on the Speccy. Type RANDOMIZE USR 65100, but do not press Enter. Press the Play button on your cassette recorder and, just as the prepared speech is about to start, press Enter. About five seconds later, the 'OK' message should pop up on-screen. If you pressed Enter too early, you can abort the program by hitting the Space key. To hear the recorded speech, type RANDOMIZE USR 65139 and listen very carefully. You may experience a lot of background noise on your recording but there are one or two things you can do to alleviate this problem: 1. Remove the MIC lead when playing the speech into the Spectrum. 2. Record your own voice, speaking in a loud and clear fashion. 3. Experiment with the tone and volume controls of your cassette machine until you get the best results. To SAVE your speech data to tape, type: SAVE "DATA SP" CODE (n+1), 65182-(n+1) Where n was the number used in the original CLEAR statement. Have fun! Below is the assembler listing of Chip Chat - note that the Hex numbers are prefixed by the hash (#) symbol. LINE LABELS MNEMONICS COMMENTS -------------------------------------------------------------------------------- 10 ; ORG 65100 20 -------------------------------------------------------------------------------- 30 HEAR RST #38 Increments the FRAMES counter and scans the keyboard. 40 DI 50 LD HL,(RAMTOP) 60 INC HL HL=RAMTOP+1 -------------------------------------------------------------------------------- 70 LOOP2 LD B,8 The number of bits per type. -------------------------------------------------------------------------------- 80 LOOP LD A,#7F 90 IN A,(#FE) A test is made to see if the Space 100 RRA key has been pressed. 110 JR NC,STOP 120 BIT 5,A A test is made to check that there is 130 IN A,(254) a signal at the EAR port. 140 JR NZ,NO! 150 SET 7,(HL) -------------------------------------------------------------------------------- 160 JOIN RLC (HL) There is a signal at the EAR port, so save it. 170 DJNZ LOOP Repeat for all eight bits. 180 INC HL 190 CALL OVER A check is made for the 'end of data' space. 200 JR C,LOOP2 If there is more room in memory, then read more data. -------------------------------------------------------------------------------- 210 STOP EI End of data recording. 220 RET -------------------------------------------------------------------------------- 230 NO! RES 7,(HL) No signal has been stored from the EAR port. 240 JR JOIN -------------------------------------------------------------------------------- 250 SPEAK RST #38 260 DI 270 LD HL,(RAMTOP) 280 INC HL 290 LOOP3 LD B,8 300 LOOP4 BIT 7,(HL) 310 IN A,(254) 320 JR NZ,YES! These lines perform similar functions to 330 RES 4,A lines 30-240, except that the data is output 340 JOIN2 OUT (254),A to the Spectrum's speakers from its memory. 350 RLC (HL) 360 DJNZ LOOP4 370 INC HL 380 CALL OVER 390 JR C,LOOP3 400 EI 410 RET 420 YES! SET 4,A 430 JR JOIN2 440 OVER LD DE,HEAR 450 PUSH HL These lines carry out the check for 460 AND A the 'out of data' space. 470 SBC HL,DE 480 POP HL 490 RET -------------------------------------------------------------------------------- 500 ; 510 RAMTOP EQU 23730 System variable. 520 ; 530 ; 540 END ------------------------------------------------------------------------------ TYPE: Utility COMMENT: This info file was typed by Jim Grimwood Downloaded from: Desert Island Disks -- http://www.image.dk/~frankie/ Maintained by: Michael Bruhn -- frankie@image.dk