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 2014-07-28 13:29:14

andreai
Member
Registered: 2014-07-28
Posts: 21

GBDK 2.96 banked funcions disabled?

Hi guys,

I was really getting into this and got to the point of needing or at least wanting to explore banked function calls, just to know I can keep adding code if I reach the limit of the DMG memory...all to find out that GBDK 2.96 seem to have disabled banked function calls, and I'm on a mac, and that's the only version I could get running.
HELP!

Any help I mean, workarounds are welcome too, like: is code banking even a suggested practice? do comemrcial games use it and will definetely need it to make a more serious game? how much code will I really be able to squeeze on the main memory and how would I know when it got past?


Thanks : )

Andre

Offline

 

#2 2014-08-05 04:00:51

andreai
Member
Registered: 2014-07-28
Posts: 21

Re: GBDK 2.96 banked funcions disabled?

I eventually switched to this setup:
Virtual Box + windows XP + GBDK 2.95 + CYGWIN (to have a unix shell instead of DOS)

Shell pointing to a folder on the Os X drive and shared with the virtual machine, it will feel like it's a native app but running windows stuff ; )

I highly recommend it for Os X developers because you are no longer limited to the software available on mac, no wines, and also because 2.95 is a more strict version of GBDK that will make you sweat more on casting between types and you'll spot issues early on, 2.96 is more loose but eventually you see stuff shifted around, values not receiving the right content and most importantly, I now have the possibility eventually to store code inside an external bank.

Hope that helps the others.

Last edited by andreai (2014-08-05 04:03:11)

Offline

 

#3 2014-08-08 06:41:59

LuckyLights
Member
Registered: 2014-07-06
Posts: 20

Re: GBDK 2.96 banked funcions disabled?

Hi andreai,

Was banked functions disabled in 2.96a? I find that value casting in 2.96 is kind of broken anyway and I tend not to use it at all.
But it would fell kind of strange to 'downgrade' to 2.95.

btw, dos bit fileds work in 2.95? They clearly do not in 2.96.

Offline

 

#4 2014-08-10 00:19:43

MatthewCallis
New member
From: Seattle, Washington
Registered: 2014-08-10
Posts: 2

Re: GBDK 2.96 banked funcions disabled?

I have successfully built and compiled gbdk on OS X 10.10 DP5 using https://github.com/co-me/gbdk as a base. All the demos worked so you might try using that to port 2.95 over.

Offline

 

#5 2014-09-11 07:03:21

andreai
Member
Registered: 2014-07-28
Posts: 21

Re: GBDK 2.96 banked funcions disabled?

Just to help anyone who bumps on this thread:
I was able to store code inside banks. The reason I needed it was that my compiled code stopped working once I added one more function to the main file. Removing that function caused the game to work again. I had run out of space on the main memory, those 32k are easily filled with C I guess.
The solution:
Created a new file and specified the command line to bank its content, just ROM bank, no RAM needed.
This caused some confusion initially, but it makes sense now, the code is stored in the rom, any non-static variable declared within this banked code is then loaded onto the gameboy's RAM automatically, so really it's a no brainer.
Functions are declared normally, no BANKED or NONBANKED flag is needed next to the function declaration.
Within the banked code file, I can declare global variables that resides on the main game code file: extern UBYTE myGlobalVar;
Within the main game code file, I have to declare the banked function as external:
extern void myBankedFunc();

Before invoking that function from the main game code file I need to switch to the appropriate bank of course.
Only one annoying thing, you can't of course switch bank again from within the banked function, or you'll switch yourself out, as also reported by the GBDK release docs.

So my code is now happily living inside a cartridge and growing without too many worries : )

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson