Tuesday, September 10, 2013

GameGear CPLD Cartridge

After researching PLD for my Atari dev cart, I remembered a time when I was trying to figure out a Gamegear flash cartridge. It is simple enough, but I had little luck because I was still very unlearned at the time when it came to Addressing bits.

Anyhow, I came across a Caesar's Palace Cartridge by Majesco which utilizes a CPLD! At the time I figured that I would never see one again, nor would I care at all if I were to. Now I care very much because they are pretty damn incredible devices!

The pictured CPLD is by Xilinx and now that I think about it, I really should locate it once more and dump the program on the CPLD. I dumped the game ROM, but it was exactly bit for bit the same as one I ... erm ... 'found' online.

Image Hosted by ImageShack.us Image Hosted by ImageShack.us Image Hosted by ImageShack.us

below is some pictuyres I took when I was trying to make that flash cart. I really wanted to play the Translated Phantasy Star on actual hardware, but I never got to before dropping the project.

Image Hosted by ImageShack.us

My drawing is flawed in that the highest address pins are connected to VCC and I programmed the ROM at the lowest bank which would place it at a point where the highest Address pins would all be low. Haha, silly me. had I simply filled in the extra ROM space with the ROm over and over again, it would have worked. I'll try again in the near future, no worries.

Below are more pictures of the bare board. Good times. lol
See how I ruined a few pins by pulling the pads up? That was a long time ago and I am proud to say that I can do much better.

Image Hosted by ImageShack.us


Image Hosted by ImageShack.us

Even though the game gear is a terrible handheld, battery- and longevity-wise, it uses some great technology. Some things I like the most are the fact that it has all of the fingers on one side of the board, such as the gameboy. The atari the fingers on two sides, which gets annoying when designing a board. You'll also notice that every component is Surface Mounted; caps and Mask ROM included. This makes the size of the complete board much smaller and able to fit inside of the cartridge shell much more comfortably.

I may try to make a flash cartridge in the near future. One such cartridge that will use a CPLD so we can address higher memory addresses and will utilize saving features with a battery just because it is easier. If I stuck with those parameters, it should be able to support more official games as well as any homebrew titles.

I really like looking back on past projects and seeing how I could have done them better with what I know now. I am still rather new to EE, but I have every last bit of motivation and hunger for learning. I hope I can go back to school soon. I would really like to pursue my Master's degree next if not at least another BS degree.

Thanks for reading,
Jazz

Atari 2600 Development Cartridge *Super Deluxe*~!

So I decided to design another dev cart for the Atari fully aware that there are so many others already out there. What can I add, what can I change, how can I make it smaller, cheaper and more reliable?

To begin with, I decided to go with the very most basic design: A ROM. Thats it, just ROM. As everyone else puts it, the current number of ROM chips are all low enable whereas the Atari originally used high-enable Mask ROMs for whatever reason. This means that the /CE pin must be connected to a low output, but GND may not suffice if there are timing difference with the program (or so others say). basically, the low input must be that of a low output from the address bus. Fair enough, lets sacrifice the A12 pin since most games are not above 4 Kbytes anyhow.

A12 is technically the 13th Address pin so to calculate the total addressable memory, we take A0 through A11; which is 12 pins. The numbers one and zero are the 2 useable addressing bits, so 2 to the power of 12 = 4,096. But there are 8 data pins, so 4,096 x 8-bits or 4Kbytes. That was easy! This cartridge will be able to hold software up to 4,096 bytes.

So what makes my cartridge different than others? Mostly component choices. I have a different flash rom than others use and I am also getting into SMD components. A year ago while I was working on Gameboy flash cartridges (hand-built, not professionally printed) I made a few successful carts and on a whim clouded by pure excitement I bought 50 49f040 512KByte eeproms. They were so cheap that it didn't make much of a difference...unfortunately I have been sitting on them for the entirety of that year. These chips are in the PLCC package, meaning they are surface mounted or placed in a socket. My NOT gate is also SMD. I chose the 74HCTG04 because there is only one gate and it is tiny! My decoupling cap is also SMD, but I placed the option for a through hole cap too just because I had to get the VCC trace to the bottom of the board and why not?


Image Hosted by ImageShack.us Image Hosted by ImageShack.us

So...I made a mistake. Can you see it? I chose the closest library file I could find and went with it. The 27c040 has a different pin-put than the 29f040 and 49f040. VPP is non-existent and the /WR pin is in place of A18 which has been moved to where VPP was. VPP is the programming voltage which is around +12v or something. Besides, who uses PLCC chips with UV windows anymore? lol


Image Hosted by ImageShack.us Image Hosted by ImageShack.us

