BeebSID

= BeebSID by Martin Barr and Tom Walker =

http://www.retrosoftware.co.uk/images/BeebSIDlogothumb.png

Licence
Non-Profit Commercial

Introduction
BeebSID is an add-on for the BBC Micro that attaches via a ribbon cable to the 1 MHz Bus and exposes a SID chip as famously employed by the Commodore 64. It was conceived from an idea by Tom Walker, built by Martin Barr and first demonstrated playing stunning 8-Bit retro music on a Master 128 running an early version of White Light at the Retro Computer Museum Open Day in Swannington, Leicestershire on the 31st May 2009.

Martin has designed, developed and ordered 25 PCBs which he will be selling for the not-for-profit price of £7. This limited number are available for pre-order now and will certainly sell out very quickly.

The hope is that one/some of the many capable hardware builders out there will volunteer to build and assemble BeebSIDs for the cost of components so that as many people as possible can benefit from this tremendous bit of kit.

Parts List
I've put together a parts list for BeebSID which follows below. I'll itemise everything with a few words of explanation where necessary and since I tend to use Rapid for most of my supplies there will mostly be a Rapid reference but this can be used to read-across (they have pictures and data-sheets) to other suppliers. Anyway, I'll just get on with it because it's surprising how verbose and time consuming these things can become…. ;)

(Oh yes, and watch out for the highly amusing err.., anomaly regarding the DC and Phono connectors!)


 * 1) BeebSID Issue 2 Printed Circuit Board - Posted: Tue December 29, 2009 10:32 [[Image:BeebSID_PCB.JPG|right|BeebSID Issue 2 Printed Circuit Board  Posted: Tue December 29, 2009 10:32]]
 * 2) IC1 : 74LS30
 * 3) IC2 : 74LS02
 * 4) IC3 : 74LS04
 * 5) * Stick with LS for these first three because the Beeb end of the 1MHz bus and (I'm assuming) SID are TTL and I can't guarantee that CMOS or HCT etc. will play ball.
 * 6) IC4 : SID 6581 (Vdd 12v) 6582 (Vdd 9v) 8580 (Vdd 9v)
 * 7) * The Vdd voltage rating is particularly relevant to the power supply components & configuration.
 * 8) IC5 : LM7805 (Both TO-220 package)
 * 9) IC6 : LM7809 (could be LM7812 – see notes)
 * 10) * The power supply side has a number of possible permutations depending on the type of SID (9v or 12v) fitted and depending on the external power supply being used. The absolute minimum config would be a 12v SID and the board being powered directly from the Beeb auxiliary power socket. In this instance, no BeebSID power components need be fitted and the 5v and 12v can be patched straight onto the board rails. The next simplest would be where a 12v SID is to be powered from a regulated (i.e. clean & stable) 12v supply and in this instance only the 5v regulator (IC5) and it's two caps need be fitted and the incoming 12v can be patched directly to the Vdd rail. Another possibility, again for a 12v SID, would be to replace the 7809 with a 7812 and then the board could be powered from a >14v supply. If doing this, bear in mind that the greater the incoming voltage, harder the regs have to work to 'dump' the excess. Thus, at say 18v incoming, the 7812 would be fine but the 7805 would be dumping 13v at say 200mA which would be a dissipation of 2.6W – getting warm!
 * 11) * All of the above is just standard DC regulation chit-chat and is not peculiar to BeebSID and the basic assumption is that a 9v SID is in use, people fit the 7805 and 7809 as advertised and power the unit from something like a 12v DC supply. In this case, LK2 is set SOUTH which take the regulated 9v to SID Vdd. If a 12v SID is being used in conjunction with a clean 12v supply then LK2 is set NORTH which will take the incoming 12v directly to the SID Vdd. Hopefully there's enough info there for folk to figure out what's needed.
 * 12) * [[Image:DC_connector_mount.JPG|left|BeebSID DC Connector Mount  Posted: Fri December 18, 2009 01:07]] This brings me to the DC power connector itself where I've subsequently discovered a layout error on my part which affects this connector, SK2, and also the Phono connector, SK1. I originally thought I'd just arbitrarily 'pad' these for flying leads to chassis (box) mounted connectors (which I still think is the better option) but I then decided that I might as well go the extra mile and use a pad layout to support PCB mount connectors. I duly imported some patterns from somewhere, tracked them in, did trial 'paper' fits and moved on. Now, I've subsequently realised that for both connector types I assumed the front and centre pin is +ve (or signal) and that the rear pad or pads are –ve (or ground). However, the reality is that they are both (of course) the opposite to my assumption and hence the pattern cannot be used as I intended. (A further shortfall of the patterns I imported is that they both employ circular pin holes when again in reality, these types of connector actually have 'tabs' which require slots in the PCB rather than holes.) Anyway, no panic, there is an easy work-round. [[Image:RCA_connector_mount.JPG|right|BeebSID RCA Connector Mount  Posted: Fri December 18, 2009 01:07]] If we are using PCB mount, we will actually solder the connectors vertically onto the PCB (sitting on their backs) by soldering the +ve (signal) tab directly to the front pad and use a short length of reasonably stiff component wire to both connect the –ve (or ground) tab to the rear PCB pad and to provide the necessary rigidity. I've done a trial fit of both types of connector to a junked PCB with similar pads as shown in the photos and happily this mounting is perfectly satisfactory.
 * 13) * That all said, I still prefer the option of using chassis-mount connectors on flying leads soldered directly to the PCB for the DC & Phono sockets (the pad layout then being irrelevant) and for the LED as this will allow much simpler and neater installation of BeebSID in a plastic box. Anyway, if you have any questions on this just ask.
 * 14) * The types I recommend are Rapid 20-0975 & 20-1120 for PCB mount and 20-1096 & 20-0226 for chassis mount.
 * 15) Q1 : IRFD9024 60V P CHANNEL DIL MOSFET (Rapid 47-0230)
 * 16) * This is for reverse-supply protection and is recommended but can be omitted by linking the D & S pads of Q1. A simple diode can be used (Cathode to S, Anode to D) but do bear in mind that there will be a 0.6v drop across a diode which may affect the 9v voltage regulator if a 'marginal' 12v supply is being used.
 * 17) C1 & C2 : 6800pf Polystyrene Axial
 * 18) * Please only use Polystyrene (Film) as other constructions will degrade the audio quality. These should be about 15mm long (body) but there is around 18mm and lots of width to play with.
 * 19) C4, C5, C6, C7, C13 : 0.1uf Disc Ceramic 5mm pin spacing
 * 20) * The following 4 Electrolytic caps are 2mm pin spacing…
 * 21) C3 : 1uf Electrolytic (probably will be 63v but not critical)
 * 22) C8 : 47uf 25v
 * 23) C9, C11 : 10uf 25v
 * 24) J1, J2 : 34-way IDC straight header plug (0.1” / 2.5mm)
 * 25) LED1 : Red LED
 * 26) * Any type will do, pins can be formed to fit as necessary (PCB is 2.5mm) but I suggest flying leads to a case-mounted LED
 * 27) R1 : 150 ohm 0.25W
 * 28) RP 1 - 4 : 2k2 x 8 SIL commoned resistor network ( 9 pin, common pin 1, 0.1” / 2.54mm)
 * 29) * (Rapid 63-0220)
 * 30) * May want to use SIL socket strip to allow optional fitting & removal ?
 * 31) LK1 & LK2 : These can just be soldered as required or pin-links (as used on Beebs etc.) can be fitted. Standard 0.1” / 2.54mm spacing.
 * 32) Other items: 3 x 14 pin DIL sockets, 1 x 28 pin DIL socket, ribbon cable (length to suit) with 2 x 34-way IDC sockets.
 * 33) * (If a ZIF socket is being considered for the SID, have a look at Rapid 22-1525 – far cheaper but a good 'half-way;' house solution.)

