Monday, July 28, 2014

Circuit Boards

In the "Shaping Up" post, I glossed over the creation of the PCBs for the Fahrfall cartridges.  These didn't just fall from the sky and you can't run down to Radio Shack to get them either!  So, let's cover this topic...

Design

The circuit board for a game cartridge tends to be just a simple "carrier board" for the EPROM containing the game.  More advanced cartridges exist, even for the CoCo.  But the starting point is just enough circuitry to support attachment of a memory chip to the computer.

Mark J. Blair, a member of the CoCo mailing list, designed such a board a while back and made it available for ordering through OSH Park.  He even went a step further and made the design files available through GitHub.  So if you need to make a ROM cartridge for a CoCo in a hurry, then now you know a good way to get the PCBs!

Produce

The boards from OSH Park are great, and the service is good.  But the prices seem a little high and I wanted to checkout some alternatives anyway.  I found Hackvana, which offers a variety of options at different price points.  I decided to use a green soldermask with the RoHS Pb-free solder finish, and I got a run of boards at a much cheaper price per board.  The boards look and work great, so I couldn't be happier.  (Note that the gold immersion finish would put the per board price much closer to the price available from OSH Park.)

Each board manufacturer tends to have slightly different preferences or requirements for how board designs are sent to them, and the Hackvana folks are no different.  Mark used the Eagle PCB design software for his design, and Hackvana offers some design rules files for Eagle on their site.  Fortunately the CadSoft folks also offer a free-as-in-beer Linux version of the Eagle software, and I was able to load the Hackvana rules into Mark's design files.  I then used another Eagle script from Hackvana to produce the required Gerber files.

http://www.tuxdriver.com/download/fahrfall/CoCoEPROMpak-Hackvana.tar.gz 

Since Mark's design is released under GPLv3, I have released a tarball at the link above with my Hackvana adaptation of Mark's design.  The orginial OSH Park Gerber files are still there if you need them as well.

Build

Building the PCB is as simple as the design itself.  There are barely any parts at all!  The first step is to install the IC socket.  This is not strictly necessary, but it does make it much easier to replace the EPROM if you want to burn a new release of Fahrfall! :-)  Also included is a small capacitor used to stabilize the power supply for the EPROM.

Mark's design can accomodate a variety of EPROM parts.  This gives some flexibility on how to populate the board, but it does require an extra step when building the cartridge hardware.  In order to accomodate different chip types, there are actually two socket locations on the board.  Choosing is not difficult -- use the one that matches the number of pins on the EPROM...

Slightly more difficult is handling the jumpers.  Mark's schematic describes how the jumpers should be set for the various EPROM options.  The PCB is intended to use removable jumpers on pin headers, but I didn't want to bother with those for this project.  Instead, I just did a little sloppy soldering and bridged the connections I wanted.  This saves me a little bit of wire trimming or parts acquisition and placement, at the cost of a little more trouble if I want to reuse the board with another EPROM later.  But really, who would ever want to replace Fahrfall??

The final step is to install the EPROM programmed with the Fahrfall code.  This requires some hardware that most people don't have.  Fortunately for me, I acquired a nice MOD-EMUP-A almost 20 years ago when I was a more active arcade collector.  I really like it, with the only caveat being that it requires an ISA card to interface to a PC running MS-DOS.  But, it works great for retro project hacking -- get one if you can! ;-)


Anyway, that about sums-up the PCB build.  From here the PCB is mounted in the cartridge case as shown in the earlier post.  It really is cool to see Fahrfall start as soon as you power-up the CoCo, and the slightly faster clocking available when running from ROM makes the audio sound a bit better as well.  I know I'm excited!  Hopefully you are excited enough to stay tuned...

Sunday, July 27, 2014

Shaping Up

The molds are made and the plastic has been poured.  Nothing else to do, right?  Well, there is a bit more...

Sanding

Any form of casting will tend to produce some flash.  These extra bits need to be removed from the parts during the finishing process.  In the case of the open top molds I am using, that flash tends to be at the top part of the mold.  Since it is difficult to make the pour fill the mold exactly with no overflow, the top tends to get an extra bit sticking out around the mold opening.

In order to remove the extra bits, I have used a sanding sponge.  This is like a soft sanding block with the sandpaper already applied.  They are convenient to use and easily adaptable to sand around corners and such.  The downside is the manual labor.  If I produce cartridge cases in quantity, I'll probably need to get a belt sander or some other labor-saving device.

Anyway, the sanding does remove some detail.  Fortunately, what we are talking about is basically just a plastic box anyway.  Besides, the rounded edges that result from the sanding have a nice "feel" in the hand, and they look a little more "hand crafted" than the injection molded cases from Tandy.  Or, maybe they just look "hand made", but that is still good enough for me.  I certainly hope that you agree!

Drilling

Whether they look "custom" or just "hand made", the cases are no good without fasteners.  They need a screw to hold them together and a couple more to hold the PCB for the game ROM.

The holes are, of course, made with drill bits.  In this case, the plastic is soft and a little precision is required.  So, I turned the drill bits by hand with just my fingers.  I used bits with a hexagonal shank designed for use with one of those "quick change" drill attachments.  The hex shank gives a little more room to grip the bit and makes it a bit easier to turn by hand.  Also, on the top a countersink bit is used to allow the main screw to be driven all the way into the case body.


The holes are filled by some small screws.  Using the screws from an original cartridge as a guide, I went to a local hardware store and found some that were approximately the same.  The holes are drilled to match the inner diameter of the screw bodies, and the threads of the screws tap into the plastic as they are driven into the case.

Mounting

The whole point of having this case is to mount a PCB to hold an EPROM programmed with Fahrfall.  Fortunately, a design is available for such a PCB, and I was able to have a batch of them manufactured by Hackvana.  I will address the board design, production, and assembly in a later post.

The PCB is held into place by two screws.  A third point of contact is provided by a plastic column molded into the cartridge case itself.  This column is one of those parts of the mold that causes problems when casting, since air easily gets trapped in the small cavity representing it.  The toothpick mentioned in the entry on casting happens to fit this hole perfectly!  Anyway, this third point of contact helps to keep the PCB aligned to connect properly when the cartridge is plugged into the CoCo.


Once the PCB is secure, the cartridge can be assembled and screwed together.  The hardware part of the project is now functional, if not quite complete.  It still could use a little dressing-up!  If you want to see what I do about that, then you'll just have to continue to stay tuned... :-)

Thursday, July 24, 2014

Pour It On

When last we left our intrepid crafter, we saw a completed silicone mold of the top half of a cartridge case.  Now, let's put something in it!

Preparation

The mold is to be filled with a plastic resin.  There are a huge variety of resins available.  They vary in material, color, transparency, flexiblity and hardness.  Honestly, I haven't messed with this stuff enough to have a well-informed opinion on the various choices.  I do find that the materials available at my local hobby store seem to be adequate for the task at hand and are relatively easy to use.

For this part of the project I am using a two-part resin that is designed for hobbyist use.  The picture on the box shows someone making a plastic car model.  Some other products seem go be geared more towards people making decorative tchotchke items for flower pots, home decor, or whatever.  Look around your local hobby store and I'm sure you can find something similar.

Other items shown are a piece cut from the bottom of a water bottle, and some toothpicks.  The bottle bottom is where I mix the two parts of the resin right before pouring.  The left over bits of the resin stick to the container used for the pour, so a disposable or recyclable container is needed unless you want to ruin your household items!  A toothpick is used to probe low parts of the mold in hopes of releasing air bubbles after the pour.

In addition to the resin, I found some dye.  The plastic I am using cures to a beige color that isn't bad, but I thought it might be nice to try adding some red instead.  The dye is mixed into the clear part of the resin before the final mix.  Be sure to remember how many drops you used if you want consistent results between multiple pours...

Pouring

There is not a lot to say about the pour itself.  The two parts of the resin are poured into the container and mixed thoroughly.  Be sure to mix well, or else the plastic may have sections that take longer to cure or which do not cure at all.  The plastic shown tends to get some irregular coloring based on the quality of the mix.  I like the marbled look that creates, but it also indicates the mix could be better...

The resin shown cures very quickly -- there is only about 90 seconds of pour time!  This makes it difficult to get a good mix, and causes some anxiety during the pour.  The item shown below was already hardening while I was still probing it with a toothpick, resulting in some irregularities near the surface toward the bottom.


Extraction

The plastic is hard enough to pull it from the mold within a few minutes, but I find that leaving it in the mold for 45+ minutes tends to get better results.  Otherwise it is sometimes still soft enough to deform or even to get some blistering on the surface of the parts.  Just be patient, and the parts will tend to come-out well!



