It is currently Mon Feb 18, 2019 1:53 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Wed Jan 23, 2019 4:59 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3861
Location: A world gone mad
A friend of mine wanted to know if there were any good or recommended starting guides for general GB development, particularly sound emulation.


Top
 Profile  
 
PostPosted: Thu Jan 24, 2019 1:06 am 
Offline
User avatar

Joined: Fri Jan 04, 2019 5:31 pm
Posts: 27
Location: France, right of a pile of consoles
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


Top
 Profile  
 
PostPosted: Thu Jan 24, 2019 1:33 am 
Offline

Joined: Mon Mar 27, 2006 5:23 pm
Posts: 1401
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.


Top
 Profile  
 
PostPosted: Thu Jan 24, 2019 6:13 am 
Offline

Joined: Tue May 28, 2013 5:49 am
Posts: 1064
Location: Hokkaido, Japan
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.


Last edited by Pokun on Sun Jan 27, 2019 10:53 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Thu Jan 24, 2019 11:44 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3861
Location: A world gone mad
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.


Top
 Profile  
 
PostPosted: Thu Jan 24, 2019 4:45 pm 
Offline
User avatar

Joined: Fri Jan 04, 2019 5:31 pm
Posts: 27
Location: France, right of a pile of consoles
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.

_________________
The French Lord of Laziness (and a huge Legend of Zelda fan)
https://github.com/ISSOtm
ASMu is laifu <3


Top
 Profile  
 
PostPosted: Sun Jan 27, 2019 11:17 am 
Offline

Joined: Tue May 28, 2013 5:49 am
Posts: 1064
Location: Hokkaido, Japan
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.

ISSOtm wrote:
RGBFIX is used for the header instead of source code macros.
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:
gbhw.inc has been replaced with hardware.inc
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.


Top
 Profile  
 
PostPosted: Sun Feb 03, 2019 6:35 am 
Offline
User avatar

Joined: Wed May 20, 2009 6:16 am
Posts: 16
Location: New York City
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.


Top
 Profile  
 
PostPosted: Sun Feb 03, 2019 8:53 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21097
Location: NE Indiana, USA (NTSC)
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group