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) {
|
||||
|
@@ -26,7 +26,7 @@ namespace JabyEngine {
|
||||
|
||||
static void configurate_display() {
|
||||
// Ideal I hope that an offset of 0,0 will produce a well enough centered picture for every TV
|
||||
GPU_IO::GP1 = GPU_IO::Command::DisplayMode(internal::Display::DisplayMode);
|
||||
GPU_IO::GP1.write(GPU_IO::Command::DisplayMode(internal::Display::DisplayMode));
|
||||
GPU::Display::set_offset(0, 0);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace JabyEngine {
|
||||
}
|
||||
|
||||
void setup() {
|
||||
GPU_IO::GP1 = GPU_IO::Command::Reset();
|
||||
GPU_IO::GP1.write(GPU_IO::Command::Reset());
|
||||
configurate_display();
|
||||
internal::Display::exchange_buffer_and_display();
|
||||
|
||||
|
@@ -15,7 +15,7 @@ namespace JabyEngine {
|
||||
namespace Blubb {
|
||||
__new_declare_io_value(Test, uint32_t) {
|
||||
};
|
||||
__new_declare_io_port(Test, 0);
|
||||
__new_declare_io_port(, Test, 0);
|
||||
static void bla(New::IOPort<struct Test>& wuff) {
|
||||
asm("#planschi");
|
||||
const auto a = Test::from(Bit(1), Bit(2));
|
||||
|
@@ -45,7 +45,7 @@ namespace JabyEngine {
|
||||
|
||||
GPU::internal::set_draw_area({0, draw_area_y});
|
||||
PublicDisplay::current_id ^= 1;
|
||||
GPU_IO::GP1 = GPU_IO::Command::DisplayArea({0, static_cast<uint16_t>((PublicDisplay::Height*PublicDisplay::current_id))});
|
||||
GPU_IO::GP1.write(GPU_IO::Command::DisplayArea({0, static_cast<uint16_t>((PublicDisplay::Height*PublicDisplay::current_id))}));
|
||||
return draw_area_y;
|
||||
}
|
||||
|
||||
@@ -59,14 +59,14 @@ namespace JabyEngine {
|
||||
void render(const uint32_t* data, size_t words) {
|
||||
wait_ready_for_CMD();
|
||||
for(size_t n = 0; n < words; n++) {
|
||||
GPU_IO::GP0 = data[n];
|
||||
GPU_IO::GP0.write({data[n]});
|
||||
}
|
||||
}
|
||||
|
||||
void render_dma(const uint32_t* data) {
|
||||
wait_ready_for_CMD();
|
||||
// DPCR already enabled
|
||||
GPU_IO::GP1 = GPU_IO::Command::DMADirection(GPU_IO::DMADirection::CPU2GPU);
|
||||
GPU_IO::GP1.write(GPU_IO::Command::DMADirection(GPU_IO::DMADirection::CPU2GPU));
|
||||
DMA_IO::GPU.set_adr(reinterpret_cast<uintptr_t>(data));
|
||||
DMA_IO::GPU.block_ctrl.write(DMA_IO::BCR::SyncMode2::for_gpu_cmd());
|
||||
DMA_IO::GPU.channel_ctrl.write(DMA_IO::CHCHR::StartGPULinked());
|
||||
@@ -78,13 +78,13 @@ namespace JabyEngine {
|
||||
x += 78;
|
||||
y += 43;
|
||||
|
||||
GPU_IO::GP1 = GPU_IO::Command::HorizontalDisplayRange((x << 3), (x + Display::Width) << 3);
|
||||
GPU_IO::GP1 = GPU_IO::Command::VerticalDisplayRange(y, y + Display::Height);
|
||||
GPU_IO::GP1.write(GPU_IO::Command::HorizontalDisplayRange((x << 3), (x + Display::Width) << 3));
|
||||
GPU_IO::GP1.write(GPU_IO::Command::VerticalDisplayRange(y, y + Display::Height));
|
||||
}
|
||||
#else
|
||||
void Display :: set_offset(uint16_t x, uint16_t y) {
|
||||
GPU_IO::GP1 = GPU_IO::Command::HorizontalDisplayRange(x, (x + Display::Width*8));
|
||||
GPU_IO::GP1 = GPU_IO::Command::VerticalDisplayRange(y - (ScanlinesV/2), y + (ScanlinesV/2));
|
||||
GPU_IO::GP1.write(GPU_IO::Command::HorizontalDisplayRange(x, (x + Display::Width*8)));
|
||||
GPU_IO::GP1.write(GPU_IO::Command::VerticalDisplayRange(y - (ScanlinesV/2), y + (ScanlinesV/2)));
|
||||
}
|
||||
#endif //USE_NO$PSX
|
||||
|
||||
|
Reference in New Issue
Block a user