Introduce internal and normal GPU functions

This commit is contained in:
2022-09-11 10:10:51 +02:00
parent 679899279d
commit a8f0bddc89
7 changed files with 73 additions and 12 deletions

17
include/PSX/GPU/GPU.h Normal file
View File

@@ -0,0 +1,17 @@
#ifndef __JABYENGINE_GPU_H__
#define __JABYENGINE_GPU_H__
#include "../System/IOPorts/GPU_IO.hpp"
namespace GPU {
namespace Display {
static void enable() {
Port::GP1.write(Port::Command::GP1::SetDisplayState(Port::DisplayState::On));
}
static void disable() {
Port::GP1.write(Port::Command::GP1::SetDisplayState(Port::DisplayState::Off));
}
}
}
#endif //!__JABYENGINE_GPU_H__

View File

@@ -16,6 +16,32 @@ namespace GPU {
return ((this->blue << 16) | (this->green << 8) | this->red);
}
};
template<typename T>
struct Position {
T x = 0;
T y = 0;
constexpr Position() = default;
constexpr Position(T x, T y) : x(x), y(y) {
}
};
template<typename T>
struct Size {
T width = 0;
T height = 0;
constexpr Size() = default;
constexpr Size(T w, T h) : width(w), height(h) {
}
};
typedef Position<int16_t> PositionI16;
typedef Position<uint16_t> PositionU16;
typedef Size<int16_t> SizeI16;
typedef Size<uint16_t> SizeU16;
}
#endif //!__JABYENGINE_GPU_TYPES_HPP__

View File

@@ -55,7 +55,7 @@ namespace GPU {
}
static constexpr GP0 WidthHeight(uint16_t w, uint16_t h) {
return {(h << 16) | h};
return {(h << 16) | w};
}
};