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...

Tuesday, July 16, 2013

Using POV-RAY

Just a quick run-down of how to use POV-RAY after you have installed it. I assume you have installed it.


Hit RUN at the top of your board toolbar.



Image Hosted by ImageShack.us




Then run 3d41.ulp in the directory shown.




Image Hosted by ImageShack.us



The setting are extensive and somewhat confusing.
The defaults will work though. Click "Create POV-File and Exit".



Image Hosted by ImageShack.us




You will probably be prompted to add text and sockets to certain ICs. Do as you wish.



Image Hosted by ImageShack.us




There will also be parts that cannot be rendered because you do not have the 3D part files. Thats ok.



Image Hosted by ImageShack.us



 If there is something you would like changed for example size, angle, silkscreens, etc., change the settings a little bit. My silkscreens are in different layers than the default so I had to add these to the misc tab.



Image Hosted by ImageShack.us



Go ahead and load your output into POVray and click run to render the image. Play around with the options until you are satisfied.

Image Hosted by ImageShack.us

Image Hosted by ImageShack.us

Image Hosted by ImageShack.us

Monday, July 15, 2013

SID-Boy v1 Hardware Completion

As per the title of this post, I have completed the board. All of my necessary components are placed, routed and errors have been checked over and or fixed. I have even chosen to decorate the board a little with my QR code just because I can.

Here is the board before I corrected my errors. 855 ERRORS! Many of them were silkscreen errors where the silkscreening was too close to pads and vias. These were easily fixed.
The clearence errors were also fixed very easily by movig the traces a little farther from eachother or from vias and pads.

Image Hosted by ImageShack.us

Here is the board in its entirety, both with and without the ground planes.

Image Hosted by ImageShack.us

Image Hosted by ImageShack.us

Lets view some of the board up close. Here are the two resistors, R4 and R5, that I added as described by the SwinSID website. 47Kohms between PWM and +5v and 47Kohms between PWM and the output which happens to be the Audio-IN pin on the gameboy. The board now contains both methods of audio output so that I may find out which is better.

Image Hosted by ImageShack.us

Here is my logo as I call it. It is just a QR code that I made which leads to this blog. Adding BMPs to a board is very simple. Beside that you can see a small block of text that describes the caps and resistors above. There was limited room next to them.

Image Hosted by ImageShack.us


My clock. This clock a larger than the clock I had been using before, but is more easily available. Pins 1 and 3 are the two terminals for the oscillation. I may need to change the sizes of caps and resistors depending on the availability of them in the future, but each has plenty of room for change.  I believe these caps were size 0603. Something of note is that the traces of the clock are distant and not of the same length from the MCU. This is something people would call poor design, but the clock speed of 24MHz is not terribly fast and the clock is isolated as much as possible from traces and other devices so that I do not believe any problems will arise.

Image Hosted by ImageShack.us

Here are my power rails. Yes, they are round. Why? Well, because I can. ;)

Image Hosted by ImageShack.us

The last thing to do would be to write a program that stores SID data to the RAM locations where I have placed the SID in the memory map. I will have to research the SID banks, commands and gameboy programming. Once I have my board printed and populated, I will test a known-working ROM such as mGB, the midi software just so I know the board is routed to the gameboy correctly.


LC the kitten likes my board. How nice of him to approve. :D

Image Hosted by ImageShack.us

I really really need an oscilloscope so that I can perform extensive testing with this and other projects. I think that it is currently my greatest downfall...