Starting guides for GBdev (audio-oriented)
Starting guides for GBdev (audio-oriented)
A friend of mine wanted to know if there were any good or recommended starting guides for general GB development, particularly sound emulation.
- ISSOtm
- Posts: 58
- Joined: Fri Jan 04, 2019 5:31 pm
- Location: France, right of a pile of consoles
- Contact:
Re: Starting guides for GBdev (audio-oriented)
Wait, a guide for development, or for emulation? Those are entirely separate.
The French Lord of Laziness (and a huge Legend of Zelda fan)
https://github.com/ISSOtm
ASMu is laifu <3
https://github.com/ISSOtm
ASMu is laifu <3
Re: Starting guides for GBdev (audio-oriented)
I used this documentation to understand how Game Boy audio worked:
http://gbdev.gg8.se/wiki/articles/Sound_Controller
If your friend would like to see code implement the sound controller, this may help, although it's not bit-perfect:
https://gitlab.com/higan/higan/tree/master/higan/gb/apu
If they want to test an implementation, the best I know of are blargg's test ROMs:
http://gbdev.gg8.se/files/roms/blargg-gb-tests/
But just a note that every Game Boy is a little different, and these tests fail on certain models. More about that here:
http://gbdev.gg8.se/wiki/articles/Test_ ... .27s_tests
Overall, the hardware is rather forgiving, and you can get pretty good sound without having to support all the zany edge cases and per-model behaviors.
http://gbdev.gg8.se/wiki/articles/Sound_Controller
If your friend would like to see code implement the sound controller, this may help, although it's not bit-perfect:
https://gitlab.com/higan/higan/tree/master/higan/gb/apu
If they want to test an implementation, the best I know of are blargg's test ROMs:
http://gbdev.gg8.se/files/roms/blargg-gb-tests/
But just a note that every Game Boy is a little different, and these tests fail on certain models. More about that here:
http://gbdev.gg8.se/wiki/articles/Test_ ... .27s_tests
Overall, the hardware is rather forgiving, and you can get pretty good sound without having to support all the zany edge cases and per-model behaviors.
Re: Starting guides for GBdev (audio-oriented)
This tutorial is good to quickly learn how to get up a ROM up and running (which is always the hardest step IMHO):
http://peterwynroberts.com/?p=10
Edit: Oops wrong link. It's this one: http://assemblydigest.tumblr.com/post/7 ... m-in-rgbds
A collection of pretty much everything Game Boy development:
https://github.com/gbdev/awesome-gbdev
I recommend to read the official development documents, and Pan Docs.
Edit: Oops wrong link. It's this one: http://assemblydigest.tumblr.com/post/7 ... m-in-rgbds
A collection of pretty much everything Game Boy development:
https://github.com/gbdev/awesome-gbdev
I recommend to read the official development documents, and Pan Docs.
Last edited by Pokun on Sun Jan 27, 2019 10:53 am, edited 1 time in total.
Re: Starting guides for GBdev (audio-oriented)
Thanks folks.
Also, to answer ISSOtm's question: primarily a sound emulation focus (quote: "I mostly just want to get the Tetris music playing or something"), but given some of his other projects/interests pertaining to audio, developing on the GB (for sound-related reasons) would likely be necessary on some level.
Also, to answer ISSOtm's question: primarily a sound emulation focus (quote: "I mostly just want to get the Tetris music playing or something"), but given some of his other projects/interests pertaining to audio, developing on the GB (for sound-related reasons) would likely be necessary on some level.
- ISSOtm
- Posts: 58
- Joined: Fri Jan 04, 2019 5:31 pm
- Location: France, right of a pile of consoles
- Contact:
Re: Starting guides for GBdev (audio-oriented)
For blargg's test ROMs, an incomplete source code RE effort can be found here.
More (much more!) advanced test ROMs can be found here, although they require emulation of the PCMXX registers.
As for learning how to program, I'm going to shill my own stuff, as I've got very positive feedback on it. It's not complete yet, so there's no mention of the APU, but it's at least enough to get a Hello World running.
By the way, the tutorial Pokun linked is very outdated. `gbhw.inc` has been replaced with hardware.inc, RGBDS has officially deprecated `HOME`, `CODE`, `DATA` and `BSS` sections in favor of `ROM0`, `ROMX`, `ROMX` and `WRAM0`/`WRAMX`, and so on. RGBFIX is used for the header instead of source code macros.
The tutorial is also full of cargo cult - the first four bytes of code in the header need not be this, you can use `di ; jp EntryPoint` for example; the stack should never be put in HRAM, as it provides no benefit and eats space that could otherwise be allocated to fast-access variables. And overall it explains very little.
More (much more!) advanced test ROMs can be found here, although they require emulation of the PCMXX registers.
As for learning how to program, I'm going to shill my own stuff, as I've got very positive feedback on it. It's not complete yet, so there's no mention of the APU, but it's at least enough to get a Hello World running.
By the way, the tutorial Pokun linked is very outdated. `gbhw.inc` has been replaced with hardware.inc, RGBDS has officially deprecated `HOME`, `CODE`, `DATA` and `BSS` sections in favor of `ROM0`, `ROMX`, `ROMX` and `WRAM0`/`WRAMX`, and so on. RGBFIX is used for the header instead of source code macros.
The tutorial is also full of cargo cult - the first four bytes of code in the header need not be this, you can use `di ; jp EntryPoint` for example; the stack should never be put in HRAM, as it provides no benefit and eats space that could otherwise be allocated to fast-access variables. And overall it explains very little.
The French Lord of Laziness (and a huge Legend of Zelda fan)
https://github.com/ISSOtm
ASMu is laifu <3
https://github.com/ISSOtm
ASMu is laifu <3
Re: Starting guides for GBdev (audio-oriented)
Sorry I posted the wrong tutorial. I updated the link in my post to the one I used. It was years ago I used it though, so it may also have some cargo cult and is probably also using the old RGBDS assembler. But it was the only tutorial I could find at the time that actually taught how to make a proper ROM in assembly and that works on real hardware. Most other tutorials was incomplete, full of weird stuff or would produce faulty ROMs that only worked in older emulators.
I don't personally use those features in RGBFIX. I need it to fix the checksums only, as generating the rest of the header manually is trivial.ISSOtm wrote:RGBFIX is used for the header instead of source code macros.
The confusion about what was the latest version of that is what made me stop using it and just use my own (compatible) defines, or just use raw register numbers for certain things.ISSOtm wrote:gbhw.inc has been replaced with hardware.inc
Re: Starting guides for GBdev (audio-oriented)
I will be watching this topic very closely in the coming days. I am jumping into GB dev for the first time, and the one big question mark I had after preliminary research was how to efficiently create and play music and sound effects.
I would be interested in knowing on a high level what others' processes are when making music and sounds, I couldn't find much info online at all sadly.
I would be interested in knowing on a high level what others' processes are when making music and sounds, I couldn't find much info online at all sadly.
Re: Starting guides for GBdev (audio-oriented)
I haven't yet made music on Game Boy, but the audio driver I made for Libbet and the Magic Floor conceptually resembles my first NES audio driver (Pently generation 1) that could also only play sound effects. The documentation and source code of this driver should help you learn some concepts. Extension to music is pending more experience with structs, which aren't easy to make efficient on an 8080.