Last active
May 25, 2020 21:26
-
-
Save ChampionLeake/5a62bd3cdd9e0eea44defa6756b4c6fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <gba_console.h> | |
#include <gba_video.h> | |
#include <gba_interrupt.h> | |
#include <gba_systemcalls.h> | |
#include <stdio.h> | |
typedef unsigned char uint8; | |
typedef unsigned short uint16; | |
typedef unsigned int uint32; | |
#define VIDEOMODE_0 0x0000 | |
#define BACKGROUND_0 0x0100 | |
#define REG_DISPLAYCONTROL *((volatile uint16*)(0x04000000)) | |
#define REG_BG0_CONTROL *((volatile uint32*)(0x04000008)) | |
#define MEM_VRAM ((volatile uint32*)0x6000000) | |
#define MEM_BG_PALETTE ((uint16*)(0x05000000)) | |
#define MEM_PALETTE ((uint16*)(0x05000200)) | |
inline uint16 RGB15(uint32 red, uint32 green, uint32 blue){ | |
return red | (green<<5) | (blue<<10); | |
} | |
void CreateBackground(){ | |
MEM_BG_PALETTE[0] = RGB15(12,0,50); | |
} | |
int main(){ | |
irqInit(); | |
irqEnable(IRQ_VBLANK); | |
CreateBackground(); | |
REG_DISPLAYCONTROL = VIDEOMODE_0 | BACKGROUND_0; | |
while (1) { | |
VBlankIntrWait(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment