Topic: 1-bit music on GameBoy

Hello,

I've got a few gameboy recently, for running LSDJ on them. Yes, I know it's quite "hype" but I wanted to try this and I don't regret it, LSDJ is an awesome tracker, now I can record musical ideas from my smartphone, using a GameBoy emulator...

Anyway, the best thing about the gameboy is it's a small device, has a screen, and is powered by a zilog z80 cpu.

Do you know if someone already managed to port a beeper engine on this device? Would it be possible? The CPU is not a real z80, I guess it's a kind of z80-compatible, so maybe not all opcode are available?

2 (edited by Shiru 2015-07-01 11:39:52)

Re: 1-bit music on GameBoy

GB having Z80 is actually a common misconception. In fact it is Sharp's custom CPU that is a 8080 derivative (like Z80) and has a small fraction of Z80 extra features, but that's it. Porting Z80 code to GB CPU is about as complex as porting Z80 code to 8080 - difficult, ineffective, but has been done before.

The worst thing about GB CPU regarding 1-bit music is that is has just as many registers as 8080, i.e. it completely missing Z80's alternative register set and index registers - this will have impact on possible number of channels. Worse than that, it also missing 8080's EX DE,HL opcode that is very useful in beeper engines, and there is a major HW bug with all 16-bit increment/decrement opcodes that leads to sprite display corruption.

Still, it is certainly possible to do something, especially for CGB that has about twice more CPU horsepower, but in general the platform is not very suitable for this kind of things, so it won't perform as well as Z80-powered systems.

website - 1bit music - other music - youtube - bandcamp - patreon - twitter (latest news there)

Re: 1-bit music on GameBoy

Isn't there also a maximum to how fast the sound registers can be updated? I have it somewhere in the back of my head that access was quite slow.

As for beeper engines on the thing, I think the closest there is is still nitro2k1's "mystery rom", which uses the battery save function to flip the output state.

Re: 1-bit music on GameBoy

To my knowledge, no, there is no access time limitations for sound registers. It is a common 'feature' (or rather an issue) of FM synth chips, but I can't remember any PSG type chip that would have this limitation.

website - 1bit music - other music - youtube - bandcamp - patreon - twitter (latest news there)

Re: 1-bit music on GameBoy

thank you for the explanations. So I guess it's unlikely we see some beeper songs on the gameboy... sad

An interesting effect on the GB: http://blog.gg8.se/wordpress/2009/03/23 … r-gameboy/

Re: 1-bit music on GameBoy

Ok, so most of you have probably all seen this elsewhere already:

https://www.youtube.com/watch?v=FVGYi-46G2s
http://irrlichtproject.de/downloads/dmg5th.gb

Good old pulse interleaving on the 2nd DMG channel while resuming normal operation on the other channels. Been meaning to do this for a long time, and it was also clear early on that this would have to be some sort of an April Fool's prank - so thanks for inspiring me, garvalf big_smile

So, lessons learned? Well, 1-bit sound is possible on the Gameboy. But, as Shiru mentioned, the Gameboy CPU is... eh... not exactly great to work with if you want to do something out of the ordinary. Not only does it miss more than half the Z80 registers, but also a lot of useful opcodes aren't implemented, and the ones that are there are almost always slower than on a regular Z80. HRAM is a nice feature but doesn't make up for the drawbacks. So the possibilities for 1-bit  on Gameboy are very limited. One could probably pull off a third 1-bit channel with a lot of fiddeling and loop unrolling, but overall I have to conclude that this platform really isn't worth it as far as 1-bit music is concerned.

Re: 1-bit music on GameBoy

really, I thought it was an april fools' joke... (in France we joke around the fishes, hence my reply on chipmusic.org about the "current" and "hook"). Well done.

Re: 1-bit music on GameBoy

Ah, didn't know April Fools revolves around fishes in France. Where does that tradition come from?