Can you see the difference in the board? Probably not since it is so incredibly small of a change. Again, A18 was moved but still connects to GND and I pulled /WE high since we don't want any accidental programming. /WE is right next to VCC, so there is a tiny bridge between them.


Image Hosted by ImageShack.us Image Hosted by ImageShack.us

Here are the 3D images I created. You will notice that my QR code has holes from the drills, but actually my through-holes are all tented which means the solder mask (green stuff) goes over them. Pov-ray doesn't seem to want to display this but they are indeed. I need to figure out text though, because each time I add my URL, it is moved to the right. It bothers me and gets messed up in the gerbers and on actual boards....hmm... Another problem I have with Pov-ray is the limited 3D images. My inverter above the caps is not displayed and I have no clue on how to add more images.

Now that that board is out of the way, lets improve it! 4Kbytes is sad to program for if you have a really great idea for a game or software. How does 8Kbytes sound? Now how about 16KB or even 32KB sound!? NOW HOW ABOUT 64.....we'll do that one later. ;)

J. Grand (or Pixel Past) with Grand Idea Studios created a cartridge that uses a SPLD or Simple Programmable Logic device to add up to 32KB of addressable memory. This can be used many different ways, however the main idea is that you may access 8 banks of 4KBs by addressing "hot spots" to switch banks.

The only problem is that he wrote a program for a now-obsolete PLD. Sadly I did not find that out until after I had redesigned the above board to accommodate it. I made my own Library files and everything...

Up to this point I have a board that supports 32KBs of ROM...but the PLD cannot be found even on ebay, or at least not in the SO24 package...

By the way, if any of the readers want a library file I use or created, just ask. I would be happy to help.

Image Hosted by ImageShack.us Image Hosted by ImageShack.us Image Hosted by ImageShack.us Image Hosted by ImageShack.us
So what does one do when they need an obsolete component? Find a replacement. I went to mouser and searched thier PLD's, filtered by SPLD and again filtered by price from lowest to highest. I got rid of Through-hole ICs and found the cheapest SMT SPLD with at least 9 inputs. The result was the ATF22V10C-10SU. It has all of the pins I need, plus some and according to the datasheet is nearly a drop-in replacement for the obsolete chip!

I first created the library file based on the datasheet and an existing SO24 footprint, then I imported it into the Schematic file and removed the old PLD. Since I thought I would have to write the entire PLD program myself, I decided to move around the I/O pins to better my PLCC ROM.

Image Hosted by ImageShack.us

Not bad if I do say so myself. :) Unfortunately this is where the bad news comes in. I further looked into J. Grand and it turns out he already crated a 64KB board and ... used the same PLD as I found. Looking into his pin diagrams, he even used the same pinout as me, shy of A0 and A10 being switched. He also has the entire PLD program available for free. Here I was really excited to be able to write one of my own, but I may as well swap the two address pins and use his design...Thats right:
http://www.grandideastudio.com/wp-content/uploads/pp_atari2600_64k_schematic.pdf

He beat me to it...in 2004. Haha...

This is alright though, because I never planned on making a ROM-only cartridge anyhow. I am working my way toward a Cartridge that is capable of storing data! Yes, an Atari 2600 cartridge that will save files, progress and any other data the game dev wishes.

How can that be done...? Well, all you need is a /Write enable pin pin to go low when the /Output Enable pin goes high. And inverter you may ask? Well, sure! Why not? That could easily work, but we have an entire PLD at our disposal, so the plan is to use that and save the extra $0.05 for an inverter. This board will use the EEPROM as RAM and ROM which makes the RAM non-volatile like other cartridges that use SRAM. SRAM requires a battery to hold the data once power is disconnected.

If I design the my board around his 64KB cart, then I can switch the addressable memory to be something like 32K RAM, 32K ROM or possibly 8K ROM, 56K RAM. it would be as simple as changing a few outputs on the PLD in software so the same board could be programmed for any one of my above combinations of ROM/RAM!

Plus, the board is tiny; less than 5cmx5cm which means it can be printed cheaply! The main goal is to have some skilled person program a musical software that utilizes the save feature. I was thinking Paul Slocum, the writer of Synthcart. He has another project called Loopcart which is pretty much exactly what I want and it already can save...but unfortunately can only save with the AtariVox; an expensive and complicated attachment for atari homebrew carts which allows saving and vocal synthesis. Really cool, but beyond the requirements of my little project.

Loopcart;
http://www.qotile.net/loopcart.html

AtariVox:
http://www.richard.hutchinson.dsl.pipex.com/new_page_5.htm

AtariVox may not even be available anymore...

