Commodore 128 Alive!

Commodore PET => Old messages => PET programming => Topic started by: Blacklord on August 08, 2009, 08:24 AM

Title: Pet sound ?
Post by: Blacklord on August 08, 2009, 08:24 AM
Original post by APRULES2

Hi,
I was playing with the print chr$(7) command and I noticed no matter the number I put after the sound never changes I cant remember how to change the octives. Does anyone remember how?
Title: Re: Pet sound ?
Post by: Blacklord on August 08, 2009, 08:25 AM
Original post by Anders Carlsson

I don't think you can? That is a bell implemented by a summer, not programmable AFAIK. To get more musical sounds out of a PET, there is a hack one can build for the userport.
Title: Re: Pet sound ?
Post by: Blacklord on August 08, 2009, 08:25 AM
Original post by pet1978

To create sound you need to set values in the 6522 VIA chip using poke commands.

poke 59467,16  sets the shift register to free run, 0 to turn off sound
poke 59466,d   loads the shift register. d should be 15,51 or 85 for square wave
poke 59464,c   sets the shift rate. C is an integer from 0 to 255

frequency = 500000/(c*d1) where d1=8 for d of 15, d1=4 for d of 51, d1=2 for d of 85

So try:

10 poke 59467,16 : poke59466,51
20 for t = 1 to 12
30 read c : poke59464,c
40 for y = 1 to 100 : next
50 next t
60 poke59467,0
70 data 237,211,188,177,157,140,124,117,104,93,88,78
EhPortal 1.34 © 2026, WebDev