Tom Walker's Disks
 [[Media:BeebSID_demo.zip|BeebSID Demo]] - Tom Walker's conversion of Visage by Link/Vibrants - for BBC Micro Model B and above, with BeebSID

Tom's BeebSID Music Disks 1 & 2 For the BBC Master 128

PJ's SID Disks
Disk#1 The Bill Carr Collection (Feb 2010)

Disk#2 Music in BBC Games (May 2010)

Disk#3 The 80s (June 2010)

Disk#4 The Beatles (July 2010)

Disk#5 The Movies (Aug 2010)

Disk#6 Madonna (Oct 2010)

Disk#7 Xmas Time (Dec 2010)

Disk#8 Queen (Sept 2011)

Disk#9 1981 (Jan 2012)

PJ's SID Games
Game#1 Carousel 'O' Sid (Sept 2010)

Game#2 Beeb SID Quiz (Nov 2010)

Game#3 Nyan SID (April 2012)

Preliminary Build Instructions
Fit all components except the three LS IC's and the SID. With the board stand-alone, set LK2 south and apply 12v DC. Check that the LED lights at an appropriate brightness and using a DVM confirm that 5v DC is present at Pin 14 of each LS IC socket and at Pin 25 of the SID socket. Confirm that 9v DC is present at Pin 28 of the SID socket. Switch off, set LK2 North, switch on and confirm that 12v DC is now present at Pin 28 of the SID socket. Switch off and set LK2 as appropriate to the SID type to be fitted.

Connect the unpowered board to the Beeb 1MHz bus socket via either J1 or J2 and power up the Beeb. Confirm that the Beeb is behaving normally and switch on BeebSID. Confirm again that the Beeb is running normally and switch off both the Beeb and BeebSID. Fit the three LS IC's and switch on both BeebSID and the Beeb, again confirming normal operation of the Beeb. Switch off the Beeb and BeebSID and fit the SID chip. Switch everything on and run the short 3-Voice test program confirming that the three pure tones can be clearly heard over the monitor or Beeb audio. (For the latter, LK1 must be made.)