Going to contact Paul now. Thanks for reading!

Cheers,
Jazz

Wednesday, August 28, 2013

A New Soldering Station and a New Confidence

I SPENT REAL MONEY!

 Being as underemployed as I am it is very hard to allocate funds such as this, but I threw 80 bucks at a new soldering station because this is no longer a hobby. I may only make a little here and there, but soldering and designing electronics is now a profitable experience.

I thought to myself "If I wish to further my abilities, then I had better stop limiting myself with this horrid Radio Shack iron..." So I did. :)

I researched and asked and polled for the best station under $80 and the 'nearly' unanimous response was the Kada (or similar) 852D+ 2-in-1 SMD rework station. The one I picked up is by XPower, but it uses the same iron and case as other clones; it probably even has the same 'stolen' program as Kada's.

So far, my experience has been very positive. I haven't given it any extensive use as of yet, but my Gameboy Programmer Boards will be arriving soon! If you've read that post, they have some surface mounted IC's and I am just dying to try out my new hot air gun! I have watched a few videos on how to apply SMT chips and components with a hot air gun and solder paste. It seems as simple as if I were to glue them on and blow dry it!

Once the boards and parts arrive, I may make a video on the completion of one board. The video will also be a review of the station so that others may learn before they buy. (Though I suggest any self-respecting modder should) ;)

well here she is:


Image Hosted by ImageShack.us

I REALLY need to clean off my desk...This should fit well at the back but I still have to build my solder-smoke filters to rest underneath. Those will be another post soon enough.

Wednesday, August 21, 2013

Making Gameboy Sprites, Tiles and Maps

Just to put it on the table, you have no business creating anything for Gameboy if you have not yet read "Everything You Always Wanted To Know About GAMEBOY: but were afraid to ask."

Read it and then return for my tutorial. I can wait.

***

Now then, lets start talking about sprites, maps and other graphic elements. As you very well know, the Dot matrix gameboy displays four shades of grey (or green). Each shade is represented by two bits: 00, 01, 10 or 11 respectively. It isn't that important to know right now, but while setting up the palette in your gameboy code, it is commonly done as follows:

...
init:
ld a, %11100100 ; Window palette colors, from darkest to lightest
ld [rBGP], a        ; Load Accumulator A (11100100) into rGBP
...

Where "rBGP" Equates to $FF47, an address representative of the specially reserved I/O Register...but why am I just repeating what you have already read, right?

Now, back to the point. You may choose to design all of your characters and objects for your game strictly in binary or hexadecimal data if you wish but I prefer the visual approach. You know, the kind with a GUI. ;)

First download these two programs:
Gameboy Tile Designer: http://www.devrs.com/gb/hmgd/gbtd.html
Gameboy Map Builder: http://www.devrs.com/gb/hmgd/gbmb.html

Both of these tools will help you create and visualize the output of tiles and maps. Tiles are going to be used both for maps and for sprites, you can imagine a sprite or character figure to be a collection of tiles. Pretty simple.

You'll start by opening  Gameboy Tile Designer (or GBTD.exe). I like to keep the default color palette which is "Gameboy Pocket" because it is easier to work in shades of black rather than shades of green. Under View, I also like to switch to "simple" and use nibble markers, though they are not very easy to see. 

Image Hosted by ImageShack.us

Next select the color you would like to draw with by adding it to either your left mouse button or right mouse button by clicking on it with the corresponding button. Start filling in squares to your liking. You make design single 8 x 8 sprites or larger. Anything you wish as long as it is four colors. Once you finish a tile, click on the next blank tile on the far right of GBTD.

Image Hosted by ImageShack.us

You will save the file with whatever content you have at this point and name it something relative to the content. Open Gameboy Map Builder (or GBMB.exe) and click file > Map Properties then use the browse button to locate your new *.GBR file that you made in GBTD. For no, you may ignore width and height because you can add columns and rows at will.

Image Hosted by ImageShack.us

Once you have loaded in your tiles, you may continue to make more tiles! Make and place tiles, side-by-side by having both programs open at once. Each time you save your *.GBR file in GBTD, GBMB will automatically update! How cool is that?

Here are some time-elapsed screenshots of my own work.


Image Hosted by ImageShack.us

Image Hosted by ImageShack.us

Image Hosted by ImageShack.us

Image Hosted by ImageShack.us

Image Hosted by ImageShack.us

Image Hosted by ImageShack.us

Image Hosted by ImageShack.us

