libnds
Macros | Typedefs | Enumerations | Functions
video.h File Reference

Contains the basic defnitions for controlling the video hardware. More...

#include <nds/arm9/sassert.h>
#include <nds/ndstypes.h>
#include <nds/system.h>

Macros

#define ARGB16(a, r, g, b)   (((a) << 15) | (r) | ((g) << 5) | ((b) << 10))
 Macro to convert 5 bit r, g, b components plus 1 bit alpha into a single 16 bit ARGB triplet.
 
#define BG_GFX   ((u16 *)0x6000000)
 Background graphics memory.
 
#define BG_GFX_SUB   ((u16 *)0x6200000)
 Background graphics memory (sub engine)
 
#define BG_PALETTE   ((u16 *)0x5000000)
 Background palette memory.
 
#define BG_PALETTE_SUB   ((u16 *)0x5000400)
 Background palette memory (sub engine)
 
#define OAM   ((u16 *)0x7000000)
 Pointer to Object Attribute Memory.
 
#define OAM_SUB   ((u16 *)0x7000400)
 Pointer to Object Attribute Memory (Sub engine)
 
#define RGB15(r, g, b)   ((r) | ((g) << 5) | ((b) << 10))
 Macro to convert 5 bit r, g, b components into a single 15 bit RGB triplet.
 
#define SPRITE_GFX   ((u16 *)0x6400000)
 Sprite graphics memory.
 
#define SPRITE_GFX_SUB   ((u16 *)0x6600000)
 Sprite graphics memory (sub engine)
 
#define SPRITE_PALETTE   ((u16 *)0x5000200)
 Sprite palette memory.
 
#define SPRITE_PALETTE_SUB   ((u16 *)0x5000600)
 Sprite palette memory (sub engine)
 
#define VRAM_A   ((u16 *)0x6800000)
 Pointer to VRAM bank A mapped as LCD.
 
#define VRAM_B   ((u16 *)0x6820000)
 Pointer to VRAM bank B mapped as LCD.
 
#define VRAM_C   ((u16 *)0x6840000)
 Pointer to VRAM bank C mapped as LCD.
 
#define VRAM_D   ((u16 *)0x6860000)
 Pointer to VRAM bank D mapped as LCD.
 
#define VRAM_E   ((u16 *)0x6880000)
 Pointer to VRAM bank E mapped as LCD.
 
#define VRAM_E_EXT_PALETTE   ((_ext_palette *)VRAM_E)
 Used for accessing VRAM E as an extended palette.
 
#define VRAM_F   ((u16 *)0x6890000)
 Pointer to VRAM bank F mapped as LCD.
 
#define VRAM_F_EXT_PALETTE   ((_ext_palette *)VRAM_F)
 Used for accessing VRAM F as an extended palette.
 
#define VRAM_F_EXT_SPR_PALETTE   ((_palette *)VRAM_F)
 Used for accessing VRAM F as an extended sprite palette.
 
#define VRAM_G   ((u16 *)0x6894000)
 Pointer to VRAM bank G mapped as LCD.
 
#define VRAM_G_EXT_PALETTE   ((_ext_palette *)VRAM_G)
 Used for accessing VRAM G as an extended palette.
 
#define VRAM_G_EXT_SPR_PALETTE   ((_palette *)VRAM_G)
 Used for accessing VRAM G as an extended sprite palette.
 
#define VRAM_H   ((u16 *)0x6898000)
 Pointer to VRAM bank H mapped as LCD.
 
#define VRAM_H_EXT_PALETTE   ((_ext_palette *)VRAM_H)
 Used for accessing VRAM H as an extended palette.
 
#define VRAM_I   ((u16 *)0x68A0000)
 Pointer to VRAM bank I mapped as LCD.
 
#define VRAM_I_EXT_SPR_PALETTE   ((_palette *)VRAM_I)
 Used for accessing VRAM I as an extended sprite palette.
 

Typedefs

typedef _palette _ext_palette[16]
 Array of 16 256-color palettes.
 
typedef u16 _palette[256]
 Array of 256 15-bit RGB values that represents a palette.
 

Enumerations

enum  VideoMode {
  MODE_0_2D = 0x10000 ,
  MODE_1_2D = 0x10001 ,
  MODE_2_2D = 0x10002 ,
  MODE_3_2D = 0x10003 ,
  MODE_4_2D = 0x10004 ,
  MODE_5_2D = 0x10005 ,
  MODE_6_2D = 0x10006 ,
  MODE_0_3D = (0x10000 | (1 << 8) | (1 << 3) ) ,
  MODE_1_3D = (0x10001 | (1 << 8) | (1 << 3) ) ,
  MODE_2_3D = (0x10002 | (1 << 8) | (1 << 3) ) ,
  MODE_3_3D = (0x10003 | (1 << 8) | (1 << 3) ) ,
  MODE_4_3D = (0x10004 | (1 << 8) | (1 << 3) ) ,
  MODE_5_3D = (0x10005 | (1 << 8) | (1 << 3) ) ,
  MODE_6_3D = (0x10006 | (1 << 8) | (1 << 3) ) ,
  MODE_FIFO = (3 << 16) ,
  MODE_FB0 = (0x00020000) ,
  MODE_FB1 = (0x00060000) ,
  MODE_FB2 = (0x000A0000) ,
  MODE_FB3 = (0x000E0000)
}
 The allowed video modes of the 2D processors. More...
 
enum  VRAM_A_TYPE {
  VRAM_A_LCD = 0 ,
  VRAM_A_MAIN_BG = 1 ,
  VRAM_A_MAIN_BG_0x06000000 = 1 | (( 0 ) << 3) ,
  VRAM_A_MAIN_BG_0x06020000 = 1 | (( 1 ) << 3) ,
  VRAM_A_MAIN_BG_0x06040000 = 1 | (( 2 ) << 3) ,
  VRAM_A_MAIN_BG_0x06060000 = 1 | (( 3 ) << 3) ,
  VRAM_A_MAIN_SPRITE = 2 ,
  VRAM_A_MAIN_SPRITE_0x06400000 = 2 | (( 0 ) << 3) ,
  VRAM_A_MAIN_SPRITE_0x06420000 = 2 | (( 1 ) << 3) ,
  VRAM_A_TEXTURE = 3 ,
  VRAM_A_TEXTURE_SLOT0 = 3 | (( 0 ) << 3) ,
  VRAM_A_TEXTURE_SLOT1 = 3 | (( 1 ) << 3) ,
  VRAM_A_TEXTURE_SLOT2 = 3 | (( 2 ) << 3) ,
  VRAM_A_TEXTURE_SLOT3 = 3 | (( 3 ) << 3)
}
 Allowed VRAM bank A modes. More...
 
enum  VRAM_B_TYPE {
  VRAM_B_LCD = 0 ,
  VRAM_B_MAIN_BG = 1 | (( 1 ) << 3) ,
  VRAM_B_MAIN_BG_0x06000000 = 1 | (( 0 ) << 3) ,
  VRAM_B_MAIN_BG_0x06020000 = 1 | (( 1 ) << 3) ,
  VRAM_B_MAIN_BG_0x06040000 = 1 | (( 2 ) << 3) ,
  VRAM_B_MAIN_BG_0x06060000 = 1 | (( 3 ) << 3) ,
  VRAM_B_MAIN_SPRITE = 2 ,
  VRAM_B_MAIN_SPRITE_0x06400000 = 2 | (( 0 ) << 3) ,
  VRAM_B_MAIN_SPRITE_0x06420000 = 2 | (( 1 ) << 3) ,
  VRAM_B_TEXTURE = 3 | (( 1 ) << 3) ,
  VRAM_B_TEXTURE_SLOT0 = 3 | (( 0 ) << 3) ,
  VRAM_B_TEXTURE_SLOT1 = 3 | (( 1 ) << 3) ,
  VRAM_B_TEXTURE_SLOT2 = 3 | (( 2 ) << 3) ,
  VRAM_B_TEXTURE_SLOT3 = 3 | (( 3 ) << 3)
}
 Allowed VRAM bank B modes. More...
 
enum  VRAM_C_TYPE {
  VRAM_C_LCD = 0 ,
  VRAM_C_MAIN_BG = 1 | (( 2 ) << 3) ,
  VRAM_C_MAIN_BG_0x06000000 = 1 | (( 0 ) << 3) ,
  VRAM_C_MAIN_BG_0x06020000 = 1 | (( 1 ) << 3) ,
  VRAM_C_MAIN_BG_0x06040000 = 1 | (( 2 ) << 3) ,
  VRAM_C_MAIN_BG_0x06060000 = 1 | (( 3 ) << 3) ,
  VRAM_C_ARM7 = 2 ,
  VRAM_C_ARM7_0x06000000 = 2 | (( 0 ) << 3) ,
  VRAM_C_ARM7_0x06020000 = 2 | (( 1 ) << 3) ,
  VRAM_C_SUB_BG = 4 ,
  VRAM_C_SUB_BG_0x06200000 = 4 | (( 0 ) << 3) ,
  VRAM_C_TEXTURE = 3 | (( 2 ) << 3) ,
  VRAM_C_TEXTURE_SLOT0 = 3 | (( 0 ) << 3) ,
  VRAM_C_TEXTURE_SLOT1 = 3 | (( 1 ) << 3) ,
  VRAM_C_TEXTURE_SLOT2 = 3 | (( 2 ) << 3) ,
  VRAM_C_TEXTURE_SLOT3 = 3 | (( 3 ) << 3)
}
 Allowed VRAM bank C modes. More...
 
enum  VRAM_D_TYPE {
  VRAM_D_LCD = 0 ,
  VRAM_D_MAIN_BG = 1 | (( 3 ) << 3) ,
  VRAM_D_MAIN_BG_0x06000000 = 1 | (( 0 ) << 3) ,
  VRAM_D_MAIN_BG_0x06020000 = 1 | (( 1 ) << 3) ,
  VRAM_D_MAIN_BG_0x06040000 = 1 | (( 2 ) << 3) ,
  VRAM_D_MAIN_BG_0x06060000 = 1 | (( 3 ) << 3) ,
  VRAM_D_ARM7 = 2 | (( 1 ) << 3) ,
  VRAM_D_ARM7_0x06000000 = 2 | (( 0 ) << 3) ,
  VRAM_D_ARM7_0x06020000 = 2 | (( 1 ) << 3) ,
  VRAM_D_SUB_SPRITE = 4 ,
  VRAM_D_SUB_SPRITE_0x06600000 = 4 ,
  VRAM_D_TEXTURE = 3 | (( 3 ) << 3) ,
  VRAM_D_TEXTURE_SLOT0 = 3 | (( 0 ) << 3) ,
  VRAM_D_TEXTURE_SLOT1 = 3 | (( 1 ) << 3) ,
  VRAM_D_TEXTURE_SLOT2 = 3 | (( 2 ) << 3) ,
  VRAM_D_TEXTURE_SLOT3 = 3 | (( 3 ) << 3)
}
 Allowed VRAM bank D modes. More...
 
enum  VRAM_E_TYPE {
  VRAM_E_LCD = 0 ,
  VRAM_E_MAIN_BG = 1 ,
  VRAM_E_MAIN_BG_0x06000000 = 1 ,
  VRAM_E_MAIN_SPRITE = 2 ,
  VRAM_E_MAIN_SPRITE_0x06400000 = 2 ,
  VRAM_E_TEX_PALETTE = 3 ,
  VRAM_E_BG_EXT_PALETTE = 4
}
 Allowed VRAM bank E modes. More...
 
enum  VRAM_F_TYPE {
  VRAM_F_LCD = 0 ,
  VRAM_F_MAIN_BG = 1 ,
  VRAM_F_MAIN_BG_0x06000000 = 1 | (( 0 ) << 3) ,
  VRAM_F_MAIN_BG_0x06004000 = 1 | (( 1 ) << 3) ,
  VRAM_F_MAIN_BG_0x06010000 = 1 | (( 2 ) << 3) ,
  VRAM_F_MAIN_BG_0x06014000 = 1 | (( 3 ) << 3) ,
  VRAM_F_MAIN_SPRITE = 2 ,
  VRAM_F_MAIN_SPRITE_0x06400000 = 2 | (( 0 ) << 3) ,
  VRAM_F_MAIN_SPRITE_0x06404000 = 2 | (( 1 ) << 3) ,
  VRAM_F_MAIN_SPRITE_0x06410000 = 2 | (( 2 ) << 3) ,
  VRAM_F_MAIN_SPRITE_0x06414000 = 2 | (( 3 ) << 3) ,
  VRAM_F_TEX_PALETTE = 3 ,
  VRAM_F_TEX_PALETTE_SLOT0 = 3 | (( 0 ) << 3) ,
  VRAM_F_TEX_PALETTE_SLOT1 = 3 | (( 1 ) << 3) ,
  VRAM_F_TEX_PALETTE_SLOT4 = 3 | (( 2 ) << 3) ,
  VRAM_F_TEX_PALETTE_SLOT5 = 3 | (( 3 ) << 3) ,
  VRAM_F_BG_EXT_PALETTE = 4 ,
  VRAM_F_BG_EXT_PALETTE_SLOT01 = 4 | (( 0 ) << 3) ,
  VRAM_F_BG_EXT_PALETTE_SLOT23 = 4 | (( 1 ) << 3) ,
  VRAM_F_SPRITE_EXT_PALETTE = 5
}
 Allowed VRAM bank F modes. More...
 
enum  VRAM_G_TYPE {
  VRAM_G_LCD = 0 ,
  VRAM_G_MAIN_BG = 1 ,
  VRAM_G_MAIN_BG_0x06000000 = 1 | (( 0 ) << 3) ,
  VRAM_G_MAIN_BG_0x06004000 = 1 | (( 1 ) << 3) ,
  VRAM_G_MAIN_BG_0x06010000 = 1 | (( 2 ) << 3) ,
  VRAM_G_MAIN_BG_0x06014000 = 1 | (( 3 ) << 3) ,
  VRAM_G_MAIN_SPRITE = 2 ,
  VRAM_G_MAIN_SPRITE_0x06400000 = 2 | (( 0 ) << 3) ,
  VRAM_G_MAIN_SPRITE_0x06404000 = 2 | (( 1 ) << 3) ,
  VRAM_G_MAIN_SPRITE_0x06410000 = 2 | (( 2 ) << 3) ,
  VRAM_G_MAIN_SPRITE_0x06414000 = 2 | (( 3 ) << 3) ,
  VRAM_G_TEX_PALETTE = 3 ,
  VRAM_G_TEX_PALETTE_SLOT0 = 3 | (( 0 ) << 3) ,
  VRAM_G_TEX_PALETTE_SLOT1 = 3 | (( 1 ) << 3) ,
  VRAM_G_TEX_PALETTE_SLOT4 = 3 | (( 2 ) << 3) ,
  VRAM_G_TEX_PALETTE_SLOT5 = 3 | (( 3 ) << 3) ,
  VRAM_G_BG_EXT_PALETTE = 4 ,
  VRAM_G_BG_EXT_PALETTE_SLOT01 = 4 | (( 0 ) << 3) ,
  VRAM_G_BG_EXT_PALETTE_SLOT23 = 4 | (( 1 ) << 3) ,
  VRAM_G_SPRITE_EXT_PALETTE = 5
}
 Allowed VRAM bank G modes. More...
 
enum  VRAM_H_TYPE {
  VRAM_H_LCD = 0 ,
  VRAM_H_SUB_BG = 1 ,
  VRAM_H_SUB_BG_0x06200000 = 1 ,
  VRAM_H_SUB_BG_EXT_PALETTE = 2
}
 Allowed VRAM bank H modes. More...
 
enum  VRAM_I_TYPE {
  VRAM_I_LCD = 0 ,
  VRAM_I_SUB_BG_0x06208000 = 1 ,
  VRAM_I_SUB_SPRITE = 2 ,
  VRAM_I_SUB_SPRITE_0x06600000 = 2 ,
  VRAM_I_SUB_SPRITE_EXT_PALETTE = 3
}
 Allowed VRAM bank I modes. More...
 

Functions

static void setBackdropColor (const u16 color)
 Sets the backdrop color of the main engine. More...
 
static void setBackdropColorSub (const u16 color)
 Sets the backdrop color of the sub engine. More...
 
void setBrightness (int screen, int level)
 Sets the screens brightness. More...
 
static bool video3DEnabled (void)
 Determine if 3D is enabled. More...
 
static void videoBgDisable (int number)
 Disables the specified background on the main engine. More...
 
static void videoBgDisableSub (int number)
 Disables the specified background on the sub engine. More...
 
static void videoBgEnable (int number)
 Enables the specified background on the main engine. More...
 
static void videoBgEnableSub (int number)
 Enables the specified background on the sub engine. More...
 
static int videoGetMode (void)
 Gets the main 2D engine video mode. More...
 
static int videoGetModeSub (void)
 Gets the sub 2D engine video mode. More...
 
static void videoSetMode (u32 mode)
 Sets the main 2D engine video mode. More...
 
static void videoSetModeSub (u32 mode)
 Sets the sub 2D engine video mode. More...
 
u32 vramDefault (void)
 Set VRAM banks to basic default. More...
 
static void vramRestoreBanks_EFG (u32 vramTemp)
 Restore the modes of VRAM banks E, F, and G. More...
 
static void vramRestorePrimaryBanks (u32 vramTemp)
 Restore the main 4 VRAM bank modes. More...
 
static void vramSetBankA (VRAM_A_TYPE a)
 Set VRAM bank A to the indicated mapping. More...
 
static void vramSetBankB (VRAM_B_TYPE b)
 Set VRAM bank B to the indicated mapping. More...
 
static void vramSetBankC (VRAM_C_TYPE c)
 Set VRAM bank C to the indicated mapping. More...
 
static void vramSetBankD (VRAM_D_TYPE d)
 Set VRAM bank D to the indicated mapping. More...
 
static void vramSetBankE (VRAM_E_TYPE e)
 Set VRAM bank E to the indicated mapping. More...
 
static void vramSetBankF (VRAM_F_TYPE f)
 Set VRAM bank F to the indicated mapping. More...
 
static void vramSetBankG (VRAM_G_TYPE g)
 Set VRAM bank G to the indicated mapping. More...
 
static void vramSetBankH (VRAM_H_TYPE h)
 Set VRAM bank H to the indicated mapping. More...
 
static void vramSetBankI (VRAM_I_TYPE i)
 Set VRAM bank I to the indicated mapping. More...
 
u32 vramSetBanks_EFG (VRAM_E_TYPE e, VRAM_F_TYPE f, VRAM_G_TYPE g)
 Set the mode of VRAM banks E, F and G. More...
 
u32 vramSetPrimaryBanks (VRAM_A_TYPE a, VRAM_B_TYPE b, VRAM_C_TYPE c, VRAM_D_TYPE d)
 Set the mode of the main 4 VRAM banks. More...
 

Detailed Description

Contains the basic defnitions for controlling the video hardware.

Intro

video.h contains the basic defnitions for controlling the video hardware.

Video Ram Banks

The Nintendo DS has nine banks of video memory which may be put to a variety of uses. They can hold the graphics for your sprites, the textures for your 3D space ships, the tiles for your 2D platformer, or a direct map of pixels to render to the screen. Figuring out how to effectively utilize this flexible but limited amount of memory will be one the most challenging endeavors you will face early homebrew development.

The nine banks can be utilized as enumerated by the VRAM types. Banks are labeled A-I. In order to utilize 2D or 3D texture graphics, memory must be mapped for these purposes.

For instance: If you initialize a 2D background on the main engine you will be expected to define both an offset for its map data and an offset for its tile graphics (bitmapped backgrounds differ slightly). These offsets are referenced from the start of 2D background graphics memory. On the main display 2D background graphics begin at 0x6000000.

Without mapping a VRAM bank to this location data written to your background tile and map offsets will be lost.

VRAM banks can be mapped to specific addresses for specific purposes. In our case, any of the 4 main banks and several of the smaller ones can be mapped to the main 2D background engine. A, B, C and D banks are referred to collectivly as main because they are 128KB and flexible in usage.

@ VRAM_A_MAIN_BG
Main engine background slot 0.
Definition: video.h:140
static void vramSetBankA(VRAM_A_TYPE a)
Set VRAM bank A to the indicated mapping.
Definition: video.h:386

The above would map the 128KB of VRAM_A to 0x6000000 for use as main background graphics and maps. You can offset the mapping as well and the available offsets are defined in the VRAM_A_TYPE enumeration.

Video Ram Bank sizes

Enumeration Type Documentation

◆ VideoMode

enum VideoMode

The allowed video modes of the 2D processors.

Main 2D engine
______________________________
|Mode | BG0 | BG1 | BG2 |BG3 |   T = Text
|  0  |  T  |  T  |  T  |  T |   R = Rotation
|  1  |  T  |  T  |  T  |  R |   E = Extended Rotation
|  2  |  T  |  T  |  R  |  R |   L = Large Bitmap background
|  3  |  T  |  T  |  T  |  E |
|  4  |  T  |  T  |  R  |  E |
|  5  |  T  |  T  |  E  |  E |
|  6  |     |  L  |     |    |
------------------------------

Sub 2D engine
______________________________
|Mode | BG0 | BG1 | BG2 |BG3 |
|  0  |  T  |  T  |  T  |  T |
|  1  |  T  |  T  |  T  |  R |
|  2  |  T  |  T  |  R  |  R |
|  3  |  T  |  T  |  T  |  E |
|  4  |  T  |  T  |  R  |  E |
|  5  |  T  |  T  |  E  |  E |
------------------------------
Enumerator
MODE_0_2D 

Video mode 0.

MODE_1_2D 

Video mode 1.

MODE_2_2D 

Video mode 2.

MODE_3_2D 

Video mode 3.

MODE_4_2D 

Video mode 4.

MODE_5_2D 

Video mode 5.

MODE_6_2D 

Video mode 6 (main engine)

MODE_0_3D 

Video mode 0 with 3D (main engine)

MODE_1_3D 

Video mode 1 with 3D (main engine)

MODE_2_3D 

Video mode 2 with 3D (main engine)

MODE_3_3D 

Video mode 3 with 3D (main engine)

MODE_4_3D 

Video mode 4 with 3D (main engine)

MODE_5_3D 

Video mode 5 with 3D (main engine)

MODE_6_3D 

Video mode 6 with 3D (main engine)

MODE_FIFO 

Video display from main memory.

MODE_FB0 

Video display directly from VRAM_A in LCD mode.

MODE_FB1 

Video display directly from VRAM_B in LCD mode.

MODE_FB2 

Video display directly from VRAM_C in LCD mode.

MODE_FB3 

Video display directly from VRAM_D in LCD mode.

◆ VRAM_A_TYPE

Allowed VRAM bank A modes.

Enumerator
VRAM_A_LCD 

LCD.

VRAM_A_MAIN_BG 

Main engine background slot 0.

VRAM_A_MAIN_BG_0x06000000 

Main engine background slot 0.

VRAM_A_MAIN_BG_0x06020000 

Main engine background slot 1.

VRAM_A_MAIN_BG_0x06040000 

Main engine background slot 2.

VRAM_A_MAIN_BG_0x06060000 

Main engine background slot 3.

VRAM_A_MAIN_SPRITE 

Main engine sprites slot 0.

VRAM_A_MAIN_SPRITE_0x06400000 

Main engine sprites slot 0.

VRAM_A_MAIN_SPRITE_0x06420000 

Main engine sprites slot 1.

VRAM_A_TEXTURE 

3D texture slot 0

VRAM_A_TEXTURE_SLOT0 

3D texture slot 0

VRAM_A_TEXTURE_SLOT1 

3D texture slot 1

VRAM_A_TEXTURE_SLOT2 

3D texture slot 2

VRAM_A_TEXTURE_SLOT3 

3D texture slot 3

◆ VRAM_B_TYPE

Allowed VRAM bank B modes.

Enumerator
VRAM_B_LCD 

LCD.

VRAM_B_MAIN_BG 

Main engine background slot 1.

VRAM_B_MAIN_BG_0x06000000 

Main engine background slot 0.

VRAM_B_MAIN_BG_0x06020000 

Main engine background slot 1.

VRAM_B_MAIN_BG_0x06040000 

Main engine background slot 2.

VRAM_B_MAIN_BG_0x06060000 

Main engine background slot 3.

VRAM_B_MAIN_SPRITE 

Main engine sprites slot 0.

VRAM_B_MAIN_SPRITE_0x06400000 

Main engine sprites slot 0.

VRAM_B_MAIN_SPRITE_0x06420000 

Main engine sprites slot 1.

VRAM_B_TEXTURE 

3D texture slot 1

VRAM_B_TEXTURE_SLOT0 

3D texture slot 0

VRAM_B_TEXTURE_SLOT1 

3D texture slot 1

VRAM_B_TEXTURE_SLOT2 

3D texture slot 2

VRAM_B_TEXTURE_SLOT3 

3D texture slot 3

◆ VRAM_C_TYPE

Allowed VRAM bank C modes.

Enumerator
VRAM_C_LCD 

LCD.

VRAM_C_MAIN_BG 

Main engine background slot 2.

VRAM_C_MAIN_BG_0x06000000 

Main engine background slot 0.

VRAM_C_MAIN_BG_0x06020000 

Main engine background slot 1.

VRAM_C_MAIN_BG_0x06040000 

Main engine background slot 2.

VRAM_C_MAIN_BG_0x06060000 

Main engine background slot 3.

VRAM_C_ARM7 

ARM7 Work RAM slot 0.

VRAM_C_ARM7_0x06000000 

ARM7 Work RAM slot 0.

VRAM_C_ARM7_0x06020000 

ARM7 Work RAM slot 1.

VRAM_C_SUB_BG 

Sub engine background slot 0.

VRAM_C_SUB_BG_0x06200000 

Sub engine background slot 0.

VRAM_C_TEXTURE 

3D texture slot 2

VRAM_C_TEXTURE_SLOT0 

3D texture slot 0

VRAM_C_TEXTURE_SLOT1 

3D texture slot 1

VRAM_C_TEXTURE_SLOT2 

3D texture slot 2

VRAM_C_TEXTURE_SLOT3 

3D texture slot 3

◆ VRAM_D_TYPE

Allowed VRAM bank D modes.

Enumerator
VRAM_D_LCD 

LCD.

VRAM_D_MAIN_BG 

Main engine background slot 3.

VRAM_D_MAIN_BG_0x06000000 

Main engine background slot 0.

VRAM_D_MAIN_BG_0x06020000 

Main engine background slot 1.

VRAM_D_MAIN_BG_0x06040000 

Main engine background slot 2.

VRAM_D_MAIN_BG_0x06060000 

Main engine background slot 3.

VRAM_D_ARM7 

ARM7 Work RAM slot 1.

VRAM_D_ARM7_0x06000000 

ARM7 Work RAM slot 0.

VRAM_D_ARM7_0x06020000 

ARM7 Work RAM slot 1.

VRAM_D_SUB_SPRITE 

Sub engine sprites slot 0.

VRAM_D_SUB_SPRITE_0x06600000 

Sub engine sprites slot 0.

VRAM_D_TEXTURE 

3D texture slot 3

VRAM_D_TEXTURE_SLOT0 

3D texture slot 0

VRAM_D_TEXTURE_SLOT1 

3D texture slot 1

VRAM_D_TEXTURE_SLOT2 

3D texture slot 2

VRAM_D_TEXTURE_SLOT3 

3D texture slot 3

◆ VRAM_E_TYPE

Allowed VRAM bank E modes.

Enumerator
VRAM_E_LCD 

LCD.

VRAM_E_MAIN_BG 

Main engine background first half of slot 0.

VRAM_E_MAIN_BG_0x06000000 

Main engine background first half of slot 0.

VRAM_E_MAIN_SPRITE 

Main engine sprites first half of slot 0.

VRAM_E_MAIN_SPRITE_0x06400000 

Main engine sprites first half of slot 0.

VRAM_E_TEX_PALETTE 

3D texture palette slot 0-3

VRAM_E_BG_EXT_PALETTE 

Main engine background extended palette.

◆ VRAM_F_TYPE

Allowed VRAM bank F modes.

Enumerator
VRAM_F_LCD 

LCD.

VRAM_F_MAIN_BG 

Main engine background first part of slot 0.

VRAM_F_MAIN_BG_0x06000000 

Main engine background first part of slot 0.

VRAM_F_MAIN_BG_0x06004000 

Main engine background second part of slot 0.

VRAM_F_MAIN_BG_0x06010000 

Main engine background second half of slot 0.

VRAM_F_MAIN_BG_0x06014000 

Main engine background second part of second half of slot 0.

VRAM_F_MAIN_SPRITE 

Main engine sprites first part of slot 0.

VRAM_F_MAIN_SPRITE_0x06400000 

Main engine sprites first part of slot 0.

VRAM_F_MAIN_SPRITE_0x06404000 

Main engine sprites second part of slot 0.

VRAM_F_MAIN_SPRITE_0x06410000 

Main engine sprites second half of slot 0.

VRAM_F_MAIN_SPRITE_0x06414000 

Main engine sprites second part of second half of slot 0.

VRAM_F_TEX_PALETTE 

3D texture palette slot 0

VRAM_F_TEX_PALETTE_SLOT0 

3D texture palette slot 0

VRAM_F_TEX_PALETTE_SLOT1 

3D texture palette slot 1

VRAM_F_TEX_PALETTE_SLOT4 

3D texture palette slot 4

VRAM_F_TEX_PALETTE_SLOT5 

3D texture palette slot 5

VRAM_F_BG_EXT_PALETTE 

Main engine background extended palette slot 0 and 1.

VRAM_F_BG_EXT_PALETTE_SLOT01 

Main engine background extended palette slot 0 and 1.

VRAM_F_BG_EXT_PALETTE_SLOT23 

Main engine background extended palette slot 2 and 3.

VRAM_F_SPRITE_EXT_PALETTE 

Main engine sprites extended palette.

◆ VRAM_G_TYPE

Allowed VRAM bank G modes.

Enumerator
VRAM_G_LCD 

LCD.

VRAM_G_MAIN_BG 

Main engine background first part of slot 0.

VRAM_G_MAIN_BG_0x06000000 

Main engine background first part of slot 0.

VRAM_G_MAIN_BG_0x06004000 

Main engine background second part of slot 0.

VRAM_G_MAIN_BG_0x06010000 

Main engine background second half of slot 0.

VRAM_G_MAIN_BG_0x06014000 

Main engine background second part of second half of slot 0.

VRAM_G_MAIN_SPRITE 

Main engine sprites first part of slot 0.

VRAM_G_MAIN_SPRITE_0x06400000 

Main engine sprites first part of slot 0.

VRAM_G_MAIN_SPRITE_0x06404000 

Main engine sprites second part of slot 0.

VRAM_G_MAIN_SPRITE_0x06410000 

Main engine sprites second half of slot 0.

VRAM_G_MAIN_SPRITE_0x06414000 

Main engine sprites second part of second half of slot 0.

VRAM_G_TEX_PALETTE 

3D texture palette slot 0

VRAM_G_TEX_PALETTE_SLOT0 

3D texture palette slot 0

VRAM_G_TEX_PALETTE_SLOT1 

3D texture palette slot 1

VRAM_G_TEX_PALETTE_SLOT4 

3D texture palette slot 4

VRAM_G_TEX_PALETTE_SLOT5 

3D texture palette slot 5

VRAM_G_BG_EXT_PALETTE 

Main engine background extended palette slot 0 and 1.

VRAM_G_BG_EXT_PALETTE_SLOT01 

Main engine background extended palette slot 0 and 1.

VRAM_G_BG_EXT_PALETTE_SLOT23 

Main engine background extended palette slot 2 and 3.

VRAM_G_SPRITE_EXT_PALETTE 

Main engine sprites extended palette.

◆ VRAM_H_TYPE

Allowed VRAM bank H modes.

Enumerator
VRAM_H_LCD 

LCD.

VRAM_H_SUB_BG 

Sub engine background first 2 parts of slot 0.

VRAM_H_SUB_BG_0x06200000 

Sub engine background first 2 parts of slot 0.

VRAM_H_SUB_BG_EXT_PALETTE 

Sub engine background extended palette.

◆ VRAM_I_TYPE

Allowed VRAM bank I modes.

Enumerator
VRAM_I_LCD 

LCD.

VRAM_I_SUB_BG_0x06208000 

Sub engine background thirth part of slot 0.

VRAM_I_SUB_SPRITE 

Sub engine sprites.

VRAM_I_SUB_SPRITE_0x06600000 

Sub engine sprites.

VRAM_I_SUB_SPRITE_EXT_PALETTE 

Sub engine sprites extended palette.

Function Documentation

◆ setBackdropColor()

static void setBackdropColor ( const u16  color)
inlinestatic

Sets the backdrop color of the main engine.

The backdrop color is displayed when all pixels at a given location are transparent (no sprite or background is visible there).

Parameters
colorThe color to display.

◆ setBackdropColorSub()

static void setBackdropColorSub ( const u16  color)
inlinestatic

Sets the backdrop color of the sub engine.

The backdrop color is displayed when all pixels at a given location are transparent (no sprite or background is visible there).

Parameters
colorThe color to display.

◆ setBrightness()

void setBrightness ( int  screen,
int  level 
)

Sets the screens brightness.

Parameters
screen1 = main screen, 2 = subscreen, 3 = both
level-16 = black, 0 = full brightness, 16 = white

◆ video3DEnabled()

static bool video3DEnabled ( void  )
inlinestatic

Determine if 3D is enabled.

Returns
Returns true if 3D is enabled.

◆ videoBgDisable()

static void videoBgDisable ( int  number)
inlinestatic

Disables the specified background on the main engine.

Parameters
numberThe background number (0 - 3).

◆ videoBgDisableSub()

static void videoBgDisableSub ( int  number)
inlinestatic

Disables the specified background on the sub engine.

Parameters
numberThe background number (0 - 3).

◆ videoBgEnable()

static void videoBgEnable ( int  number)
inlinestatic

Enables the specified background on the main engine.

Parameters
numberThe background number (0 - 3).

◆ videoBgEnableSub()

static void videoBgEnableSub ( int  number)
inlinestatic

Enables the specified background on the sub engine.

Parameters
numberThe background number (0 - 3).

◆ videoGetMode()

static int videoGetMode ( void  )
inlinestatic

Gets the main 2D engine video mode.

Returns
The video mode.

◆ videoGetModeSub()

static int videoGetModeSub ( void  )
inlinestatic

Gets the sub 2D engine video mode.

Returns
The video mode.

◆ videoSetMode()

static void videoSetMode ( u32  mode)
inlinestatic

Sets the main 2D engine video mode.

Parameters
modeThe video mode to set.

◆ videoSetModeSub()

static void videoSetModeSub ( u32  mode)
inlinestatic

Sets the sub 2D engine video mode.

Parameters
modeThe video mode to set.

◆ vramDefault()

u32 vramDefault ( void  )

Set VRAM banks to basic default.

Returns
The previous settings.

◆ vramRestoreBanks_EFG()

static void vramRestoreBanks_EFG ( u32  vramTemp)
inlinestatic

Restore the modes of VRAM banks E, F, and G.

Restores the E, F, G bank modes to the value encoded in vramTemp (returned from vramSetBanks_EFG).

Parameters
vramTempValue to restore the modes.

◆ vramRestorePrimaryBanks()

static void vramRestorePrimaryBanks ( u32  vramTemp)
inlinestatic

Restore the main 4 VRAM bank modes.

Restores the main 4 banks to the value encoded in vramTemp (returned from vramSetMainBanks).

Parameters
vramTempValue to restore the modes.

◆ vramSetBankA()

static void vramSetBankA ( VRAM_A_TYPE  a)
inlinestatic

Set VRAM bank A to the indicated mapping.

Parameters
aThe mapping of the bank.

◆ vramSetBankB()

static void vramSetBankB ( VRAM_B_TYPE  b)
inlinestatic

Set VRAM bank B to the indicated mapping.

Parameters
bThe mapping of the bank.

◆ vramSetBankC()

static void vramSetBankC ( VRAM_C_TYPE  c)
inlinestatic

Set VRAM bank C to the indicated mapping.

Parameters
cThe mapping of the bank.

◆ vramSetBankD()

static void vramSetBankD ( VRAM_D_TYPE  d)
inlinestatic

Set VRAM bank D to the indicated mapping.

Parameters
dThe mapping of the bank.

◆ vramSetBankE()

static void vramSetBankE ( VRAM_E_TYPE  e)
inlinestatic

Set VRAM bank E to the indicated mapping.

Parameters
eThe mapping of the bank.

◆ vramSetBankF()

static void vramSetBankF ( VRAM_F_TYPE  f)
inlinestatic

Set VRAM bank F to the indicated mapping.

Parameters
fThe mapping of the bank.

◆ vramSetBankG()

static void vramSetBankG ( VRAM_G_TYPE  g)
inlinestatic

Set VRAM bank G to the indicated mapping.

Parameters
gThe mapping of the bank.

◆ vramSetBankH()

static void vramSetBankH ( VRAM_H_TYPE  h)
inlinestatic

Set VRAM bank H to the indicated mapping.

Parameters
hThe mapping of the bank.

◆ vramSetBankI()

static void vramSetBankI ( VRAM_I_TYPE  i)
inlinestatic

Set VRAM bank I to the indicated mapping.

Parameters
iThe mapping of the bank.

◆ vramSetBanks_EFG()

u32 vramSetBanks_EFG ( VRAM_E_TYPE  e,
VRAM_F_TYPE  f,
VRAM_G_TYPE  g 
)

Set the mode of VRAM banks E, F and G.

Parameters
eMapping mode of VRAM_E
fMapping mode of VRAM_F
gMapping mode of VRAM_G
Returns
The previous modes.

◆ vramSetPrimaryBanks()

u32 vramSetPrimaryBanks ( VRAM_A_TYPE  a,
VRAM_B_TYPE  b,
VRAM_C_TYPE  c,
VRAM_D_TYPE  d 
)

Set the mode of the main 4 VRAM banks.

Parameters
aMapping mode of VRAM_A
bMapping mode of VRAM_B
cMapping mode of VRAM_C
dMapping mode of VRAM_D
Returns
The previous modes.