[nostalgia/core/gba] Add sprite support
This commit is contained in:
@@ -9,10 +9,35 @@
|
||||
// NOTE: this file is compiled as ARM and not THUMB, so don't but too much in
|
||||
// here
|
||||
|
||||
#include <nostalgia/core/config.hpp>
|
||||
|
||||
#include "addresses.hpp"
|
||||
#include "gfx.hpp"
|
||||
#include "irq.hpp"
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
volatile uint16_t g_spriteUpdates = 0;
|
||||
GbaSpriteAttrUpdate g_spriteBuffer[config::GbaSpriteBufferLen];
|
||||
|
||||
}
|
||||
|
||||
using namespace nostalgia::core;
|
||||
|
||||
extern "C" {
|
||||
|
||||
void nostalgia_core_isr_vblank() {
|
||||
// copy g_spriteUpdates to allow it to use a register instead of reading
|
||||
// from memory every iteration of the loop, needed because g_spriteUpdates
|
||||
// is volatile
|
||||
const auto updates = g_spriteUpdates;
|
||||
for (uint16_t i = 0; i < updates; ++i) {
|
||||
auto &oa = g_spriteBuffer[i];
|
||||
MEM_OAM[oa.idx] = *reinterpret_cast<uint64_t*>(&oa);
|
||||
}
|
||||
g_spriteUpdates = 0;
|
||||
}
|
||||
|
||||
void nostalgia_core_isr_timer0() {
|
||||
}
|
||||
|
||||
@@ -25,7 +50,4 @@ void nostalgia_core_isr_timer2() {
|
||||
void nostalgia_core_isr_timer3() {
|
||||
}
|
||||
|
||||
void nostalgia_core_isr_vblank() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user