The above Map is simply a 160x144px image that I can manipulate on screen. REMEMBER:
"The main GameBoy screen buffer (background) consists of 256x256 pixels or 32x32 tiles (8x8 pixels each). Only 160x144 pixels can be displayed on the screen." That means that where ever I place the image on the gameboy, there will be large empty scape on the sides. If I wanted to, I could have designed a full 256x256px map and used a scroll option and the d-pad buttons to view it all.


My process of designing such a large map was that I took an image I had re-sized and pixelized in Photoshop. There are a few options when pixelizing and for this one, I chose "pattern."

Below is the full 160x144 image which I have then transposed into GBTD...one tile at a time. It took nearly four hours, but I figured out that I was able to copy and paste a few of the colors. It turened out that the three lightest colors could be copied and pasted from PS to GBTD. I still had to fill in the black (11) pixels though.

Image Hosted by ImageShack.us

Image Hosted by ImageShack.us

Image Hosted by ImageShack.us

With a temporary frame, I was able to see more clearly which pixels I was currently working on. Again, I did this one 8x8 tile at a time.

Once you get better at creating tiles, you can create all sorts of maps and sprites, both for game characters and even art!

Image Hosted by ImageShack.us

When I am able to write better ASM code, I will demonstrate how to export these files and INCLUDE them into your very own ROM images. Thanks for reading!

Wednesday, August 7, 2013

Gameboy Cartridge Reader Board-Run

I plan on doing a small run of two sided PCBs based on Reiner Ziegler's Reader. I have redesigned the board in EagleCAD as a mostly SMT populated board, though some components have either option! I do not plan on supplying full kits, so part ordering will be up to you.

If you wish to throw some money into the pool and have a board sent your way, email me here:
Apple2ja*Cmich*edu (dots instead of asterisks).

Here are some pics, dimensions and a 3D render:



Image Hosted by ImageShack.us

Image Hosted by ImageShack.us

Image Hosted by ImageShack.us

Some notes about the boards, I have decided to add vias if people want to use through-hole components rather than SMT components. This does not include the ICs because these components are too large to fit within my strict board limitations. The photos show no through-hole resistors, but I am adding them shortly.

Lets try not to add both version of said components, k? If you choose to use a ceramic resonator rather than an ordinary crystal oscillator, be sure to ignore the cap locations. If you choose to place an crystal oscillator, be sure to check the data sheet as to the capacitance of caps you will need.

Also note that the ICSP connector must be on the bottom of the board. After programming the Atmega8515, you may remove the ICSP connector since there will probably never be any updates.

Reiner Ziegler's site is here: http://www.reinerziegler.de/readplus.htm

I have also posted about the pool at these locations to open up the audience:

http://www.epforums.org/showthread.php?86553-Gameboy-Programmer-Group-Printing

http://www.amibay.com/showthread.php?t=49126

http://chipmusic.org/forums/topic/11867/gameboy-programmer-group-printing/

http://www.noisechannel.org/

Saturday, July 27, 2013

Pre-Blog Projects Revisted pt. 1

I was digging through old photos on my ImageShack profile and decided to talk about them. There is no particular order, but each has a story to go along with it.

Shown below is from when I was working with the z80 (as if I ever stopped). I pulled this z80 from a dead Sega Genesis and built it onto a breadboard to test the functionality. It turns out whatever was wrong with the Genesis was not the z80. The testing circuit was simpl; executing NOPs (no Operations) by connecting all Data pins to ground via a pull resistor. This caused the Address pins to run from $0000 to $FFFF bit by bit and since each Address pin was connected to an LED, the LEDs would light up (very quickly mind you) as a binary counter. The only LEDs I couls see flashing were the high erbits becuase the lower bits were mush too fast.

Also shown is a memory chip which remained unattached, an AY-3-8910A Programmable Sound Generator IC, a CTS256A-AL2 Text-To-Speech Controller IC which has gone unused because I do not have the SPO256-AL2 companion voice synth IC. And lastly, in the bottom corner is just a simple xtal running through NAND gates to clean up the signal.



Here is one of my favorite projects! This was a simple Atmega microcontroller based logic Analyzer which I redesigned around very strict limitations. Original credit to:
http://www.serasidis.gr/circuits/mini_logic_analyzer/miniLogicAnalyzer.htm
The limitations were that I wanted it to fit inside of a nintendo gameboy, run on 4x AA batteries like the gameboy and use the battery contacts, battery compartment, power switch and screen location from the gameboy itself.

First came the board. The gameboy has a rather small square mainboard which has several specific mounting holes. All measurements were done very crudely with a clear mm ruler...I sure wish I had a digital caliper. Luckily, everything fit (the second time). The board shown is the board that I printed myself with the transfer method as it is called. you may print your circuit onto a clear coated paper (I use magazine pages) and then iron the image onto a copper clad board, clean and immerse into an etchant solution. Maybe I will write up a tutorial at some point, but it is pretty straight forward. Since this was not my first board to have etched myself, it turned out wonderfully. Some boards...did not. But alas; I am persevering!Notice my old logo etched on the right. ;)