Note: When (if) PCB mounting an RCA Phono socket vertically (sorry about that :/) and where the RCA has an exposed metal frame, place some insulation along the edges of the socket if it is likely to bear down on any tracks on the PCB. Although the latter are lightly insulated with solder resist, the RCA connector frame may wear through this with repeated plug/unplug operations. A simple square of insulation tape would be quite adequate or the edges of the RCA frame could be 'sleeeved' with some split sleeving. You'll see what I mean if this applies to your connector and mounting position. This is just me being cautious... ;)

That's it then - run Tom's demo as above and be amazed.... :D

Example C64 BASIC SID program conversion to BBC BASIC / BeebSID
Although it's all C64 based, most SID examples are coded in C64 BASIC and 6502 assembler so are very easily ported to BeebSID by simply changing the base address of SID from $D400 (C64) to $FC20 (BeebSID). The C64 only used Peek and Poke (our d=?n and ?n=d) so lots of stuff can be converted in seconds.

First of all, over to the original author, Ray Carlsen…

For those wishing to test the 3 voices of the SID chip, I'll include a BASIC program to do that:

5 REM C64 SID 3-VOICE TEST PROGRAM 10 FORL=54272TO54296:POKEL,0:NEXT:POKE54296,15:GOSUB60 20 POKEW,17:POKEA,9:POKEHF,15:POKELF,35:POKES,128:GOSUB50:GOSUB70 30 POKEW,17:POKEA,9:POKEHF,20:POKELF,40:POKES,128:GOSUB50:GOSUB80 40 POKEW,17:POKEA,9:POKEHF,25:POKELF,50:POKES,128:GOSUB50:GOTO10 50 FORX=1TO2000:NEXTX:RETURN 60 W=54276:A=54277:HF=54273:LF=54272:S=54278:RETURN 70 W=54283:A=54284:HF=54280:LF=54279:S=54285:RETURN 80 W=54290:A=54291:HF=54287:LF=54286:S=54292:RETURN

''Line 10 resets the SID and POKEs maximum volume to the three voices. Line 20 POKEs values to voice 1 and plays a note for a few seconds. Line 30 adds voice two and plays a note mixed with voice 1 for a few seconds. Line 40 adds the third voice to the first two for a few seconds, then the program loops back to the beginning. The parameters for the three voices are in the subroutines in lines 60, 70 and 80. The subroutine in line 50 adds a delay so each voice can be monitored as the program advances. If any/all of the voices are missing or sound "muddy", suspect a bad SID.''

On the C64 the SID chip is located at address $D400 = 54272 decimal. On BeebSID, the SID chip is located at $FC20 = 64544 decimal. Therefore, all we need to do is modify any references to the C64 SID registers by adding $2820 = 10272 decimal to the register addresses. Many C64 programs sensibly only declare the base address of SID by using something such as S=54272 and then all subsequent accesses to the sequential registers are made via S+n references and in this case we only need to change to the S=54272 to S=64544. You get the idea…

Whilst C64 machine-code is of course the same 6502 'language' as on the Beeb, the BASIC has many different syntax structures and significantly for us, direct hardware control is one of them. To directly manipulate bytes of memory or hardware registers on the Beeb, we use ?A=D to put data into a location (where A is the address and D is the data) and D=?A to read a location. On the C64, the syntax is POKE A,D to write to a location and D=PEEK(A) to read a location. Therefore, to convert the above example SID program from C64 BASIC to BBC BeebSID BASIC, I've simply modified all the register references by adding 10272 and changed all POKE A,D to ?A=D as follows…

5 REM BeebSID 3-VOICE TEST PROGRAM 10 FORL=64544TO64568:?L=0:NEXT:?64568=15:GOSUB60 20 ?W=17:?A=9:?HF=15:?LF=35:?S=128:GOSUB50:GOSUB70 30 ?W=17:?A=9:?HF=20:?LF=40:?S=128:GOSUB50:GOSUB80 40 ?W=17:?A=9:?HF=25:?LF=50:?S=128:GOSUB50:GOTO10 50 FORX=1TO2000:NEXTX:RETURN 60 W=64548:A=64549:HF=64545:LF=64544:S=64550:RETURN 70 W=64555:A=64556:HF=64552:LF=64551:S=64557:RETURN 80 W=64562:A=64563:HF=64559:LF=64558:S=64564:RETURN

Of course, BBC BASIC has more sophisticated structures available and we could change the GOSUBs to PROCs etc. but that's 'off topic' for SID specific programming.

This is a trivial example but it adequately demonstrates what is needed when converting C64 SID software for use with BeebSID and hopefully between us we can start to get our teeth into converting the masses of tremendous music and audio software available for the C64. The technique for converting assembler programs is exactly the same but of course requires a liitle more analysis to determine the specific mechanisms of a given application.

Further SID Resources
A scanned PDF copy of the C64 Programmers Reference Guide, split by chapter can be found here:

http://www.commodore.ca/manuals/c64_programmers_reference/c64-programmers_reference.htm

The chapter specific to programming sound is here:

http://www.commodore.ca/manuals/c64_programmers_reference/c64-programmers_reference_guide-04-programming_sound.pdf

http://codebase64.org/doku.php?id=base:sid_programming http://www.atarimagazines.com/compute/issue146/G3_SID_simplified.php http://digilander.libero.it/ice00/tsid/index.html