Category Archives: Shredz64

Shredz64 – Processing Note Data

I snuck some hours in yesterday before I went to the dentist and worked on things. Shredz64 can now take a (static) list of button data (e.g. buttons to be pressed at what time and in what order) and correctly show it on the screen. For instance, I can encode data that says “A green button should be pressed at 00:00:10, 00:00:20, and 00:00:45, a red button should be pressed at 00:00:10, 00:00:30, etc, and it will correctly show and scroll the sprites on screen. It will also detect if you strum the correct chords at the correct times and increase your score upon success. I’ve also added a “Shredocity” meter that mirrors the functionality of Star Power in Guitar Hero for the Playstation. I will soon be adding a crowd meter that will determine how well you’re playing. Here is a screenshot that shows some button data on the screen. The Shredocity meter is a bit chunky looking right now, I’ll be thinning out the graphics.

Overall, things are going really well. The framework of all the controls and graphics are pretty much done, there is only the big project left of incorporating SIDs in as the source of the music, and the smaller task of reading the song data from files on disk. SID music is ironically incredibly hard to work with on a C64 since its just machine code that was ripped from some other program, but I have plans incorporating SID plugins for XMMS to convert it over to a different usable format. More on that later after some code has been written.

Shredz64 – Working on Graphics

Well, I got a few more things done. As I mention on the Shredz64 page, graphics are simple and confined to PETSCII and sprites right now, no high res stuff. I want to save all the processing power I can for good response and music. I’ll tweak up the sprites later on, but for now this is fine. Anyway – I have the fret board showing, and button indicators at the bottom. They do respond to the guitar controller now, so if you press a button on the guitar it will light up on the screen. I have the strum bar just playing a beep out of the C64 right now to let me know its working. As can be seen, I also did a simple sprite to represent the note/button as it slides down the fret board.

Shredz64 – Created PC64 Cable

I had a day off from work today, though I ended up sleeping pretty late and not getting everything done I wanted to. I did, however, build a PC64 cable and get cbmlink installed and running on my Debian box. Now I can successfully read/write files/disk images to my C64 from my PC, read/write memory, remotely execute programs, run disk commands, etc. The reason this is related to Shredz64 is now I can actually test it on a real C64 with the controller as opposed to only the emulator with no controller. The cable isn’t too exciting looking to no pictures, but it does operate on a 4-bit parallel connection between the user port and the parallel port, as opposed to a serial connection.

Shredz64 – Starting on Graphics

Well, I updated the webpage a bit. Nothing too fancy, but I wanted to clean it up a bit so some sections were separated out. This page will still serve as a log of things I’m doing.

In technical news, I’ve got some graphical routines done and have a fretboard on the screen with scrolling buttons. Screenshots later when I have something a little more to show.

Shredz64 – Created a PSX64 Prototype

Lots of good work and news going on with this project, I figured it was about time to actually update this page with what’s going on.
The soldered prototype for the PSX -> C64 adapter is now done, as can be seen here:

The converter now does the following:

1. Determines whether a normal controller is plugged in or a guitar controller, and maps buttons accordingly
2. Turns on analog mode for guitar controller and successfully reads whammy bar. (Updates later about getting this working for all those interested)
3. Maps Strum up, Strum down, and guitar lift up to static values on one of the POT lines, which allows the C64 to receive ALL information from the guitar (except start and select button)
4. Allows button macros to be programmed onto the R1/R2/L1/L2 buttons in controller mode, up to 127 button sequences PER macro
5. If the user selects analog mode on a normal controller, it will map the left analog stick to the normal digital directions
6. And converts all buttons successfully of course.

After a hefty debugging session, the physical adapter is solid and works great with both a guitar controller and normal dual shock controller. It was amazing to try all my old games with a PS2 controller (as well as some Amiga games and Atari 2600, haven’t tried the Sega Master System yet).

Also, I’ve started writing the actual Shredz64 (guitar hero) game for the C64. I started out with a simple debugging routine to show the status of what guitar buttons were being pressed. Here are two screenshots (literally) of the C64 reporting whats happening on both the fret board and strum bar/lift sensor:

Here you can see me pressing random buttons on the fretboard

And here I’m struming up a down a few times, then I lift the guitar up

While this program was written in BASIC, the final Shredz64 program is being written in a combination of C and 6502 assembly using the CC65 cross compiler, which I got up and running a few days ago. I’m currently developing in an emulator environment and am waiting for parts to arrive to build a cable to transfer the program to the C64 itself for testing.

Anyway, so much more to come, but things are progressing nicely! I’ve found out that this project is featured in Engadget which is great, I hope to be making updates more regularly now that I know people are reading. If you have any questions, feel free to email me: twestbrook AT synthdreams DOT com. Huzzah!

Shredz64 – The Beginning

I recently ordered the arduino development board – it’s a programming board for the ATMEGA8 microcontroller with a built in USB interface. It was extremely cheap (~35 for the board, 3 bucks per ATMega8 chip). The IDE allows you to program in C code and upload it straight to the flash memory on the ATMega, which is called by the bootloader on startup. The ATMega8 is awesome for 3 bucks, it runs at 16mhz, has 1K RAM, 8K flash memory, and 512 bytes of EEPROM memory. Great for a project like this. HOW DOES THIS RELATE TO THE GUITAR HERO CONTROLLER?

Well, long gone are the days when a joystick simply put voltage over a line to indicate a button being pressed. This is true on Atari/Commodore/Sega/Amiga controllers, but nothing recent. Back in the day, if you pressed LEFT, a circuit to a specific pin would be completed on the 9 pin connector. Press up, a different pin would be connected. A pin for every button, it was an easy life. But now PSX, XBOX, GC controllers have a billion buttons and only a limited number of lines, so they encode the data into a serial stream of packets, just like if you were sending data over a serial connection or network.

In comes the ATMega8 microcontroller. The atmega receives the serial stream of packets, decodes them and figures out which buttons are being pressed. It then drops voltage on corresponding lines to the output to the commodore. But before I did that I had to test to make sure my decoding program was working! THIS WAS A NEAT TEST.

First I took a PSX extender cable:

I opened the male connector and got the pins out. I continuity tested each line so I could figure out which color was which pin. I then connected these pins into a solderless protoboard and mapped arbitrary pins off the arduino board into the protoboard.

I also hooked a tiny loudspeaker up to the protoboard too and mapped the arduino into it. The goal to test this guy out was to have the ATMega play sounds on the speaker when I strummed with buttons held down on the guitar.

Then was the task of writing the decoder in C. I found some docs online that describe the protocol the PSX controller uses. It basically consists of sending data over a COMMAND line, listening on the DATA line, manipulating the CLOCK line to drive the data, checking the ACK line for good measure (not really necessary), and dropping the ATTENTION line when it was time to wake the controller up. The prototal was the following. Drop the attention line, Send 0x01 over the COMMAND line to the controller, the arduino should receive 0xFF back on the data line. Then the controller is sent 0x42 which is a REQUEST FOR DATA command, at the same time the controller responds back with what mode it is in (Digital or Analog, mouse or whatever). It then sends back 0x5A to indicate “Here comes the data SUCKA”, and then sends 2-7 bytes depending on if the controller is in digital or analog mode. Those bytes contain a bit for each button, either set to 0 or 1 depending on if the button is pressed or not.

It took about two days to get this working, one because I needed to add a 10K pullup resistor across the COMMAND pin as the arduino was polling the controller too fast and the line noise was crapping out any packets I was sending. I found this tip online by someone who had done another PSX controller project. The other was I wasn’t reading and writing data properly with the clock cycle, I was doing more on the rise of the clock and I needed to do things on the fall of the clock. It was frustrating, but eventually I got it working. I then wrote a quick program to print out to my laptop (via the USB serial link) what button was being pressed, then I pressed each button on the guitar controller and saw what the corresponding PSX button was. Here’s THAT:

Green = R2
Red = O
Yellow = Triangle
Blue = X
Orange = Square
Start = Start
Select = Select
Lift guitar up = L2
Strum up = UP
Strum down = DOWN

I couldn’t test the whammy bar out as I know for a fact it manipulates one of the analog sticks, and I don’t know the command yet to force a controller into analog mode, so the guitar starts up in digital mode and disables the whammy bar.

Anyway, I got the decoder working, and using the button map data, I created a little program for the atmega that plays a note through the loudspeaker when the strum bar is hit depending on what key combination is held down during the strum. It basically assigns a frequency value to each key, then adds them together, and plays that. It’s not aligned to real notes right now, I did it more for just a fun test to actually see the thing working. There really is no other steps between here and hooking it to the commodore 64 other than wiring up a DB9 conector.

Here is a recording of me playing the Guitar Hero controller through my interface – Remember, this is NOT what the Commodore 64 game will sound like, this is just a quick hardware test.

That’s it for now! Soon the interface will be done and it will be time to start on the game.