Gameboy project week 1: More than four shades of green
January 6th, 2013I’m hereby announcing 2013 as the “one Gameboy project per week” year. This an idea I came up with during a discussion with Seb (little-scale) where I jokingly suggested it as an alternative to the usual “one song per week” type challenges. So, my challenge is to try to do some kind of Gameboy-related project each week. Some of them will be more practically useful projects, like music/noise making ROMs, while others, like this week, will be research projects that I’m doing out of my own curiosity. This week’s project was actually meant to be a different project, but I postponed doing it, and had to settle for a smaller project to have a finished project at the end of the week. (Off to a bad start already. :p )
There’s a big risk this whole project will fail somewhere along the way. If not for lack of motivation (most likely) then because of lack of ideas.
Rez - a unique Gameboy synth ROM
December 11th, 2012____ | _ \ ___ ____ | |_) / _ \_ / | _ < __// / |_| \_\___/___| by nitro2k01
What is it?
Rez is a unique synthesizer program for the Nintendo Gameboy. It crudely simulates a resonant filter in a way inspired by the resonance algorithm used by the Casio CZ series phase distortion synthesis. Whether I’ve come close to this type of synthesis, I leave to the users of the program to decide. It can both produce sounds meant to emulate this effect, and sounds more reminiscent of a hard sync oscillator. It also produces a graphical pattern on the Gameboy screen.
During the development of this program, I’ve encountered a number of subtle issues with the DMG hardware, which you can either see as bugs or charming features of the hardware being (ab)used.
What should you run it on?
Rez is intended to be used on real hardware, in particular on a DMG, the original “brick” variety of Gameboy. If you wish to use an emulator, BGB and Gambatte are good choices.
Honorary mentions go out to no$gmb, TGB Dual and smygb02 for sounding glitchy in ways that may be interesting, even though they sound nothing like intended.
How does it work?
In this version, the controls are simple. Up and down control the “resonant frequency”. Left and right control the “fundamental frequency”. Currently, the synth is not tuned to any scale, so you need to manually tune it if you wish to use it with other instruments.
The values of these parameters are shown on the screen: The four hex digit value is the resonant frequency and the two hex digit number is the fundamental frequency.
A and B toggles between different waveforms which gives the resonance a different character, from relatively smooth to harsh to a hard synced sawtooth oscillator.
On the far right (press A you can’t get any further) there’s a clean sawtooth waveform. This waveform is unaffected by the resonant frequency setting and may be useful for tuning the fundamental frequency to another instrument.
There’s a bug in the DMG hardware which sometimes causes the waveform stored in the channel 3 wave RAM to be corrupted. You can press start to enable a workaround for this issue, at the expense of a slightly different timbre. You may also choose to leave this off which randomly and radically changes the waveform.
Pressing select shows the current contents of the wave RAM. This is a debug feature that I used to debug the wave RAM bug. It may be of interest if you’re curious.
All buttons can be used simultaneously.
TIP: Find a “sweet spot” resonance and fundamental setting and alternate between holding left+up and right+down. This increases one setting and decreases the other. This can give some nice effects.
Future versions
I have plans for more features for Rez, including among other things better ways of controlling the parameters. I don’t want to promise too much yet, but MIDI input support (using Arduinoboy or Nanoloop MIDI-USB) may be plausible. But I felt that I wanted to get a version of this out the door to avoid tweaking the program indefinitely and never releasing it.
Rez is not shitwave 2. Don’t believe the rumors.
Download and sound samples
(Early) sound sample on SoundCloud, during development.
Better sound sample by Victory Road showing more of what Rez can do.
Interesting question, if 1=5, 2=10, 3=15, 4=20… what is 5=? (Trolling with maths)
November 13th, 2012This image has been going around Facebook lately. What is the answer?
Gameboy clone “Game Fighter” teardown
November 11th, 2012Game Fighter posts:
- Teardown
- Dumping the boot ROM
Original Gameboy clones are a rarity. Whereas you can get clones of NES, SNES, Megadrive/Genesis and even Gameboy Advance with relative ease, Gameboy clones were made in small quantities back in the day, before the factories got shut down, and the few pieces that exist are now collecting dust in someone’s basement. Or so it seems.
I’ve been trying to get people to lend me one of these units for science, without success. So when a long-time member of #gbdev (on EFNet) informed the channel he had bought one from a local auction web site and wanted to pass it on, I happily accepted the offer. Here’s the result, hi-res photographs of the circuitry inside and comments on the design of the unit. If you have Gameboy clone that you want to lend me for a similar teardown please contact me.
So, the unit I was sent is of the brand Game Fighter. What’s unique about this unit, compared to other knockoffs, is that despite its horizontal layout, it follows the DMG (Dot Matrix Game; the product number prefix of the original Gameboy) design patterns relatively closely. Two such design patterns are the ridged pattern on the top and back of the unit, as well as the bevelling on the lower left and right corners.
It doesn’t look as tacky as, say, the Mega Duck or the Fortune Hand Game with its unibrow style select/start button. (See comparison.) If it wasn’t for the Street Fighter styled Game Fighter logo on the screen cover (which is missing on my unit) this could very well pass for an official Nintendo prototype.
Flash cartridge friendly versions of PixelH8’s GB tools
July 20th, 2012
Here’s a quickie: PixelH8’s Gameboy tools are known to crash when used on a real Gameboy with flash cartridges. The cause of this is a simple programming mistake that I was able to fix easily, so here are patched versions of the four Gameboy ROMs.
https://gbdev.gg8.se/files/musictools/PixelH8/ (Click pixelh8-fixed.zip)
Out of the tools, I personally find Deathray to be the most interesting, as it can create some harsh and unique tones that are worse than Shitwave.
If you happen to own one of the originally released cartridges, I’m interested in knowing if there’s a difference between the “free” versions and the retail version. Or even a ROM dump.
Handheld Heroes + LSDj player
June 14th, 2012Today the Handheld Heroes compilation was finally released. It comes in two versions, a digital download version with only MP3’s (or whatever formats Bandcamp offers) and one physical DVD version with a number of extras. One of those extra items is an LSDj ROM with four of the songs from the album in an LSDj player that I made, as well as a funky menu to select a song from. The player stores the songs in ROM space and does not require SRAM to work. The video above contains a short demonstration of this ROM.
The songs included in this ROM are as follows:
- Maru303 - Orgypsy Dubstep
- Bokusatsu Shoujo Koubou (BSK) - Handheld Heroes
- nordloef - A New Dawn
- Saskrotch - Handheld Hullabaloo
BGB 1.4 Gameboy emulator/debugger released
May 25th, 2012Today BGB 1.4 by beware was released. BGB is a Gameboy emulator and debugger. BGB 1.3, released little over a year ago focused mostly on emulation accuracy. It was the first update to BGB for 5 years and brought BGB past KiGB (which is actually a “compatible” emulator rather than a terribly accurate one, despite bold claims.) and up to par with Gambatte.
My personal interest in BGB is mostly the debugger. My choice, before BGB 1.4 existed, was between no$gmb, which had the better debugger, and BGB which had the better emulation. After a lot of persuasion, I managed to get beware to implement a number of debugging features, some of which existed in no$gmb and some of which were new requests. The big new debugger features are support for debug symbols and an “online” assembler which allows you to immediately start typing instructions or data to be assembled to the cursor position. Plus a big number of bug fixes, small improvements and optimizations in all areas of the program.
One noteworthy feature (which I’m not personally is not very interested in) is improved link port emulation for games. In particular, pawkemanz linking now works reliably, as do Tetris and LSDj.
And lastly, an invitation to anybody interested in Gameboy development: please join the IRC channel #gbdev on EFNet.
How to patch LSDj to use an inverted palette
March 4th, 2012This article was originally posted on September 19th, 2009 and has now been revised to use BGB instead no$gmb as a debugger. However, the things described here are mostly irrelevant now, because the standard method of installing a backlight these days is with a biversion, i.e. a hardware inversion. It may still be interesting for educational purposes.
Yesterday Three years ago axolotl asked on 8bc whether it is possible to invert the monochrome palette in LSDj, for use with backlit screens with an inverted polarizing foil. And it’s very much possible to do, and it’s even possible to modify an existing ROM image. So, I’ll show you how I did it using a copy of the LSDj ROM, BGB, and optionally a hex editor. I’m using XVI32, but any hex editor would do.
The palette value is change by a hardware register, which is a place in memory that a Gameboy program can be write to, to change things. So I look it up in the Pan Docs, which is a manual to the Gameboy hardware. Let’s look in the section LCD Monochrome Palettes. There we see that the address is $ff47 in hexadecimal and how the value is constructed.
For this tutorial, right click the BGB window and choose options (or press F11), go to system and choose the Gameboy option. This will run the ROM in DMG mode, which is needed to find where the palette change happens. Open the ROM image, press esc to go to the debugger and open Debug>Access breakpoints and enter FF47 and make sure “on write” is checked. This tells the BGB to track any writes to that address so we can find the place where the palette is initialized and change it.
Click ok and press F9 to begin execution. (Or reset the emulator)
BGB stops and show a bunch of machine instructions. The interesting part is the instructions at 019C and 019E. The instruction at 019C takes the hexadecimal value $E4, stores it in the CPU register A then writes it to the hardware register $FF47. This is the code we’re looking for. The value $E4 is the standard palette. Go back to pan docs and check again how the value is constructed.
Then let’s split the value into its individual colours.
$E4 = 11 10 01 00
11 is the lightest palette value and 00 is the darkest. Since want to invert the palette we’ll reverse the order.
00 01 10 11 = $1B
Great. You may now right click the line at 019C, choose modify code and enter ld a,1B. The line that said ld a,E4 should now say ld a,1B. Choose run, reset to confirm that the palette is inverted and that LSDj doesn’t crash or anything. You may now go to file, save ROM as and save the file anywhere you want, preferably with a new file name.
Alternatively, you can use a hex editor to edit this value. This part of the tutorial was left unchanged from the first version, because no$gmb can’t save changes made to a ROM and thus needed a hex editor to modify the file.
Open the hex editor and replace the $E4 at position 019D with the value $1B. This address will vary depending on LSDj version.
Lastly, open the ROM in an emulator to confirm that the modification worked.
Enjoy the inverted palette.
A modest copyright proposal
January 28th, 2012Everybody is so negative about SOPA and PIPA and ACTA. Nobody sees the opportunities! In the US legal system, plaintiffs who can prove willful infringement are entitled to up to $150,000 per work in damages. Let’s make a conservative estimate that a million Americans have downloaded 100 songs each. This would mean potential damages of $15M ($15,000,000) per person. Across a million people, that’s 15 million million, or 15 trillion US dollars in damages.
What does this number remind you of? You’re right, the US gross public debt. So hear me out on this modest proposal. Use this money to pay back the public debt. Then give each of the million people a 400 year prison sentence (not unheard of in the US) and let them work their asses off for 400 years to pay back the debt that is now on their shoulders. (Should anyone try to die from natural causes prior to the end of the sentence, you simply threaten to kill the person in question, which is usually enough to make him or her want to stay alive.) Putting another million people in prison won’t even double the US prison population, so the relatively small increase would hardly be a strain on the American correctional supervision system.
It’s doubtful whether anyone could object to this modest proposal which would instantly solve the two biggest problems America is facing today, copyright infringement and rampant public debt.
Korg monotribe Firmware 2.0 analysis
December 4th, 2011As has already been established, Korg monotribe is MIDI capable. Howver, it is still limited with regard to certain things, such as being able to use more than 8 seqeuncer steps for the synth part or using a filter envelope separately from and LFO. All things that should be very much technically possible on the microcontroller device in the unit. One thing I’ve considered is to modify or even rewrite the firmware of the ‘tribe. Apart from the obvious work of actually rewriting the firmware, you need a way of flashing it onto the device. And preferably a copy of the original firmware, so the ‘tribe won’t be a useless brick until development is done. The microcontroller in the monotribe does support JTAG, a protocol for reading and writing firmware data, among other things, but this function may be locked down for security reasons.
Korg recently announced the 2.0 firmware for the monotribe, which actually gives you 16 step, velocity control and a few other new features. More full information and download available on Korg’s homepage.
But what’s interesting about this upgrade is how you install it. You hold a secret key combo of three buttons on startup to go into upgrade mode, and then play a special audio file into the sync jack to perform the actual upgrade. This is potentially an easy way to hack the firmware of the monotribe (although with the same risk of bricking.)
Below, I’m posting the first step towards that goal, to extract the firmware image from the audio file. First, a big thanks to Th0mas for doing the initial groundwork of figuring out how the data is encoded. In fact, my code below below relies on having a transformed and cleaned up version of the audio data.
Read on…