Path: utzoo!utgpu!watmath!isishq!f171.n221.z1.FIDONET.ORG!izot From: izot@f171.n221.z1.FIDONET.ORG (Geoffrey Welsh) Newsgroups: comp.sys.cbm Subject: How to use CB2 on PET's Message-ID: <1646.23FB6F19@isishq.FIDONET.ORG> Date: 15 Feb 89 14:30:25 GMT Sender: ufgate@isishq.FIDONET.ORG (newsout1.25) Organization: FidoNet node 1:221/171 - Izot's Swamp, Kitchener ON Lines: 64 > From: sjk@utastro.UUCP (Scot Kleinman) > Message-ID: <3617@utastro.UUCP> > A while ago, someone asked how to make music (?) through the CB2 on his > 8096. Attempts at E-Mail failed, so I am posting my reply. > Ok, what you need are a few pokes. First you must poke 59467,16 to set it > up. > Than poke 59466,timbre. This sets your timbre. Then, to get sounds (you > may > already hear something after the above poke), poke 59464,note. poke > 59464,0 to > stop playing your note, or just poke it to another value. When done, poke > 59467,0. This allows use of the tape drive again. (Apparently, pokeing it > to > 16 disallows tape drive use.) Happy music making! Let me give a more technical information. CB2 sound is made by shifting data out of the 6522 VIA's serial shift register (the same device that, on the 6526, does C128 burst mode serial transfers). POKE 59467,16 sets the shift register to shift out indefinitely (and recycle) using timer #2. Clobbering cassette would be an incidental side effect of the other bits set by that POKE. Using POKE 59467, (PEEK(59467) AND 227) OR 16 might sidestep that. The "timbre" at 59466 is the data being shifted out (the waveform). If it contains the binary pattern "10101010", then you're going to get a sqaure wave (NOTE: if it contains "11001100", you'll still get a square wave of half the frequency). Experiment for yourself to see what bit patters produce what tones. Note also that changing the waveform to divide the effective frequency by two can be used to extend the frequency range down below that offered by the timer). By now you will have guessed that 59464 is the timer value. Once it's POKEd, it is decremented every clock cycle (about 1 MHz) and is re-loaded when the count underflows (in "free-running mode"... in "one-shot" mode it stops at zero). Each time that timer 2 underflows, the shift register is shifted one bit to the left and the bit coming out of the leftmost bit is "copied" to the CB2 output. You now know more than you wanted to about PET sound. Just as a sidebar, the IBM PC uses a similar timer-underflow scheme to give its sound... but, in stead of shifting data out, it simply toggles the bit when the timer underflows (giving the standard PC less sound control than the PET)... the PCjr has a 3-voice sound generator similar to the C64's... =========================================================================== Internet: Geoffrey.Welsh@f171.n221.z1.fidonet.org | 66 Mooregate Crescent Usenet: watmath!isishq!izot | Suite 602 FidoNet: Geoffrey Welsh on 1:221/171 | Kitchener, Ontario PunterNet: 7/Geoffrey Welsh | N2M 5E6 CANADA BBS: (519) 742-8939 24h 7d 300/1200/2400bps | (519) 741-9553 =========================================================================== | "I don't need a disclaimer. No one pays any attention to what I say." | =========================================================================== -- Geoffrey Welsh - via FidoNet node 1:221/162 UUCP: ...!watmath!isishq!171!izot Internet: izot@f171.n221.z1.FIDONET.ORG