[nostalgia/core/gba] Cleanup

This commit is contained in:
Gary Talent 2020-07-18 17:00:49 -05:00
parent d9b0c2c42a
commit e2f1466e64
3 changed files with 23 additions and 22 deletions

View File

@ -27,24 +27,6 @@ constexpr uint16_t DispStat_irq_vblank = 1 << 3;
constexpr uint16_t DispStat_irq_hblank = 1 << 4;
constexpr uint16_t DispStat_irq_vcount = 1 << 5;
enum DispCtl {
DispCtl_Mode0 = 0,
DispCtl_Mode1 = 1,
DispCtl_Mode2 = 2,
DispCtl_Mode3 = 3,
DispCtl_Mode4 = 4,
DispCtl_Mode5 = 5,
DispCtl_SpriteMap1D = 1 << 6,
DispCtl_Bg0 = 1 << 8,
DispCtl_Bg1 = 1 << 9,
DispCtl_Bg2 = 1 << 10,
DispCtl_Bg3 = 1 << 11,
DispCtl_Obj = 1 << 12,
};
struct GbaPaletteTarget {
static constexpr auto TypeName = NostalgiaPalette::TypeName;
static constexpr auto Fields = NostalgiaPalette::Fields;
@ -153,9 +135,9 @@ ox::Error initConsole(Context *ctx) {
}
ox::Error loadBgTileSheet(Context *ctx,
int section,
ox::FileAddress tilesheetAddr,
ox::FileAddress paletteAddr) {
int section,
ox::FileAddress tilesheetAddr,
ox::FileAddress paletteAddr) {
auto [tsStat, tsStatErr] = ctx->rom->stat(tilesheetAddr);
oxReturnError(tsStatErr);
auto [ts, tserr] = ctx->rom->read(tilesheetAddr);

View File

@ -15,6 +15,24 @@
namespace nostalgia::core {
enum DispCtl {
DispCtl_Mode0 = 0,
DispCtl_Mode1 = 1,
DispCtl_Mode2 = 2,
DispCtl_Mode3 = 3,
DispCtl_Mode4 = 4,
DispCtl_Mode5 = 5,
DispCtl_SpriteMap1D = 1 << 6,
DispCtl_Bg0 = 1 << 8,
DispCtl_Bg1 = 1 << 9,
DispCtl_Bg2 = 1 << 10,
DispCtl_Bg3 = 1 << 11,
DispCtl_Obj = 1 << 12,
};
struct OX_ALIGN8 GbaSpriteAttrUpdate {
uint16_t attr0 = 0;
uint16_t attr1 = 0;

View File

@ -13,6 +13,7 @@
#include "addresses.hpp"
#include "bios.hpp"
#include "gfx.hpp"
namespace ox {
@ -22,7 +23,7 @@ void panic(const char*, int, const char *msg, ox::Error err) {
oxIgnoreError(initGfx(nullptr));
oxIgnoreError(initConsole(nullptr));
// enable only BG 0
REG_DISPCTL = 0x0100;
REG_DISPCTL = DispCtl_Bg0;
clearTileLayer(nullptr, 0);
ox::BString<23> serr = "Error code: ";
serr += err;