Port GPU IO
This commit is contained in:
@@ -14,10 +14,10 @@ namespace JabyEngine {
|
||||
static constexpr auto Height = PublicDisplay::Height;
|
||||
|
||||
#ifdef JABYENGINE_PAL
|
||||
static constexpr auto DisplayMode = GPU_IO::DisplayMode_t::PAL();
|
||||
static constexpr auto DisplayMode = GPU_IO::DisplayMode::PAL();
|
||||
static constexpr uint16_t ScanlinesV = 288;
|
||||
#else
|
||||
static constexpr auto DisplayMode = GPU_IO::DisplayMode_t::NTSC();
|
||||
static constexpr auto DisplayMode = GPU_IO::DisplayMode::NTSC();
|
||||
static constexpr uint16_t ScanlinesV = 240;
|
||||
#endif //JABYENGINE_PAL
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace JabyEngine {
|
||||
void wait_vsync(uint8_t syncs);
|
||||
|
||||
static void wait_ready_for_CMD() {
|
||||
while(!GPU_IO::GPUSTAT.is_set(GPU_IO::GPUSTAT_t::GP0ReadyForCMD));
|
||||
while(!GPU_IO::GPUSTAT.read().is_set2(GPU_IO::GPUSTAT::GP0ReadyForCMD));
|
||||
}
|
||||
|
||||
static void set_draw_area(const PositionU16& pos) {
|
||||
@@ -35,33 +35,33 @@ namespace JabyEngine {
|
||||
const auto bottom_right = GPU_IO::Command::DrawAreaBottomRight(pos.move((Display::Width - 1), (Display::Height - 1)));
|
||||
|
||||
wait_ready_for_CMD();
|
||||
GPU_IO::GP0 = top_left;
|
||||
GPU_IO::GP0.write(top_left);
|
||||
wait_ready_for_CMD();
|
||||
GPU_IO::GP0 = bottom_right;
|
||||
GPU_IO::GP0.write(bottom_right);
|
||||
}
|
||||
|
||||
static void copy_vram_to_vram(const AreaU16& dst, const PositionU16& src) {
|
||||
wait_ready_for_CMD();
|
||||
GPU_IO::GP0 = GPU_IO::Command::VRAM2VRAM_Blitting();
|
||||
GPU_IO::GP0 = GPU_IO::Command::TopLeftPosition(src);
|
||||
GPU_IO::GP0 = GPU_IO::Command::TopLeftPosition(dst.position);
|
||||
GPU_IO::GP0 = GPU_IO::Command::WidthHeight(dst.size);
|
||||
GPU_IO::GP0.write(GPU_IO::Command::VRAM2VRAM_Blitting());
|
||||
GPU_IO::GP0.write(GPU_IO::Command::TopLeftPosition(src));
|
||||
GPU_IO::GP0.write(GPU_IO::Command::TopLeftPosition(dst.position));
|
||||
GPU_IO::GP0.write(GPU_IO::Command::WidthHeight(dst.size));
|
||||
}
|
||||
|
||||
static void quick_fill_fast(const Color24& color, const AreaU16& area) {
|
||||
wait_ready_for_CMD();
|
||||
GPU_IO::GP0 = GPU_IO::Command::QuickFill(color);
|
||||
GPU_IO::GP0 = GPU_IO::Command::TopLeftPosition(area.position);
|
||||
GPU_IO::GP0 = GPU_IO::Command::WidthHeight(area.size);
|
||||
GPU_IO::GP0.write(GPU_IO::Command::QuickFill(color));
|
||||
GPU_IO::GP0.write(GPU_IO::Command::TopLeftPosition(area.position));
|
||||
GPU_IO::GP0.write(GPU_IO::Command::WidthHeight(area.size));
|
||||
}
|
||||
|
||||
static void set_draw_offset(const PositionI16& offset) {
|
||||
wait_ready_for_CMD();
|
||||
GPU_IO::GP0 = GPU_IO::Command::SetDrawOffset(offset);
|
||||
GPU_IO::GP0.write(GPU_IO::Command::SetDrawOffset(offset));
|
||||
}
|
||||
|
||||
static void reset_cmd_buffer() {
|
||||
GPU_IO::GP1 = GPU_IO::Command::ResetCMDBufer();
|
||||
GPU_IO::GP1.write(GPU_IO::Command::ResetCMDBufer());
|
||||
}
|
||||
|
||||
namespace DMA {
|
||||
@@ -75,7 +75,7 @@ namespace JabyEngine {
|
||||
|
||||
namespace Receive {
|
||||
static void prepare() {
|
||||
GPU_IO::GP1 = GPU_IO::Command::DMADirection(GPU_IO::DMADirection::CPU2GPU);
|
||||
GPU_IO::GP1.write(GPU_IO::Command::DMADirection(GPU_IO::DMADirection::CPU2GPU));
|
||||
reset_cmd_buffer();
|
||||
}
|
||||
|
||||
@@ -85,9 +85,9 @@ namespace JabyEngine {
|
||||
|
||||
static void set_dst(const PositionU16& position, const SizeU16& size) {
|
||||
wait_ready_for_CMD();
|
||||
GPU_IO::GP0 = GPU_IO::Command::CPU2VRAM_Blitting();
|
||||
GPU_IO::GP0 = GPU_IO::Command::TopLeftPosition(position);
|
||||
GPU_IO::GP0 = GPU_IO::Command::WidthHeight(size);
|
||||
GPU_IO::GP0.write(GPU_IO::Command::CPU2VRAM_Blitting());
|
||||
GPU_IO::GP0.write(GPU_IO::Command::TopLeftPosition(position));
|
||||
GPU_IO::GP0.write(GPU_IO::Command::WidthHeight(size));
|
||||
}
|
||||
|
||||
static void start(uint16_t blockCount, uint16_t wordsPerBlock = 0x10) {
|
||||
|
||||
Reference in New Issue
Block a user