diff --git a/arm9/main.c b/arm9/2d_engine.c similarity index 94% rename from arm9/main.c rename to arm9/2d_engine.c index 4a18f65..96428cb 100644 --- a/arm9/main.c +++ b/arm9/2d_engine.c @@ -5,10 +5,10 @@ #include "obj.h" #include "oam.h" -#include "../res/player.data.h" -#include "../res/player.data.pal.h" -#include "../res/bowser.data.h" -#include "../res/bowser.data.pal.h" +#include "../texture/player.data.h" +#include "../texture/player.data.pal.h" +#include "../texture/bowser.data.h" +#include "../texture/bowser.data.pal.h" static inline uint16_t rgb565(const uint8_t * buf) { @@ -390,13 +390,28 @@ struct sign_v cos_table[360] = { void main() { - // 2d graphics engine A BG - io_registers.a.VRAMCNT = (1 << 31) | (1 << 24); +#define REG_IME (*(volatile uint32_t *)0x04000208) + REG_IME = 0; - io_registers.a.WVRAMCNT = 0; + // 2d graphics engine A BG + io_registers.a.VRAMCNT = (1 << 31) | (1 << 24) + | 0x80 << 16 + | 0x80 << 8 + | 0x80 << 0; + + io_registers.a.WVRAMCNT = 0 + | 0x80 << 16 + | 0x80 << 8 + | 0x80 << 0; // 2d graphics engine B OBJ - io_registers.a.VRAM_HI_CNT = (1 << 15) | (0b10 << 8); + io_registers.a.VRAM_HI_CNT = (1 << 15) | (0b10 << 8) + | 0x80 << 0; + + io_registers.a.DISPCAPCNT = 0; + + io_registers.a.MASTER_BRIGHT = (0b01 << 14) | 0b11111; + io_registers.b.MASTER_BRIGHT = (0b01 << 14) | 0b11111; io_registers.a.POWCNT = 0 | POWCNT__lcd_output_destination__a_to_upper__b_to_lower @@ -411,8 +426,8 @@ void main() | DISPCNT__bg_character_base_offset(0) | DISPCNT__display_mode__graphics_display | DISPCNT__bg0__enable - //| DISPCNT__display_selection_for_bg0__2d_graphics - | DISPCNT__display_selection_for_bg0__3d_graphics + | DISPCNT__display_selection_for_bg0__2d_graphics + //| DISPCNT__display_selection_for_bg0__3d_graphics | DISPCNT__bg_mode__text0_text1_text2_text3 ; diff --git a/arm9/Makefile b/arm9/Makefile index be6e841..cb1f4ee 100644 --- a/arm9/Makefile +++ b/arm9/Makefile @@ -6,17 +6,17 @@ ALL = \ all: arm9.bin -OBJ = \ +2D_ENGINE_OBJ = \ start.o \ - main.o \ - ../res/player.data.o \ - ../res/player.data.pal.o \ - ../res/bowser.data.o \ - ../res/bowser.data.pal.o + 2d_engine.o \ + ../texture/player.data.o \ + ../texture/player.data.pal.o \ + ../texture/bowser.data.o \ + ../texture/bowser.data.pal.o include ../texture/texture.mk -arm9.elf: $(OBJ) +2d_engine.elf: $(2D_ENGINE_OBJ) triangle.elf: start.o examples/triangle.o diff --git a/texture/bowser.data b/texture/bowser.data new file mode 100644 index 0000000..b7d2526 Binary files /dev/null and b/texture/bowser.data differ diff --git a/texture/bowser.data.h b/texture/bowser.data.h new file mode 100644 index 0000000..1133820 --- /dev/null +++ b/texture/bowser.data.h @@ -0,0 +1,5 @@ +#pragma once +#include +extern uint32_t _binary_bowser_data_start __asm("_binary_bowser_data_start"); +extern uint32_t _binary_bowser_data_end __asm("_binary_bowser_data_end"); +extern uint32_t _binary_bowser_data_size __asm("_binary_bowser_data_size"); diff --git a/texture/bowser.data.pal b/texture/bowser.data.pal new file mode 100644 index 0000000..a8c6d94 Binary files /dev/null and b/texture/bowser.data.pal differ diff --git a/texture/bowser.data.pal.h b/texture/bowser.data.pal.h new file mode 100644 index 0000000..c134213 --- /dev/null +++ b/texture/bowser.data.pal.h @@ -0,0 +1,5 @@ +#pragma once +#include +extern uint32_t _binary_bowser_data_pal_start __asm("_binary_bowser_data_pal_start"); +extern uint32_t _binary_bowser_data_pal_end __asm("_binary_bowser_data_pal_end"); +extern uint32_t _binary_bowser_data_pal_size __asm("_binary_bowser_data_pal_size"); diff --git a/texture/player.data b/texture/player.data new file mode 100644 index 0000000..e180546 Binary files /dev/null and b/texture/player.data differ diff --git a/texture/player.data.h b/texture/player.data.h new file mode 100644 index 0000000..430fcaa --- /dev/null +++ b/texture/player.data.h @@ -0,0 +1,5 @@ +#pragma once +#include +extern uint32_t _binary_player_data_start __asm("_binary_player_data_start"); +extern uint32_t _binary_player_data_end __asm("_binary_player_data_end"); +extern uint32_t _binary_player_data_size __asm("_binary_player_data_size"); diff --git a/texture/player.data.pal b/texture/player.data.pal new file mode 100644 index 0000000..838f34a Binary files /dev/null and b/texture/player.data.pal differ diff --git a/texture/player.data.pal.h b/texture/player.data.pal.h new file mode 100644 index 0000000..873735e --- /dev/null +++ b/texture/player.data.pal.h @@ -0,0 +1,5 @@ +#pragma once +#include +extern uint32_t _binary_player_data_pal_start __asm("_binary_player_data_pal_start"); +extern uint32_t _binary_player_data_pal_end __asm("_binary_player_data_pal_end"); +extern uint32_t _binary_player_data_pal_size __asm("_binary_player_data_pal_size");