Questions tagged [gbdk]

GBDK is a development kit for the Nintendo Gameboy containing an ANSI C compiler, assembler, linker, several libraries, and some example programs.

GBDK (short for GameBoy Developers Kit) is a development kit for the Nintendo containing an ANSI C compiler, assembler, linker, several libraries, and some example programs.

14 questions
4
votes
0 answers

Concatenating string and char literals in C

In my code I define some compiler constants such as the following: #define D_CR '\x10' // New line #define D_LF '\x13' // New paragraph #define D_EOS '\xFF' // End of string (these could be chars, ints, whatever ... ) And I want to use…
bashaus
  • 1,614
  • 1
  • 17
  • 33
4
votes
1 answer

Forward declaration of typedef structs in GBDK C

I'm using GBDK C to create a Game for the original Game Boy, and I have run in to a little problem. Each room in my game needs to have different portals, but each portal needs to reference a room. Here is a cut-back version of the code: typedef…
bashaus
  • 1,614
  • 1
  • 17
  • 33
3
votes
0 answers

Right shifting unsigned variables gives strange result - C / GBDK

I'm developing a gameboy game in GBDK but I've got a problem with right-shifting (8bit) unsigned variables. The code looks like this. #include #include #define GAME_OBJ_MAX_WIDTH 10 #define GAME_OBJ_MAX_HEIGHT 8 struct…
Timax
  • 31
  • 3
3
votes
2 answers

"\r" Literally Prints Carriage Return Symbol

I'm teaching myself the C programming language. Except I'm learning in context of designing a Gameboy game (using GBDEK). I'm working on a simple Breakout clone, and have decided to use the printf() function to show the player's score. When the…
Ben Klayer
  • 61
  • 6
3
votes
2 answers

Bug with power-of-two multiplication in GBDK compiler

I'm currently developing a gameboy emulator and to test the correctness of my emulator I'm using GBDK to compile c programs for my emulator. I noticed that the compiler (as expected) optimizes multiplications with constants that are a power of two…
monoceres
  • 4,722
  • 4
  • 38
  • 63
1
vote
0 answers

Trigonometry Functions in GBDK?

There is probably a rather elegant solution to this, but for the life of me I am unable to find any form of trig functions in gbdk – with the "math.h" library not included (probably missing something). Any help would be greatly appreciated. I've…
1
vote
1 answer

How can you get a random number on GBDK?

I'm new to C and to GBDK and I want to code a random number generator that decides between 0 and 1. Like a 'hacker' simulator. I have tried a lot of examples from the Internet. But none worked. Screenshot from the output of the last attempt I made:…
1
vote
0 answers

GBDK C-Compiler Parsing Errors: Why won't it let me declare variables at such specific places?

I am currently learning C in order to program the original Game Boy using the GBDK library & C Compiler. For whatever reason, the C Compiler continues to run into parser errors whenever I try to declare variables within certain parts of my main…
SooBaccaCole
  • 383
  • 1
  • 3
  • 6
1
vote
1 answer

Makefile output into subfolder

I'm working on setting up a project for a GameBoy game, I want to have the files output into a subfolder of the project rather than the root. Adding the foldername in front of the filenames doesn't seem to work nor do any of the suggestions I've…
0
votes
1 answer

Trouble registering screen boundaries for certain inputs (down and right)

I am creating a scrolling shooter for DMG using gbdk, it is based off some youtube tutorials and this example. In fact the link is the skeleton of my program. My issue is that the screen boundary conditions aren't working properly for down and right…
anapollosun
  • 15
  • 1
  • 4
0
votes
1 answer

SDCC / GBDK, Passing array of structs to function

I am attempting to pass a pair of arrays of structures to a function in C. I must use the SDCC compiler as I am compiling for Gameboy using GBDK. When I pass the array of structures I get an error as shown below, however, if I take the function…
G. Putnam
  • 1,262
  • 5
  • 10
0
votes
0 answers

How ot display a Tilemap in Game Boy

I am trying to display this image with Game Boy Developer Kit and i don't see it displayed when i run the emulator The code i use is this one void displayDodge(){ int nbTiles = (160 * 144) / 8; int i,j; SPRITES_8x8; j = 0; set_sprite_data(0,…
nazimboudeffa
  • 939
  • 6
  • 20
0
votes
1 answer

Compiling string literals in ASM for SDCC/LCC

I'm trying to write string literals in ASM for GBDK's LCC. I can write each individual character and the compiler is working fine. .D_LINE = 0x0A ;; Works .db "G", "I", "A", "N", "L", "U", "C", "A", #.D_LINE However, when I try and combine the…
bashaus
  • 1,614
  • 1
  • 17
  • 33
0
votes
1 answer

Including a static library in a GBDK C project (GBExtended)

I want to use the GBExtended library in my game but I am having difficulty understanding how I would include the library. I can see that the GBExtended library (at least from the loderunner example source) contains the directories includes/, lib/…
bashaus
  • 1,614
  • 1
  • 17
  • 33