Close inspection of the top of the piece reviews some roughness at the edges of where the mold openings had been.  Some casting flash is inevitable with either a one-part or a two-part mold, so this is not unexpected.  A little sanding will remove the roughness, albeit at the expense of the shiny finish on the top of the part.  If you want to learn more about that and other post-casting finish work, then you'll have to stay tuned!

Monday, July 21, 2014

Making An Impression

Time for some arts and crafts!  Let's jump right into getting a mold for the top half of a cartridge case...

Model

An original Tandy cartridge case seems like the obvious place to start.  It certainly meets the required measurements for the cartridge slot on the computer.  Plus, there are circuit board designs available that fit the standard case.  Hopefully no over-zealous Tandy lawyers will be coming after me!  Anyway, the intellectual property concerns over a plastic box should be limited enough to make that unattractive...hopefully...

One "interesting" part of this design is the sliding door that covers the PCB card edge.  This poses a couple of difficulties.  The least of the issues is that it requires a custom spring to shut the door when the cartridge is removed from the computer.  A bigger concern is that the shape of the door itself has multiple overhangs that make it difficult to mold.  Also, the door has a slot cut into it, which either further complicates the mold making process or requires a step to machine a slot in the pieces I produce.

Making a new spring might not be too hard?  And using a two-piece mold may solve some of the shaping problems.  But extra effort and clever mold making seems like an unnecessary complication just to produce such a superfluous piece.

So, I will eliminate the sliding door and produce a bottom part of the mold that just leaves the PCB card edge exposed.  I think that the PCB is sufficiently recessed so that the case will still protect it while being a lot easier to produce.  One issue is that this would leave an opening in the top part of the case that looks a bit unfinished.  In order to fill that, I have used some modeling clay that I have hand-sculpted into a shape that looks a bit more intentional.  Not exactly machine precision, but it serves the purpose. :-)  A little more clay was used to fill-in some holes that I don't want as part of the mold.
Case Top Model Read To Be Molded
Prep

Before we pour the mold, we need something to contain the poured silicone.  I started by drawing the outline of a box on a piece of engineering paper.  Obviously the measurements of the box are big enough to surround the cartridge case, but they also leave some space around the sides and on top to give the silicone mold some strength and stability.

I laid the paper on top of a chunk of foam board.  This craft material is strong enough to provide some structural integrity while pouring the mold, plus it has a non-porous surface that will keep the silicone in place during the pour.  I used a hobby knife to mark the corner cuts through the paper.  This was followed by using the hobby knife and a straight edge to cut-out the boundaries of the box.    Also, cuts were made along what will be the exterior edges of the bottom in order to facilitate bending-up the sides to form the shape of the box itself later.

One last step before building the box is to glue the model into place along the bottom.  This is a crucial step, because the silicone has enough weight to move the model around during the pour.  Also, the silicone could get beneath the model and essentially ruin the mold be encasing the model and forcing you to cut it apart just to retrieve the model.  Something like that will most likely render the mold unusable, so glue the model down to avoid it -- I used glue dots!

The final step is to fold-up the sides of the box and secure them into place.  For that, I used my wife's trusty hot glue gun.  Lots of "craft" people use this for everything, and it is handy stuff.  Just be careful -- not only can it burn you like a soldering iron, the hot glue will stick to you while it burns!  And it pulls body hair when you try to remove it from your skin...ask me how I know! :-)

Case Top In The Mold Box
Pour

Now it is time to pour the mold.  The product in use is a mold-making silicone.  There are a variety of options here, but for this I have chosen a product designed to be extra supple.  This helps in modeling overhangs and undercuts, and it also is a bit more pliable when it comes time to remove objects from the mold after casting...

The silicone comes in two parts, the base and a catalyst.  This product comes in a "1 pound" size, which is a lot more than I need here.  But, using it all means no messy measurements and it gives some extra "heft" to the mold.  Plus it means that I can just use the product container for the mixing and pouring.  This is my kind of recycling! :-)

It is important to mix the base and catalyst thoroughly.  A poorly mixed pour may not properly harden, ruining the mold.  The mixture has a long "work" time, so there is no need to hurry.  Be sure to stir until you get a consistent color, in this case, pink.

Once thoroughly mixed, the silicone can be poured into the mold.  It is recommended to pour slowly from one corner of the box.  I think this is intended to limit the amount of air bubbles in the mold.  Nevertheless, air bubbles will get into the mold during the pour.  Some will bubble to the top naturally, but others are happy to cuddle next to the model and ruin the mold...

There are a number of techniques for removing air bubbles, including encasing objects in a vacuum bag to remove air.  A somewhat simpler method is to shake the bubbles out.  I use a vibration table designed for use in dentist offices for making dental molds.  These can be had on eBay for a price that may or may not be reasonable, depending on your perspective...

After 20-30 minutes, most of the bubbles will have shaken their way to the surface of the silicone.  I got a bit impatient and used a tooth pick to pop all the big ones, but that probably isn't necessary.  Anyway, the product shown here has a cure time of 18 hours.  At this point the mold has to be set aside and allowed to harden.

Poured Mold Starting to Cure
Extract

The final step is removing the mold from the box and extracting the model from the mold.  Start by breaking the glue joints holding the sides of the box together.  This is not at all difficult, but sometimes it is necessary to trim some of the silicone from the edges of the box either to shape what will be the bottom of the mold or just to keep from damaging the mold itself.

Once the mold is removed from the box, it is common to find some overflow silicone has oozed over the edges of the model.  Using a hobby knife to trim the ooze helps to clean-up the edges at the top of the mold.  At this point, the model can be extracted from the mold, revealing the impression left to be filled by plastic resin later.

Silicone Mold Ready For Plastic Resin
So, that covers the process of making a silicone mold.  The process for making the mold for the bottom of the cartridge case is similar enough that I won't bother with documenting that.  The next step will be pouring some plastic resin into the mold -- be sure to stay tuned!

Tuesday, July 15, 2014

Achievement Unlocked

Very few games for the Tandy Color Computer (CoCo) 1 and 2 had any sort of in-game music.  I presume that the case is the same for the Dragon, since the game libraries for the Dragon and the CoCo were essentially the same.  Many had some sound effects or even a tune or two, but CoCo games generally halted the game action while sounds were played.  Not too long ago, I was only aware of a couple of CoCo games that had continuous in-game music.  Now I know of one more -- Fahrfall!


Hard Time

The CoCo did not have any sound hardware beyond a couple of ways to driver the speaker directly from the CPU.  Where other machines had POKEY or SID or some variant of the AY-3-8910 to do the heavy lifting for audio, the 6809 was the CoCo's sound chip!  This provides some flexibility, but it does make producing audio a burden for the programmer...

I had feared that having in-game music would require a lot of hand-crafted code modifications to perfectly time audio updates according to cycle counts in the instruction stream.  Fortunately, there is enough time left in each frame to produce a reasonable (YMMV) audio stream.  The time spent running the code produces a low-frequency hum in the audio, making the overall sound seem a bit like the speaker is behind a fan.  The tone probably horrifies a lot of audiophiles, but I think it is a clear win versus no sound at all!  I hope others agree...

Another Beta

I was a bit apprehensive about releasing another beta.  It is no secret by now that I would like to do a cartridge release of Fahrfall, and I am a bit afraid that I might cannibalize my market by releasing a nearly complete version to the world for free.  Still, I want everyone to enjoy the new Fahrfall and more testing never hurts!

Real fans will still want the cartridge.  Besides, a few less cartridges sold will mean a few less cartridge cases for me to make!  Anyway...I may still squeeze in a feature or two before a cartridge gets released... ;-)

http://www.tuxdriver.com/download/fahrfall/beta-2/

Halftime

Today marks the middle of July, so we are half way through the Summer Challenge.  So far I have made good progress on my code development, but done very little documentation on the "arts and crafts" part of the project.  I definitely have some stuff to show there, and I think this seems like a good time to pivot in that direction.

So, get ready to learn a bit about casting plastic, sanding, drilling, applying stickers, etc...and as always, stay tuned!

Friday, July 11, 2014

Fahrfall Is In Beta!

I guess it is about time for another little update.  I don't have a lot of info that I'm ready to share, so I guess I'll have to share some code for the Fahrfall fans to fondle... :-)

You Beta, You Beta, You Bet...

I'm liking the way things are looking, so I figured it was time to do a beta release.  Fahrfall Beta 1 has the following features:
  • Pace quickens over time
  • Rate of scoring increases over time
  • Rate of scoring doubles while Fahrve is falling (i.e. not standing on a platform)
  • Variety and frequency of platform appearance changes has increased significantly
So, basically this is the same version as I described in my previous updates.  It is available for download here:

http://www.tuxdriver.com/download/fahrfall/beta-1/

Sounds Of Silence

Beta 1 doesn't have any sounds (annoying or otherwise) that the Alphas didn't have.  I'm still working on some things in that department -- I think Fahrfall's fans will be pleased!  I'm know that I'm excited...

I'm not sure which direction I will go this weekend.  I'm definitely having some fun with audio, but there is the physical part of this project to cover as well.  Which to cover next?  Well, I guess you'll have to stay tuned... :-)

Tuesday, July 8, 2014

Gameplay Improvements

Well, July continues apace...I guess it is time for another update on Fahrfall's progress.  Things are looking up!  After getting my feet wet with some low hanging fruit, I moved-on to some slightly more difficult features.  For the most part, these are inspired by the past couple of years of playtesting at public events...

Pick Up The Pace

I think that Fahrfall's biggest weakness in the past has been its constant, somewhat...slow...pace.  The most common question I get after someone has tried Fahrfall for a while is "does it get any faster?"  I think that the steady pace actually leads to a lot of games ending due to the player losing mental focus...

The reason that Fahrfall has had a steady pace is because the timing of the platform movements has been driven by decrementing a counter until it hits zero.  The value of that counter was fairly small, so any adjustment of it caused big changes in the speed.  Therefore, changing the speed of the game during play was too jarring to seem reasonable.

In order to change that, I reimplemented the platform movement timer to increment by a variable value.  The movement happens when that timer count overflows.  Since it takes a reasonably big value to overflow a counter in a small number of increments, that value can be adjusted a lot more easily for a wider range of possible movement speeds.  This technique allows me to make small increases in the platform movement speed as each new platform is introduced, causing the game to gradually speed-up over time!

As the game speeds-up, playing gets a bit more difficult.  It doesn't seem fair to still award the same number of points per unit of play when the game runs a lot faster!  So, I used the same "overflow timer" technique to modify the timing for the scorekeeping.  Now the scoring becomes visibly faster as the game progresses until it tops-out at a blinding pace! :-)

Change Of Scenery

I always wanted the platforms to change as a game of Fahrfall progressed, but I had trouble determining what algorithm should drive that change.  I did modify the alpha releases to change the platforms from one solid color to the next every 64 platforms or so, but that was still a bit boring and a good player would have little trouble "wrapping" the color cycle.

The mechansm for changing the platform colors and patterns was built into Fahrfall long ago, with each platform's data structure holding pairs of graphics data representing the tops and bottoms of a platform section.  The new algorithm implemented an 8-bit LFSR where 3 bits chose one color, 3 bits chose another color, and the last 2 bits chose a pattern.  Patterns include solid parallel lines, segmented lines in alternating colors, a "checker board" pattern, and a fourth pattern that throws-in some black blocks to look a bit "twisted".  Any of the first three patterns might also look like a solid color if both color choices match.

With the new color/pattern algorithm in place, I made Fahrfall choose a new platform color/pattern every 32 platforms.  This gives a nice (albeit minor) reward to the succeeding player and helps the player to keep track of the game's progress.


Can You Hear Me?

One thing that I have always wanted to have in Fahrfall is in-game music.  Very few games for the CoCo have in-game music, and even the sound effects tend to stop the action while the sound is played.  The CoCo audio hardware completely depends on the CPU to do the heavy lifting either of feeding audio samples to the DAC or of flipping the 1-bit "beeper" output.  Realizing these facts had convinced me to put in-game audio on the "nice to have" list for Fahrfall, but nothing more.

Still, the desire was there.  Fahrfall is timed around the vertical sync output from the VDG, which is used to do most of the graphics work while no image is displayed.  There is some work done during the active display, but there are a lot of cycles still free.  I decided to experiment with playing tones _only_ during that free CPU time.  The segmented audio wave that resulted sounded a lot rougher than a constant pure tone, but it was good enough to make me explore some possibilities...

One option that I am considering is to play some sort of sound effect to add to the game's ambiance.  I was able to put together a little sample of one idea after some experimentation yesterday.  I like it, but I'll probably do something a bit different in the final version.  Nevertheless, I thought you might enjoy a taste of my thumping beat. :-)


Several people seem a bit apprehensive over that beat!  I think they might get used to it, but it doesn't really matter.  Like I said, I'll probably do something at least a bit different in the final version.  Still, I do like how that audio makes me feel when I play Fahrfall -- it is like playing Fahrfall at a rave!

Anyway, this is getting a bit long...I'll keep working on some audio options and I may have another gameplay item up my sleeve.  Plus, there is still the "arts & crafts" aspect of this project to explore...I guess you'll just have to stay tuned! :-)