This is part of our “How to make a …” Series.
I call this the “Hello Game” Tutorial (like Hello World Tutorials but for Retro Games).
Did you remember your childhood when you took your gameboy to shool or in the bus or whatever and could just play games everywhere you want ?
And maybe some of you (like me) thought : wouldnt it be cool to make your own Gameboy Game ?
Well i was a young boy and didnt had experience with programming or something.
Games like Mario Land, Amazing Spiderman, Balloon Kid, Zelda and Gargolyes Quest was inspiring me.
Years later now i could figure out how Game Boy Games are made so here we go.
What do you learn
In this Tutorial you will learn how to build a simple gameboy program.
Our goal is to print “Hello Gameboy!” on the Screen.
- Computer with Windows (XP would work, i am try it on Windows 10).
- Gameboy SDK Library (https://sourceforge.net/projects/gbdk/files/)
- Gameboy Emulator to test your Rom (http://bgb.bircd.org/)
- An Editor for C Programming (Notepad++ would be enought but normal Notepad is okay too)
So your files are now in c:\gbdk (if you didnt changed the path).
Open an explorer and move to c:\gbdk\bin folder and create a new file called : main.c .
Make sure that file extensions are visible in your folder settings (otherwise you wouldnt notice if you create main.c.txt for example).
Now lets start coding. Open main.c with your favorite editor.
Write the following Code in the Editor.
Save the file.
Now start a CMD and move to the gbdk\bin folder.
We want to compile now our Gameboy Programm so we write the following in the CMD.
.\lcc.exe -o game.gb .\main.c
If you have XP or below Windows 8 and you are not using Power shell just remove the .\
lcc.exe -o game.gb main.c
A file with game.gb should be now compiled in the bin folder.
So if you have downloaded bgb and extracted it somewhere you can now open the rom with it.
Right click your game.gb file select “Open With…” and then browse the folder to bgb.exe for your program.
If everything works as expected you should see this:
Congratulation! You wrote your first Gameboy Program.
Sources for my research and Helpful Links: