mirror of https://github.com/nmlgc/ReC98.git
[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].
This commit is contained in:
parent
f1108b5548
commit
d22c1e6db3
|
@ -56,7 +56,7 @@ th05:: $(TH05:\=bin\th05\)
|
|||
.obj.com:
|
||||
tlink /t /3 $**
|
||||
|
||||
bin\Pipeline\grzview.com: Pipeline\grzview.cpp th01\formats\grz.cpp bin\th01\f_imgd.obj
|
||||
bin\Pipeline\grzview.com: Pipeline\grzview.cpp th01\formats\grz.cpp bin\th01\f_imgd.obj platform\x86real\pc98\palette.cpp
|
||||
$(CC) $(CFLAGS) -Z -DGAME=1 -mt -lt -nbin\Pipeline\ @&&|
|
||||
$**
|
||||
| masters.lib
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "pc98.h"
|
||||
#include "planar.h"
|
||||
#include "master.hpp"
|
||||
#include "platform/x86real/pc98/palette.hpp"
|
||||
#include "th01/formats/grz.h"
|
||||
|
||||
void grcg_setcolor_rmw(int col)
|
||||
|
@ -17,16 +18,6 @@ void grcg_off_func(void)
|
|||
grcg_off();
|
||||
}
|
||||
|
||||
void z_palette_set_all_show(const Palette4& pal)
|
||||
{
|
||||
for(int i = 0; i < COLOR_COUNT; i++) {
|
||||
outportb(0xA8, i);
|
||||
outportb(0xAA, pal[i].c.g);
|
||||
outportb(0xAC, pal[i].c.r);
|
||||
outportb(0xAE, pal[i].c.b);
|
||||
}
|
||||
}
|
||||
|
||||
const Palette4 boss8_grz_pal = {
|
||||
0x0, 0x0, 0x0,
|
||||
0x5, 0x5, 0x5,
|
||||
|
@ -71,7 +62,7 @@ int main(int argc, const char **argv)
|
|||
}
|
||||
text_hide();
|
||||
graph_start();
|
||||
z_palette_set_all_show(boss8_grz_pal);
|
||||
palette_show(boss8_grz_pal);
|
||||
|
||||
grx_put(0);
|
||||
dos_getch();
|
||||
|
|
|
@ -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++));
|
||||
}
|
||||
}
|
|
@ -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);
|
Loading…
Reference in New Issue