VIA 6522 Music

From: Carlsson, Anders (
Date: 2000-10-04 11:20:53

Hi folks!

Yesterday, I downloaded the English version of VIC-20 Programmer's Ref Guide,
and to my surprise, I found something I've never seen before. In the chapter
about 6522 VIA, the user port also is described and after discussing the CB2
output from the 6522, the PRG says:


> Now that you know about the USER PORT, there is a little surprise left. 
> Up to now, the VIC has had 4 musical voices...three music registers and a 
> white noise register. By connecting a small amplifier and speaker to the 
> USER PORT, and doing a little programming, you can get another musical voice.


> Most music is made up of square waves of different amplitudes and 
> frequencies. One of the functions of the 6522 chip is to generate square 
> waves through the CB2 line. If we connect the CB2 line to a speaker, we 
> will be able to hear the square waves generated by the VIC.

> NOTE: Connecting a speaker directly to CB2 may damage your VIC. You must 
> connect the speaker through an amplifier to protect the VIC.


> 1. Small battery powered speaker/amplifier
> 2. User Port Connector (12 position, 24 contact edge connector 
>    with .156" spacing
> 3. Wire


> 1. Wire the GROUND of the amplifier to the GROUND of the USER PORT (pin N).
> 2. Wire the SIGNAL of the amplifier to the CB2 output of the USER 
>    PORT (pin M).
> You are now ready to add your other voice through a BASIC program.

and then follows instructions on how to set the registers and a BASIC demo.

According to these instructions, the VIA can produce 256 notes per octave,
in three different octaves:

              500000 Hz	   Where D1 = 8 when D = 15 (POKE 37146,D)	
  FREQUENCY = ---------          D1 = 4 when D = 51   
              (C+2)(D1)          D1 = 2 when D = 85 
This means a range from 243 to 125000 Hz, if I'm not totally wrong. Compare
this with the three regular square wave voices, ranging from 33-4329, 67-8659
and 135-17320 Hz (with PAL clock, slightly different values for NTSC).

Did anyone ever try this? It sounds just as bisarre as the SOUND IN on the
SID chip (which I also never tried). I've got a spare user port connector
and could probably hook up a mono RCA plug for testing.

Mmm. Can one auto-detect if the CB2 line is connected to something, and
select music player routine based on that (for demo purposes etc) ?

/Anders Carlsson
This message was sent through the cbm-hackers mailing list.
To unsubscribe: echo unsubscribe | mail

Archive generated by hypermail 2.1.1.