Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Platform] [PC-98] Hardware palette setters
Optimally, these are called *at most* once per frame. No need to micro-optimize here. Part of P0232, funded by [Anonymous].
- Loading branch information
Showing
4 changed files
with
31 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "platform.h" | ||
#include "pc98.h" | ||
#include "x86real.h" | ||
#include "platform/x86real/pc98/palette.hpp" | ||
|
||
void palette_show_single(uint4_t col, const RGB4& c) | ||
{ | ||
outportb(0xA8, col); | ||
outportb(0xAA, c.c.g); | ||
outportb(0xAC, c.c.r); | ||
outportb(0xAE, c.c.b); | ||
} | ||
|
||
void palette_show(const Palette4& pal) | ||
{ | ||
const RGB4* color = pal.colors; | ||
for(int i = 0; i < COLOR_COUNT; i++) { | ||
palette_show_single(i, *(color++)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// 16-color VRAM palette | ||
// --------------------- | ||
|
||
// Sets the given hardware [col] to the given RGB value. | ||
void palette_show_single(uint4_t col, const RGB4& c); | ||
|
||
// Calls palette_show_single() for all colors in [pal]. | ||
void palette_show(const Palette4& pal); |