Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2018-08-11 12:01:22

Game_Boy_Fan
New member
Registered: 2018-08-11
Posts: 2

[Question] Install GBDK Windows 10?

Hello Everybody!

I am new here and I want to get started as a GameBoy developer. But I am actually very inexpierenced at making games for the GameBoy, so I am sorry if my questions sound very dumb.

So, I downloaded the GBDK (GameBoy Dev Kit) to get started, but I have no idea how to start the software itself (I use Windows 10). Can somebody tell me what I need/what I have to do to get the GBDK running and start making games? Thank you in advance!

Oh, and does somebody has expierences with the ZGB engine (https://github.com/Zal0/ZGB)? How do I install that?

Thank you for reading my dumb questions and eventually answering them. Have a nice day.

Offline

 

#2 2018-08-11 13:02:15

Robbi_Blechdose
Member
Registered: 2017-12-10
Posts: 29

Re: [Question] Install GBDK Windows 10?

You'd be better off learning Assembly immediately.
There are a few reasons:
GBDK is bad.
More people will be able to help you with ASM.
ASM is waaaaaay faster.

I started with GBDK, and I would not recommend it. It took a while to get me over to ASM, but it is a lot better.

Oh, and ZGB is also based on GBDK, so don't use that either.

Offline

 

#3 2018-08-11 16:42:39

Game_Boy_Fan
New member
Registered: 2018-08-11
Posts: 2

Re: [Question] Install GBDK Windows 10?

Thanks for your help. But I am just a beginner and I am not a professional programmer (C# a little bit). I only want to make my ideas into a game. However, I appreciate your suggestion.

Offline

 

#4 2018-08-11 19:56:02

26F
Member
Registered: 2018-07-25
Posts: 13
Website

Re: [Question] Install GBDK Windows 10?

I downloaded gbdk-2.94-win32.exe from sourceforge.net. Moved the downloaded file somewhere to extract it. Wherever you extract the file will be your working environment. Paste the folder directory that you wish to extract the files into into the installer. After it has been extracted. Go into the folder and find the bin folder. You will want to paste a copy of cmd.exe there. Just go into the start menu and type cmd.exe. Right click on it and click open file location. If it takes you to a shortcut right click on the shortcut and click open file location again. Copy cmd.exe to the bin folder. Once a copy of cmd.exe is in the bin folder, you can write a .c file to compile using lcc. Here is an example.

Open a text editor. Sublime text is good.

Type:

#include <gb/gb.h>
#include <gb/drawing.h>

void main() {
    gprintf("Hello world");
}

save this as a .c file. Like main.c
click on cmd.exe and type lcc main.c. It will create a file called a.ihx.gb. You can use an emulator to like bgb to run the file, or you can put it on a flash cart to run on the game boy.

you can also include <stdio.h> and use printf("text goes here"); which will enable you to use the '\n' (new line character.)

Offline

 

#5 2018-08-24 03:19:14

Zalo
Member
From: Spain
Registered: 2016-07-26
Posts: 103
Website

Re: [Question] Install GBDK Windows 10?

Robbi_Blechdose wrote:

You'd be better off learning Assembly immediately.
There are a few reasons:
GBDK is bad.
More people will be able to help you with ASM.
ASM is waaaaaay faster.

I started with GBDK, and I would not recommend it. It took a while to get me over to ASM, but it is a lot better.

Oh, and ZGB is also based on GBDK, so don't use that either.

Says you...
GBDK is not bad, it is actually an awesome library. As I have said many times the problem is the version of the compiler that was availbale back them
ZGB uses the latest version of SDCC so it doesn't have that problem and I am usually here to help

Use ASM if you have plenty of time to learn and want to really squeeze the hardware limits. Use GBDK or ZGB if you want to make a game quickly

Offline

 

#6 2018-08-24 07:18:05

Jonas
Member
From: Frankfurt, Germany
Registered: 2016-06-06
Posts: 112
Website

Re: [Question] Install GBDK Windows 10?

Zalo wrote:

Robbi_Blechdose wrote:

You'd be better off learning Assembly immediately.
There are a few reasons:
GBDK is bad.
More people will be able to help you with ASM.
ASM is waaaaaay faster.

I started with GBDK, and I would not recommend it. It took a while to get me over to ASM, but it is a lot better.

Oh, and ZGB is also based on GBDK, so don't use that either.

Says you...
GBDK is not bad, it is actually an awesome library. As I have said many times the problem is the version of the compiler that was availbale back them
ZGB uses the latest version of SDCC so it doesn't have that problem and I am usually here to help

Use ASM if you have plenty of time to learn and want to really squeeze the hardware limits. Use GBDK or ZGB if you want to make a game quickly

I agree. If you are a beginner and try to code your first game in assembly, you are very likely to fail and end up with nothing. The few simple lines of code provided above in C would take a page or so in assemby and be completely incomprehensible to anyone who doesn't understand the hardware. There are good reasons for some of the best homebrew games for the Game Boy being coded in C...

Offline

 

#7 2018-08-30 16:07:45

ISSOtm
Member
From: Somewhere in Echo RAM
Registered: 2017-04-18
Posts: 160
Website

Re: [Question] Install GBDK Windows 10?

WARNING: huge post incoming. But there's a tl;dr at the end if you don't feel like reading any of this! ^^


Jonas wrote:

I agree. If you are a beginner and try to code your first game in assembly, you are very likely to fail and end up with nothing. The few simple lines of code provided above in C would take a page or so in assemby and be completely incomprehensible to anyone who doesn't understand the hardware. There are good reasons for some of the best homebrew games for the Game Boy being coded in C...

That's not true, ASM is somewhat more verbose than C, but that's because you can do several things in a single line of C that translate to several lines of ASM, since each ASM operation is so elementary. Here's an example of two pieces of code that do the same thing:

Code:

// Assuming some_var and other_var are bytes
if(some_var == 42) {
    other_var++;
}

Code:

    ld a, [some_var] ; ld = LoaD
    cp a, 42 ; cp = ComPare
    jr nz, .dontIncOtherVar ; nz = Non-Zero
    ld hl, other_var
    inc [hl] ; inc = INCrement
.dontIncOtherVar

You're also exaggerating a lot how verbose ASM is. This didn't take entire pages. (By the way, the first 3 lines of ASM correspond to the first line of C; the rest to the second line fo C)

You can code your first GB game in ASM. It won't be worse or better than if it was made with GBDK. I've done it.
Also, ASM isn't as hard as you make it seem like. It's different from most programming languages, but it's still no problem for some people - some, not all - and C and ASM greatly help understand each other.
Further, trying to make your game in ASM will further incentivize you to learn about how the console works, and ho to operate it; instead of blindly trusting a (faulty) library.

Anyways, C code written for the GB is incomprehensible to someone who doesn't know the hardware. Why do people always declare huge `const` arrays of data that doesn't make any sense? What does `set_bkg_tiles` do? What does writing to NR52_REG do??
These are questions that require knowledge of the hardware. And no matter how hard you try, you can't abstract those away, because the GB is such a constrained system that any abstraction comes at a penalty that you can't just brush off.
You can write a GB game with GBDK, but it'll be limited. In different ways than if you didn't use GBDK, and I'm pretty sure that it'll be much more than using ASM.
Please note that I'm targeting using GBDK specifically, not using C as a whole. It'd be possible to write a C compiler and toolkit for the GB that generates super tight code. But nobody did it, and GBDK's the polar opposite of that.

Finally, most homebrew games on the GB have been coded in C because it's an easy solution. It's not because ASM programming is reserved to the elite of the elite - if so, how did the programmers of the time do to make the games they made? They didn't have C at the time, yet you got great games, even if they don't push the hardware to its absolute limits. It ranges from Pokémon to Prehistorik Man, or even Super Mario Land!
Of course, homebrew developers have less of an incentive to learn ASM now, since there's GBDK. But I disagree that there's any link between GBDK and a game's quality. There's an example of that, Last Crown Warriors, which seems rather promising, but is now written in ASM.
I would like to point out that the homebrew games that have been appreciated are mostly small games (eg Tobu Tobu Girl), and, well, with such a small scope, GBDK's constraints don't matter. But consider something with a bigger scope, like Pokémon. You can't do that with GBDK. Of course, even minigame-like games can be fun (I enjoy those, myself), but restricting yourself to GBDK is putting arbitrary limits on yourself. Reading a tutorial about ASM lets you know what are the console's actual limits - but maybe the tradeoff isn't affordable to the developer, so they'll go back to GBDK, but not trying is a waste.


Zalo wrote:

Robbi_Blechdose wrote:

You'd be better off learning Assembly immediately.
There are a few reasons:
GBDK is bad.
More people will be able to help you with ASM.
ASM is waaaaaay faster.

I started with GBDK, and I would not recommend it. It took a while to get me over to ASM, but it is a lot better.

Oh, and ZGB is also based on GBDK, so don't use that either.

Says you...
GBDK is not bad, it is actually an awesome library. As I have said many times the problem is the version of the compiler that was availbale back them
ZGB uses the latest version of SDCC so it doesn't have that problem and I am usually here to help

Use ASM if you have plenty of time to learn and want to really squeeze the hardware limits. Use GBDK or ZGB if you want to make a game quickly

GBDK's lib is awful.
The first problem is that it's been compiled with SDCC, which makes it hugely bloated (seriously, functions used as often and as time-important as VRAM funcs should have been optimized by an ASM programmer, no?!).
The second is that the lib is confusing anyways, unless you learn about the hardware - which takes time -; here's an example: you don't have to care about VRAM access restrictions because you just have to use `set_bkg_tiles`, but you still have to know how the APU is operated because you are only provided direct interfaces to the APU regs (via NR**_REG), and also for some reason modifying the variable `LCDC_REG` changes the behavior of `set_bkg_tiles`, so uhhhh,

ASM is indeed required to squeeze something fairly technical out of the console, but it's not exclusive to that. ASM unlocks full control over the hardware, but that doesn't mean you have to use it to its full potential. Again, see any commercial game released during the console's lifespan.
You can make games quickly in ASM. If you're quite comfortable with ASM, then you can quickly program with it, same with C. You'll even debug faster! Since there are no C-level debugging tools for the GB, you can debug ASM code only. If that's the code you wrote, you know what it's supposed to do, and deduce where it went wrong. If it's generated code, as with GBDK, you can't. Therefore, your debugging has to be trial-and-error (and there's no standard output to `printf`-debug to!), which is slower.

And finally, another huge problem with GBDK: it's not updated. Period. The compîler is awful, and there's nothing you can do about it. Unless you have the skill to replace the toolchain, but then you certainly also have the skill to program in ASM. (I guess that's one of the reasons why GBDK isn't updated?)
I have seen someone who hit a compiler bug that kept corrupting memory. It wasn't his fault, so he was at a loss. And he didn't do anything that seemed wrong - SDCC had just inserted an `add sp, $27` instruction for no apparent reason. You can't trust that compiler.


tl;dr: try learning ASM for the Game Boy. Even if you end up going back to GBDK. Because it'll provide you insight as to what the console is actually doing, which is a must on such a small system.
Why not start here?


The French Lord Of Laziness.
Legend of Zelda and Undertale fan, I also tend to break Pokémon R/B/Y a little too much.

Twitter | Me on GCL | Discord : ISSOtm#9015 | Skype : isso.tm (I don't login anymore)

Offline

 

#8 2018-08-31 02:30:44

Zalo
Member
From: Spain
Registered: 2016-07-26
Posts: 103
Website

Re: [Question] Install GBDK Windows 10?

ISSOtm wrote:

GBDK's lib is awful.

Once again. No, it's not.

Offline

 

#9 2018-08-31 06:36:21

Jonas
Member
From: Frankfurt, Germany
Registered: 2016-06-06
Posts: 112
Website

Re: [Question] Install GBDK Windows 10?

ISSOtm wrote:

You can code your first GB game in ASM. It won't be worse or better than if it was made with GBDK. I've done it.

Sure. You can learn English by reading Hamlet. You can learn to play piano by practicing Rachmaninov. You can even learn to play videogames with the Japanese version of Super Mario Bros. 2. But it's not very rewarding and you're likely to be soon discouraged if you try to.

The TO wrote this:

Game_Boy_Fan wrote:

But I am just a beginner and I am not a professional programmer (C# a little bit). I only want to make my ideas into a game.

When I started with Game Boy development, I was in a situation very similar to the TO's. I had nearly no coding experience, started with GBDK, coded a simple game in C (Retroid) and then moved on to learn assembly. Based on that, I agree that assembly is far superior and there are few reasons I could think of to return to GBDK again. But for somebody with very little experience (like the TO) I'd still clearly advise to start with C and try to create something like Tetris, Breakout or Sokoban. For a beginner that's hard enough and for a project of that scope, you don't have to push the hardware to its limits. Therefore, GBDK is absolutely sufficient and there is a fair chance to end up with a finished game.

From your post I understand that you coded your first game for the Game Boy in assembly. But I rather doubt that means you started with no coding experience at all. If it does, you are either very talented or very patient and shouldn't expect that everybody else is.

tl;dr: The main upside of GBDK is that it's accessible for people who have no idea how a computer works and want to see results quickly. Assembly isn't.

Last edited by Jonas (2018-08-31 07:13:10)

Offline

 

#10 2018-08-31 11:45:56

ISSOtm
Member
From: Somewhere in Echo RAM
Registered: 2017-04-18
Posts: 160
Website

Re: [Question] Install GBDK Windows 10?

Zalo wrote:

ISSOtm wrote:

GBDK's lib is awful.

Once again. No, it's not.

Well, I explained in detail why it sucks imo. If you could explain why you think it doesn't, then please, be my guest.


Jonas wrote:

ISSOtm wrote:

You can code your first GB game in ASM. It won't be worse or better than if it was made with GBDK. I've done it.

Sure. You can learn English by reading Hamlet. You can learn to play piano by practicing Rachmaninov. You can even learn to play videogames with the Japanese version of Super Mario Bros. 2. But it's not very rewarding and you're likely to be soon discouraged if you try to.

You can, however, learn English by following a class explaining how Hamlet is constructed. (read: "following a tutorial explaining how to program in ASM")
Besides, ASM isn't that hard, and I'm not saying this from just my own experience. It's also different enough from all other programming languages that having a coding background isn't of much help, I believe.

Jonas wrote:

The TO wrote this:

Game_Boy_Fan wrote:

But I am just a beginner and I am not a professional programmer (C# a little bit). I only want to make my ideas into a game.

When I started with Game Boy development, I was in a situation very similar to the TO's. I had nearly no coding experience, started with GBDK, coded a simple game in C (Retroid) and then moved on to learn assembly. Based on that, I agree that assembly is far superior and there are few reasons I could think of to return to GBDK again. But for somebody with very little experience (like the TO) I'd still clearly advise to start with C and try to create something like Tetris, Breakout or Sokoban. For a beginner that's hard enough and for a project of that scope, you don't have to push the hardware to its limits. Therefore, GBDK is absolutely sufficient and there is a fair chance to end up with a finished game.

Imo the path you took is a good (the best?) one in the situation you were in. I am simply advocating against using GBDK for anything besides small games. (To put it differently, I agree with you on this, but I disagree with "all good HB games were written with GBDK")

The problem with GBDK is that it's nice when it works, but very confusing as soon as it stops working; this isn't very noob-friendly.
The other problem is thinking that it's sufficient. As you sid, you have little reasons to move back from ASM now; but if you had never tried ASM, you would still be using GBDK.
Also, again, I explained that while ASM is required to push the hardware's limits, it's not required to push the hardware if you're using ASM. You could code Retroid in ASM, for example. The finished product matters more than the code behind it, although I'd say GBDK is heavier on the processor so more likely to lag, which isn't very appreciable when it happens.

Jonas wrote:

From your post I understand that you coded your first game for the Game Boy in assembly. But I rather doubt that means you started with no coding experience at all. If it does, you are either very talented or very patient and shouldn't expect that everybody else is.

I started with a coding background, and imo knowledge of C is the best and only stepping stone that you can have to learning and mastering ASM. Therefore, I think that you can simply learn C then directly skip to ASM, without making a GBDK game. But I can understand that some people want something running quickly. (In the tutorial I'm making, which I linked, the first running program comes after quite a few lessons, which isn't something I really like, but kinda had to do.)
Again, what I really hate with GBDK is how it tries to obscure the hardware. Because it's detrimental to figuring out what you can do with the console, and to debugging.
I'd love if there was a better toolkit, but there isn't. And I know that I'd "just" have to make a better one, but it's an involving project, and my current resources are spent elsewhere.

Jonas wrote:

tl;dr: The main upside of GBDK is that it's accessible for people who have no idea how a computer works and want to see results quickly. Assembly isn't.

That's its upside, but it has a ton of issues, which is why I'm advocating against it.


The French Lord Of Laziness.
Legend of Zelda and Undertale fan, I also tend to break Pokémon R/B/Y a little too much.

Twitter | Me on GCL | Discord : ISSOtm#9015 | Skype : isso.tm (I don't login anymore)

Offline

 

#11 2018-09-01 04:49:24

Jonas
Member
From: Frankfurt, Germany
Registered: 2016-06-06
Posts: 112
Website

Re: [Question] Install GBDK Windows 10?

Well I don't think there are many points on which we disagree.

ISSOtm wrote:

I am simply advocating against using GBDK for anything besides small games. (To put it differently, I agree with you on this, but I disagree with "all good HB games were written with GBDK")

I certainly don't disagree with that. Instead, I stated:

Jonas wrote:

There are good reasons for some of the best homebrew games for the Game Boy being coded in C...

To be specific, I had Tobu Tobu Girl, Super Princess 2092 Exodus and Crazy Zone in mind. But I'd be the last to say that there are no good assembly homebrew games (particularly not since the most recent game I released myself is coded 100% in assembly).

The one point where we do disagree is whether or not GBDK's better accessibility for beginners with zero coding experience compensates for its (many) weaknesses. My advice to a beginner would be to accept GBDK's issues for the start while you - as I understand - would suggest to learn coding somewhere else and later return to the Game Boy to start with assembly from the outset. I believe that will chase some people away who want nothing more than to make a small game and see how far they get with it. But it's not much of a difference and probably depends very much on the individual goals and personal taste of the person in question.

Last edited by Jonas (2018-09-01 04:51:44)

Offline

 

#12 2018-09-01 06:07:40

Zalo
Member
From: Spain
Registered: 2016-07-26
Posts: 103
Website

Re: [Question] Install GBDK Windows 10?

ISSOtm wrote:

Zalo wrote:

ISSOtm wrote:

GBDK's lib is awful.

Once again. No, it's not.

Well, I explained in detail why it sucks imo. If you could explain why you think it doesn't, then please, be my guest.

Ok, it seems fair

As you said, it is not GBDK what "sucks"... it is SDCC...Actually, it is not SDCC, is the version that was available back then when GBDK was released...

You should avoid words like "sucks" "awful"... etc when talking about the work of other people. For what I saw the guy who worked on this library put a lot of effort and love on it and if you take a look at the source code (it comes with the GBDK itself) you'll see that I am right. You will also see that most of the code is written on assembly... except for a couple of files used for printf and things like that. SDCC assembly, but assembly after all, and pretty well optimized, because he knew what he was doing and I think he deserves some respect, even if it's been 20 years since he gave this for free to all of us. Besides I have read a lot of false things about GBDK like not being able to use function pointers (¿?¿?) or switch statements... Also I've seen lots of "bugs" that are not real bugs but instead problems understanding how 8 bit arithmetic works and how signed and unsigned values combine whith each other.

About SDCC, yes, it had a lot of bugs in 2001. And some of them very annoying (see my post here), but the library has been updated along the years and now it works like a charm. It even let you mix asm and C in case you want to optimize your code. Getting it to work with GBDK is not that complicated, I have explained several times how to do it (some info here)and you have the makefiles that I use in ZGB if you want to take a look. Does SDCC sucks too? No. This is the work of people along the years asking nothing in return and I really appreciate it. It requires some extra work from people but we can all benefit from that instead of just spreading the word "sucks" over it

You are also insisting several times on GBDK hiding the hardware stuff (¿?¿?¿?)... not sure where you got this idea. I have accessed the registers to play sound for example and the docs clearly show you how to do it. Also before starting to code anything it is good to read the documentation. On my experience not many people do it but then they are the first to complain abouth everything

And about ZGB, I worked on it to give access to people to Game Boy development on an easy way. I am more than happy with the result and it makes my day when someone sends me an email or a tweet showing me what they have done. I feel really thankful to GBDK and SDCC and all the community that worked on all that stuff. You can use it or not, but just advising people to avoid it because it uses C instead of assembly I think is a mistake. In this 2 years I have already developed 4 games and recently we organized the ZGBJam where 8 games were produced in just a couple of days. Is this something that can be done in asm? Trust me: no

Offline

 

#13 2018-09-02 07:30:42

tmk
Member
Registered: 2017-05-01
Posts: 63
Website

Re: [Question] Install GBDK Windows 10?

I can't tell much about previous versions of SDCC but the last one I used (v3.6.0) didn't encourage me to even consider it as an option. Long story short - I wanted to compile some C code instead of porting it to ASM. After looking at output source I immediately started writing in ASM from scratch. smile This is probably because I know assembly well enough and prefer clean code. Here's some small example, not just my words:

Code:

const unsigned char *input_data;
size_t input_index;

unsigned char read_byte() 
{
    return input_data[input_index++];
}

And here's SDCC v3.6.0 output:

Code:

_read_byte::
;some_source.c:43: return input_data[input_index++];
;156 / 172
    ld    hl,#_input_index + 1    ; 12
    dec    hl                ; 8
    ld    c,(hl)            ; 8
    inc    hl            ; 8
    ld    b,(hl)            ; 8
    dec    hl            ; 8
    inc    (hl)            ; 12
    jr    NZ,00103$        ; 12/8
    inc    hl            ; 8
    inc    (hl)            ; 12
00103$:
    ld    a,c            ; 4
    ld    hl,#_input_data        ; 12
    add    a, (hl)            ; 8
    ld    c,a            ; 4
    ld    a,b            ; 4
    inc    hl            ; 8
    adc    a, (hl)            ; 8
    ld    b,a            ; 4
    ld    a,(bc)            ; 8
    ld    e,a            ; 4
    ret                ; 16

Here's my quick rewrite based on above:

Code:

;100 / 116
    ld    hl,input_index+1    ; 12
    ld    a,(hl-)            ; 8
    ld    d,a            ; 4
    ld    e,(hl)            ; 8
    inc    (hl)            ; 12
    jr    nz,_1            ; 12/8
    inc    hl            ; 8
    inc    (hl)            ; 12
_1
    ld    hl,input_data        ; 12
    add    hl,de            ; 8
    ld    a,(hl)            ; 8
    ret                ; 16

And something more optimized I'd probably use:

Code:

;100 / 104
    ld    hl,input_index        ; 12
    ld    a,(hl)            ; 8
    ld    e,a            ; 4
    inc    a            ; 4
    ld    (hl+),a            ; 8
    ld    d,(hl)            ; 8
    jr    nz,_1            ; 12/8
    inc    (hl)            ; 8
_1
    ld    hl,input_data        ; 12
    add    hl,de            ; 8
    ld    a,(hl)            ; 8
    ret                ; 16

SDCC version uses 156 cycles min / 172 max, my routines respectively 100 / 116 and 100 / 104 cycles and someone probably could do better. I haven't tested them but they should be ok.

Conclusion? SDCC works but it still has a long way to go. And just because someone put a lot effort in something it doesn't make it "suckproof". It all comes down to your skill and expectations. Just my .02 cents.

Offline

 

#14 2018-09-02 07:50:35

Zalo
Member
From: Spain
Registered: 2016-07-26
Posts: 103
Website

Re: [Question] Install GBDK Windows 10?

I never said that SDCC will create better code than the one you can write in asm

Offline

 

#15 2018-09-03 04:22:28

tmk
Member
Registered: 2017-05-01
Posts: 63
Website

Re: [Question] Install GBDK Windows 10?

And I didn't mean to imply that. My point was simply to balance your praise of SDCC.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson