mirror of
https://github.com/buhman/nds.git
synced 2025-06-18 14:35:38 -04:00
palette
This commit is contained in:
parent
9e9764ef38
commit
4dd7a033ac
@ -1,4 +1,4 @@
|
||||
io_registers = 0x04000000;
|
||||
pram = 0x05000000;
|
||||
oam = 0x07000000;
|
||||
palette_ram = 0x05000000;
|
||||
bg_vram = 0x06000000;
|
||||
oam = 0x07000000;
|
||||
|
4
main.c
4
main.c
@ -1,6 +1,7 @@
|
||||
#include "io_registers.h"
|
||||
#include "bits.h"
|
||||
#include "bg.h"
|
||||
#include "palette.h"
|
||||
|
||||
#include "res/player.h"
|
||||
#include "res/player.pal.h"
|
||||
@ -41,10 +42,9 @@ void main()
|
||||
|
||||
// palette ram
|
||||
for (int i = 0; i < 15; i++) {
|
||||
((volatile uint16_t *)(0x05000000))[i] = rgb555(&pal[i * 3]);
|
||||
palette_ram.a.bg.palette[0].color[i] = rgb555(&pal[i * 3]);
|
||||
}
|
||||
|
||||
|
||||
const uint8_t * data = (const uint8_t *)&_binary_res_player_data_start;
|
||||
|
||||
|
||||
|
30
palette.h
Normal file
30
palette.h
Normal file
@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define static_assert _Static_assert
|
||||
|
||||
struct color16 {
|
||||
uint16_t color[16];
|
||||
};
|
||||
static_assert((sizeof (struct color16)) == 0x20);
|
||||
|
||||
union palette {
|
||||
struct color16 palette[16];
|
||||
uint16_t color[256];
|
||||
};
|
||||
static_assert((sizeof (union palette)) == 0x200);
|
||||
|
||||
struct palette_bg_obj {
|
||||
union palette bg;
|
||||
union palette obj;
|
||||
};
|
||||
static_assert((sizeof (struct palette_bg_obj)) == 0x400);
|
||||
|
||||
struct palette_a_b {
|
||||
struct palette_bg_obj a;
|
||||
struct palette_bg_obj b;
|
||||
};
|
||||
static_assert((sizeof (struct palette_a_b)) == 0x800);
|
||||
|
||||
extern struct palette_a_b palette_ram __asm("palette_ram");
|
Loading…
Reference in New Issue
Block a user