Skip to content

Instantly share code, notes, and snippets.

@videlais

videlais/main.c Secret

Last active July 3, 2016 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save videlais/65f53a14c34adc90abb65baef83dcf13 to your computer and use it in GitHub Desktop.
Save videlais/65f53a14c34adc90abb65baef83dcf13 to your computer and use it in GitHub Desktop.
GBDK Example
#include <gb/gb.h>
void init();
void checkInput();
void main() {
init();
while(1) {
checkInput();
// Game code here
}
}
void init() {
DISPLAY_ON; // Turn on the display
NR52_REG = 0x8F; // Turn on the sound
NR51_REG = 0x11; // Enable the sound channels
NR50_REG = 0x77; // Increase the volume to its max
}
void checkInput() {
if (joypad() & J_B) {
// The B button was pressed!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment