November 19, 2020

ZX Spectrum Next - Internal Speaker Mini Amplifier Mod

I have recently been adding upgrades to my new ZX Spectrum Next computer. Getting it all maxed out with Ram, Wifi, Raspberry Pi Accelerator, Real-Time Clock, Internal Micro SD slot and what I will be focusing on today, which is the Internal Speaker.

If you're one of the lucky people who added an internal speaker to your ZX Spectrum Next, you most likely found out the hard way, that the output volume is way too quiet. I did.

Before realizing this, I did a lot of research on trying to figure out which speaker I should use. I tried a Piezo first and could barely hear any sound(which was a surprise, having assumed it'd be similar volume wise to an original Speccy), second a 20mm 8 Ω 1W and finally settling on a 23mm 32 Ω 1W speaker(Model: ABS-231-RC). This was the same speaker I used in my Harlequin, but was still barely audible.

After some discussion with a few others on the Spectrum Next Forums, I was directed to a Facebook post in the ZX Spectrum Next group where Neill Mitchell used a small TDA1308 Headphone Amp to boost his internal speaker audio output. This was intriguing to me, but was also something I was hoping to avoid, at first thinking I just needed to find a suitable speaker.

Well, I gave in and accepted after quite a bit of discussion along with trial and error that this was the only way the Next will be able to have good enough volume output for the Next's internal speaker. But I also wanted to try something different. When I was shopping around for different mini amps, I found the LM386 amplifiers with small potentiometers which seemed like a nice addition.

With postal deliveries across the globe being effected by Covid-19, I was impatient to wait 2 months for the very small coin sized LM386 to arrive from China, so I found a domestic LM386 board, with a much larger through-hole build, to use as a test board and received it in just a few days.

My first attempt at connecting it to the Next was not good and I could have easily fried my Next! I had connected the Negative line on the amp input to Pin 1 on J3 and the Positive line to Pin 4 on J3. This is WRONG! I Repeat WRONG! Neill Mitchell had looked over my photo and noticed I had it connected this way and informed me that although Pins 1 & 2 on the Next's J3 are Negative, they are actually connected to the 3.3V line on the Next and that it will short the 3.3V rail if the Negative input line on the amplifier is grounded(which it was). Yikes! Thanks Neill

Be careful, these two Negative lines are connected to the 3.3V rail on the Next!

Having sorted this out, I disconnected the Negative input completely and left that wire out. All of a sudden, the Next was pumping out the Manic Miner tune from the internal speaker. Yes! Progress!

Doing all of these tests with the bare board, I was curious to know how it'd sound all cased up, but the board I had was way too large. I modified it to fit inside the case, although very tight. The volume and clarity definitely suffers somewhat enclosed in the case(FYI, removing the expansion door on the back helps a bit), but it was still good enough for what I have been going for on this project. I don't expect a small 23mm speaker to have great audio quality and I still have the option of using the output jack on the back. The internal speaker for me is nice to have for a quick casual gaming session when I don't feel like switching to my powered speakers that are connected to my PC. It's also nice and neat this way with minimal wires and connections when resting on the desk.

Size comparison of the two different LM386 Amplifiers I tried

So... Finally, I received the very small coin sized LM386 amplifier from China. It took about 1.5 months or so to arrive. I studied over the board layout and came up with a nifty way to connect it all to the Next with minimal effort and without having to do any major changes to the Next's PCB. My hope is that anyone that can do some minimal soldering will be able to use this design to amplify their Next's internal speaker.

This mod allows me to hear the internal speaker from up to several feet away, it's removable and not permanent, very inexpensive and easy to do.

So, having said all of this boring stuff, grab a beer, fire up your soldering iron and let's get to work...

First you will want this version of the LM386 amplifier board. Sure, other versions will most likely work(like the large one I tested first), but this mod is designed for this particular version of the amp. I believe on eBay it had the description "DC 5V-12V LM386 electret microphone power amplifier board gain 200 times mic amp".

This is the model I am using in this project. Different LM386 boards will probably work the same, but will need to be adapted to fit the motherboard differently.

We will power this board using Pins 20 (GND) and 19 (5V) on the Next's J15 GPIO socket.

Since the Next's 2 Pin Keyboard Membrane connection occupies Pins 4 & 17 of the GPIO, it was a bit tricky figuring out how to keep this board connected directly to the Next motherboard(which I had preferred for cleanliness and stability), while keeping it from blocking the 2 Pin Keyboard Header. My solution was bending a 2 Pin Male Header, so that it could mate with the 2 Pin Female Header I soldered onto the amplifier. This keeps the amplifier from touching the membrane, while also keeping it low profile enough to fit inside the case.

This bent 2 Pin Male Header is soldered to Pins 20 & 19 on the Next's J15 GPIO connections

For the the amplifier connections:

1. solder a 2 Pin Female Header onto the amplifier's VCC Positive + and Negative - inputs. This will be what powers and secures the amplifier to the Next's motherboard. 

2. Solder the speaker wires directly to the OUT connections on the amplifier.

3. Lastly, solder a single wire directly to the Positive + MIC input on the amplifier with a 1 Pin Female Header on the end. This connects to either Pin 3 or 4 of the Next's J3 internal speaker connection. I used a Right-Angle 4 Pin Male Header for J3(which allows you to close the case when all connected).

Notice here how the angled 2 Pin Header allows clearance for the keyboard membrane. Also how it's all wired together.

This mod is about as easy as it gets for getting suitable(for me at least) volume output from the Next's internal speaker. Anyone with some soldering skills should feel pretty comfortable handling this mod. It's low profile, inexpensive and removable. It fits inside the case perfectly and securely. Doesn't get in the way of the keyboard membrane and really improves the volume output.

Low angle photo so you can see the clearance for fitting inside the case

Post installation photo. If you look closely, you can notice the potentiometer is accessible with this install.

Some final thoughts and helpful information I learned along the way:

1. It was discovered that the ESP Wifi module does add a slight bit of noise. For me personally, it wasn't very noticable with this setup. You can disable the ESP by typing REG 2,128 into Basic.

2. After everything is connected, you will most likely need to adjust the potentiometer to get proper volume output. Use a small screwdriver and very gently turn the pot clockwise while you have some audio going(I prefer the Manic Miner title screen). You can see in the above photo that after connected, the pot is visible with the bottom of the case removed. Just be gentle and careful not to short any connections while it's powered on!

3. The ZX Spectrum Next has different audio settings in the Next's NMI Menu under Settings/Sound. "IntSpeaker" allows you to turn the Internal Speaker ON/OFF and "BEEPer" allows you to use the Internal Speaker for "All" sounds (AY, Beeper, Etc) or "Int" for original Speccy beeper sounds only. The "Int" setting is slightly higher in volume because it doesn't need to split the signal between AY, Beeper, Etc. I have found that with this setup I can keep it set to the "All" setting and still get suitable volume output.

 Special Thanks to everyone at the ZX Spectrum Next forum who helped me with their helpful discussion and in particular Neill Mitchell, who had the original idea of using a small amplifier and took the time to post about it on Facebook.

LINKS:

ZX Spectrum Next Forum - Internal Speaker Topic

January 24, 2019

"The Valley" Cartridge for C64 - Interview with Dale from Dungeon Dwellers Inc.

The Valley for the Commodore 64 - Enhanced DDI Cartridge (Prototype)
A couple of months ago, I was fortunate enough to help Dale from Dungeon Dwellers Inc. test the special upcoming Cartridge release of his enhanced version of "The Valley" for the Commodore 64. In doing so, I thought it would be neat to conduct an interview for my readers about this new release.

If you aren't familiar with Dale's work, but are into the Commodore scene, you most likely have seen his influence without even knowing it. He has helped with countless projects over the years through his expertise in PCB design and engineering. He is the creator of the Magic Cart series of PCB's (Micro Magic, Black Magic, etc) and has helped with game cartridge releases such as Sydney Hunter And The Sacred Tribe & L’Abbaye des morts. Just to name a few.

He also released the enhanced DDI Telengard for the C64 and continues to perfect his digital art across the Commodore scene.

So, without further ado... Let's take a journey into The Valley!

DnR:
First off, Dale, thank you for taking the time to chat about this. I have been really excited watching this project through the different stages and now finally, seeing it coming to fruition.


DDI:
Discovering The Valley for the Commodore 64 was an unexpected connection back to the days of the Commodore PET, where a playable version of the game was first coded. It was a game I came across while sifting through a collection of primarily small text adventures released for the Commodore 64 by The Guild Adventure Software. It was one of those games that was so poorly implemented that I almost wrote it off at first glance. However, had the Commodore 64 version not been in such rough shape, I would have never explored this gem of a game. It's my pleasure to talk more about my journey into The Valley.

DnR:
Can you tell us a bit about The Valley and some of the enhancements you've made to the code for this DDI version?


DDI:
The Valley is an early micro game first published as an incomplete BASIC adventure program back in 1982 in a British magazine called Computing Today. In The Valley, experience is gained D&D style by finding treasure and killing creatures, where ultimately it's a quest to find the Helm of Evanna, the Amulet of Alarian, and the six gems that fit the Amulet. It was not written for any particular micro of the day, but rather printed in an article with a rich backstory, along with several BASIC code modules that could be adapted to the BASIC language of any machine. Additional code modules for The Valley were published in subsequent articles as well throughout 1982. And so it was adapted to a number of systems, both micro and mini systems. Several commercial versions emerged, where Argus Press who published the Computing Today article, also published a working version of The Valley on tape for the CBM PET, the Commodore 64 and several other micros. Most of the commercial versions offered very primitive graphics using the native and often monochrome character set of a given micro. There was one version published back then by The Guild Adventure Software group for the Commodore 64 that offered a custom character set and was a fairly good attempt at a commercial quality release, but was riddled with imperfections and game play that was difficult at best. It was this version I had reworked in to a playable game, correcting and enhancing the code, using the original as a framework to build out and on top of. The game lacked an end check, and being clearly a quest natured game, it definitely deserved one. Before the game was reworked, machine code was written to combine several game files in to one loadable file that could be placed on a cartridge, which is how I started to take a closer look at the game itself. From there, I started to correct graphic elements that were off, and then went on to the game mechanics to adjust the timing for combat response, and added features that never existed in the original. Some such are enhanced color coding, 7 additional character classes, randomized event descriptions, idle encounter timer, pause, stairwell logic fixes, memory arrays to track items, expanded the number of lairs and temples by four and the height of the black tower by two, expanded loads and saves, various graphic tweaks, and many more enhancements and fixes, along with algorithm tweaks that now factor in level, class and relics found. A machine code driven ending to the game was created complete with some animation and SID sound. Much of the refinement to the game was done back in 2015 to make The Valley a very enjoyable RPG in the spirit I felt the original was intended to be.

DnR:
I'd love to hear more about the special DDI Cartridge version(s) you've been designing. Can you please tell us about it and what your plans are for release?


DDI:
Back in early 2018, I started to visualize a few high calibre cartridge designs for The Valley with etched graphics for the Amulet of Alarian and the Helm of Evanna that would include LED's for the six amulet stones, along with a LED for the Amulet and the Helm as well. Knowing I could design the hardware and write the code to control them, I drafted a new PCB based on an enhanced Magic Cart design and added the code to The Valley to control the LED's. Along with the additional code, several minor imperfections have been found and corrected. Two special cartridge versions were designed, one with PCB's as a case, and the other in transparent purple acrylic. Both are high end works of digital art, comprised of military grade components and fastened with brass and stainless hardware, both engineered to be very thin. LED's in the acrylic version illuminates the PCB substrate below the etched graphics for the Helm and Amulet and looks gorgeous in low light. The LED's for the PCB cased version rise up and through the graphics, peering just above the surface, where this version of The Valley cartridge looks brilliant in a well lit room. Everytime a relic is found, the LED for it will illuminate. There's an additional array of seven LED's on the back side of the cartridge that will slowly pulsate when all items have been found and the quest is nearly won. Returning to one of the two castles in The Valley with sufficient experience and all relics found wins the game. Both cartridge versions include a red LED illuminated reset switch, and comes in a transparent flip open tape case with beautiful artwork.The Valley cartridges are out of the prototyping phase, with a commercial release of both cartridge versions in the works for early 2019 via Shareware Plus.  All cartridges for The Valley are hand crafted by DDI and will soon be available to order from the DDI Projects page, or by contacting me via sysop at sys64738.net, for anyone interested in a copy prior to the official release.

DnR:
You have designed some really cool PCB's over the years. What are some of the challenges you've faced with this cartridge design that you haven't faced before?


DDI:
The initial challenge was to design and implement graphics for the Helm and Amulet, and size them to allow for the needed trace space to implement the additional logic and components needed to support the LED's. The level of detail in the PCB graphics pushes the limits of current PCB etching capability such as the individual bricks and text in the two castles for the PCB cased version, or the detail of the intricacies within the Amulet graphic, where efforts were made to insure the fine graphic elements would resolve though the etching process and not left fused together. I was really pleased with how the styled message that lines the circumference of the Amulet is very legible, if not requiring a magnifier for many to read. The routing and layout of the PCB is much simpler by comparison to some past projects otherwise and draws on past innovations such as reverse mounted SMT LED's from the PCB's back side, which does the PCB substrate illumination beneath the etched graphics for the acrylic cased version. I enjoy and appreciate fine hardware, with the aim of every DDI project to make a digital work of art that is as enjoyable to look at on the desk as it is to plug and play.

DnR:
Following the April 1982 issue, Computing Today continued to include articles in subsequent issues, offering modification to the game code submitted by readers. Were you aware of these modifications when you began your journey into The Valley?

DDI:
Not back in 2015, where during the creation of the cartridge for The Valley, I did become aware of the subsequent articles with suggested game variations that were published for The Valley.  The DDI revision of The Valley has similar features to some of these variations, such as Circles of Sorcery will seldom raise PSI.  Likewise, the mapping of items within temples to fixate their locations in the DDI revision is similar to the variation where temples disappear after being explored, as once items are found, they will not re-appear.

DnR:
Now that you've been in the nitty-gritty of the code, do you see any chance of DDI taking this game even further, new scenarios or a sequel so to speak?

DDI:
Unlikely, as it would require a complete re-write of the code to optimize and free up memory that would be needed for such expansions.  It's certainly possible, especially in a banked cartridge format.  In that a regard, a sequel would be more likely.  The expanded number of temples, lairs and the height of the Black tower now provides a nice game length and balance such that the needed amount of experience to win the game is achieved right around the time all the items have been retrieved from the temples, lairs and the 12 levels of the Black Tower.  The Valley was something I never intended to really make a project out of.  It's similar to finding an old antique in rough shape, and once you clean one spot, you end up cleaning it all up until it shines and works as intended, and then you polish it up further and embellish it some, but try not to change it too much to preserve what it was originally meant to be.  I simply wanted to make it an enjoyable game to play, as it had a lot of potential and work put in to it, where the history of the game as an early CRPG was a very pleasant surprise.

DnR:
While on my journey through The Valley, my barbarian decided his favorite move was to decapitate stunned foes. Do you have any favorite attack combos?

DDI:
I enjoy using the PSI Lance to reduce the lethal strength of Dragons, followed by body blows to quickly dispatch and capitalize on experience.

DnR:
This game definitely has some similarities to Telengard (in both gameplay and your enhancements) and I must say, I really appreciate how you choose to enhance these games, rather than totally modify them into something else. Have you run into any other similar antiques you feel could use a good DDI polishing?

DDI:
Nothing in the dungeon queue at this time for any olde CRPG's, but you never know what may still be lurking out there.

DnR:
So what's next on the agenda for Dungeon Dwellers Inc.? Have any new projects we can look out for?

DDI:
The MasterCart II is another current project for the Commodore 64 and is a massive 6MB monolithic menu driven cartridge that can be filled up with over 250 disk based games, offering a single scrollable menu, and an infrared remote reset option for gaming from the comfort of a reclined position.  The MasterCart II is a wonderful device to store all your favorites on one cartridge, where the menu can be customized with graphics and a background SID tune, scrollable via either joystick.  The software to compile the ROM images is easy to use and does not require any advanced programming skills.  However, assembly coders will appreciate how easy and direct the banking is to implement.  Perfect for ambitious projects, the MasterCart II is ideal for implementing a massive game that has hundreds of rooms or levels.  The MasterCart II can be used to stream large files, or simply provide fast access to a large storage space for graphics, code, and SID data.  My next project will be to take a wonderful C64 classic that has had thousands of levels written for it, and implement them all in one MasterCart II cartridge, along with the several variations to the original game engine.

DnR:
This about wraps it up for this interview. Dale, my very gracious thanks on the work you've done here. You have really enhanced a somewhat simplified old RPG type-in and made it more fun to play and even interact with in the physical world with your custom cartridge. My hat is off to you. Any closing words/links you'd like to add?

DDI:
Revising The Valley has been a wonderful and entirely unexpected excursion into one of the earliest CRPG games written for Commodore machines, where creating two very unique cartridges for The Valley has been a genuine pleasure.

RELATED LINKS:

sys64738.net - Home of DDI Projects
Shareware Plus - Keep an eye open here for upcoming release info!


I'm almost there!
Dale's Jewel Case Release - Contact him for purchasing details

February 11, 2018

Commodore 128 to 64 Power Supply Adapter



A couple of months ago I picked up a boxed C64 breadbin on Craigslist. Got it home and it wouldn't fire up. The LED was dim and it was giving me a black screen. I checked the voltage output on the power supply and it looked ok, so I started looking into possible fixes for this issue and during my tests had the power supply eventually stop giving any voltage at all. It just died. I opened the power supply to find it was one of the resin covered bricks, so basically, it's a goner. I have a few Commodore 128 supplies and learned that they output the correct voltages for a C64 as well. I considered butchering one and making a dedicated C64 supply, but hated to do that, especially if the C64 had enough wrong with it, that it'd be shelved anyway. So... I looked for some ideas online and found a person who actually made an adapter with a C128 female plug on one end and a 7 Pin DIN on the other end that would plug into the power supply and then into the C64. I liked this idea and wrote to the person, but they informed me that they no longer had any of the C128 plugs to use and would need to pull some off dead C128's.

THE IDEA:

So, my quest continued to bring this old C64 to life and I got the idea to wire some sort of connector such as a Female VGA connector to the end of the C128 power supply that could connect to two separate connectors I'd make, one being a Male VGA to 7 Pin DIN (for C64) and the other a Male VGA to 5 Pin C128 plug. This way I could connect either adapter cable to the Female VGA for whichever system I wanted to power. 

I threw the idea past Dale from Dungeon Dwellers Inc during a conversation we were having and he thought it sounded good, but suggested I didn't even need to use 3 connectors and that I could just use a Male & Female 7 Pin DIN connector. This method would allow me to plug the C128 supply directly into the C64 or plug the short Female 7 Pin DIN to 5 Pin adapter in for C128. It was perfect! As they say, two heads are better than one!

GETTING STARTED:

The idea behind this was to cut about a foot long chunk from the end of the C128 power supply, wire a Male 7 Pin DIN connector to the output end of the supply to plug directly into the C64.

Then, taking the chunk I chopped off with the C128 5 Pin plug, wiring on a Female 7 Pin DIN connector that could then be plugged back into the Male end, bringing back my option of powering my C128.

Well, this works fantastic and I'll show you how I did this...

MODDING STEPS:

1. First, I studied over the pinouts for both C64 and C128 connectors to make sure I knew exactly how I was going to wire it all up without blowing anything up.


2. I opened the C128 power supply and double checked continuity from the AC/DC lines to the corresponding pins on my pinout diagram. You only have yourself to blame if you do it incorrectly, right?


Luckily, the C128 supply isn't covered in resin!

You can use these points to double check continuity to the appropriate pins

3. Cut off the C128 plug, leaving about 6-12 inches of wire to work with and separate the wires.

Cutting about a foot from the plug and separating the wires. Make sure you peel back the grounding shield and connect it with the shielding of the new DIN plugs.

4. Peel back the grounding shield and tin each of the 4 wire tips with a bit of solder and solder on the Male 7 Pin DIN in this fashion...

C128 POWER SUPPLY TO 7 PIN DIN (C64):

9VAC (Brown) to Pin 6
9VAC (White) to Pin 7
5VDC (Red) to Pin 5
GND (Black) to Pin 2

Here I show how I had to slice along the seam of the shell to allow for the C128 cable to fit (wasn't pretty, but it worked!)

5. When soldering on the Female 7 Pin DIN, just keep in mind, it's backwards from the Male. As long as you use the pinout above, this shouldn't be a problem.

All finished!

6. After you have both plugs soldered. I'd suggest double checking all your wiring using a multimeter from back inside the power supply and from both the 7 Pin DIN and the 5 Pin C128 end. If testing from the C128 plug, it should be the same as when you started. You only have one shot at doing it correctly without possibly frying your computer! I can't be responsible for any mistakes you might make here.


7. If you did everything correctly, you now have a nifty C128 power supply capable of powering either a C64 or C128! Pretty cool, I'd say!


FINAL THOUGHTS:

After I finished making this adapter, I plugged it directly into the C64 and voila! I was greeted with a bright power LED and lovely blue screen! I must admit, I was shocked it worked without needing a PLA chip, as I had read it's a very common symptom of the Commodore 64 Black Screen.

Not sure how many people are in the same situation as I, wanting to power a C64 using a C128 power supply, but if you are and you'd like to have the option of powering both, this was a $1.59 solution that works great for me!

I'd like to give a special Thank You to Dale from DDI for refining my idea and helping this come to fruition.

Cheers!