Image Hosted by ImageShack.us

Here is the same board after being populated by hand and placed into the gameboy. "BA-DING" ... just kidding. At least the LED shows power is applied. The microcontroller is on the underside since I designed it to fit into a socket. Another restriction that I just remembered was that I wanted to use the gameboy's buttons to navigate through the program. The bottom of the board is suppose to hold ordinary push buttons, but I did not fit them so that I could wire up the GB's.

Image Hosted by ImageShack.us

LOOK IT WOR......thanks China for the crappy LCD screen. >_>
Yes, the text is indeed upside-down, but at least I managed to get it working. This happens to be the second problem with this particular LCD. The first was that it runs on 5v, not 3.3 like the datasheet stated. Also, the control pins were all sorts of switched around. With a little retrcing of my board design, I had that sorted out as well. My favorite problem (sarcasm) was that the LED backlight happened to be high-enabled rather than low...so if I had not caught that as soon as I did, they probably would have been damaged.

Image Hosted by ImageShack.us

Add the case and logic probes (minus one)...and...Ta-da! A working logic Analyzer!

Image Hosted by ImageShack.us

The above mishap from China isn't true for all electronics though. The USB ISCP below works very well. The only problem is that the ZIF socket is hardly ever used. It is used for a few Serial programmable microcontrollers and eproms. The only eproms I use are parallel programmable for which I use a different programmer.

On either side of the programmer are my sockets to program the microcontrollers (written on the sides of the boards). YES, I realize that having these boards entirely kills the 'S' in ISCP, but few of my designs fit an ISCP connector...

Image Hosted by ImageShack.us

Here is a smaller project: two guitar pedal boards. These board were suppose to use the PT2399 IC to create a variable echo effect, but I never found all of the needed components so the board were stores away in one of my many crap-boxes.

Each board controls an analog mono audio signal and connectos two potentiometers for control. on the right of the board is where a 7805 voltage regulator would fit and at the center is where the chip would have been socketed. Again, I degin all of my boards using Eagle CAD and then print them onto a PDF so that the vectorized image remains thew highest quality and static size.

Image Hosted by ImageShack.us

This is a print of a gameboy cartidge programmer designed my Reiner Zeigler to be used with modified cartridges or other commercial carts. It allows for you to read and write not only ROMs, but also RAM data if present. This board is the reason why I built the Atmega 8515 programmer above.

Reiner designed two version of the board; one for USB and one for Serial. I tried my hand at the USB because at the time, I didn't have a serial connector on the desktop I built...as is one of the few disappointing facts about new computers.

Image Hosted by ImageShack.us

lastly is the board after etching. It turned out terribly! This was the first board I had ever etched so I can't really complain. It was a learning experience and nothing more. Since nearly all of the data and addressing pins bled together, the board was tossed and I tried again later on after redesigning the board to accommodate my barbaric etching methods. I think the problem was that I didn't iron it long enough and with enough pressure. Some of the plastic ink peeled off or bled together.

Image Hosted by ImageShack.us



Thursday, July 25, 2013

Update Jul-25-13

Here I am trying to learn gbz80 ASM (or Gameboy Assembly Language) and am just having a terrible horrible day! I have programmed in assemble for classes before and loved it, but nothing wants go correctly this time. First off, the cat is being a psycho-demon and tears through the room every few seconds, next the power went out for one minute last night losing data from the programs I was running, resetting the wireless printer and shutting off the coffee pot so the water had top warm up in the morning and to top it all off, I did my egg over-hard rather than over-easy! BAHHH!

In any case, my biggest problem is that the assembler included with RGBDS, the gameboy assembling environment, refuses to load one of the THOUSAND files that all run in sequence when you initiate the assembling of a ROM. To top it all off, you have to run it through a command prompt which just adds a whole new level of fun to the project.

 I have tried setting programs to admin mode, compat mode, and all other forms of configuration and yet nothing works. Get this, the program was written for Windows 95 so I probably can't use Windows 7 x64...

 Image Hosted by ImageShack.us

That is the error. RGBFix refuses to load after the batch file calls for it. Putting RGBFix into Admin mode just skips the error message and does nothing. I am supposed to have a *.gb file that runs on gameboy or in an emulator.

 I am not even beyond Hello-World yet because of this nonsense! If anyone knows how to get this assembler working in Windows 7 x64, let me know...