--- nono/vm/videoctlr.cpp 2026/04/29 17:04:50 1.1.1.4 +++ nono/vm/videoctlr.cpp 2026/04/29 17:05:10 1.1.1.6 @@ -4,8 +4,9 @@ // Licensed under nono-license.txt // -#include "videoctlr.h" -#include "mpu.h" +// +// ビデオコントローラ +// // e82000..e823ff パレット // e82400..e824ff R0(e82400.w) のミラー @@ -14,22 +15,29 @@ // e82700..e82fff $00 が読めるようだ // 以上の 4KB をミラー。 -std::unique_ptr gVideoCtlr; +#include "videoctlr.h" +#include "mpu.h" +// グローバル参照用 +VideoCtlrDevice *gVideoCtlr; + +// コンストラクタ VideoCtlrDevice::VideoCtlrDevice() + : inherited("VideoCtlr") { - logname = "videoctlr"; - devname = "VideoCtlr"; devaddr = baseaddr; devlen = 0x2000; } +// デストラクタ VideoCtlrDevice::~VideoCtlrDevice() { + gVideoCtlr = NULL; } +// リセット void -VideoCtlrDevice::ResetHard() +VideoCtlrDevice::ResetHard(bool poweron) { // XXX not yet } @@ -145,13 +153,17 @@ VideoCtlrDevice::MakePalette() // テキストパレットは後半。 p = &palette.w[256]; - // パレット情報から xBGR32 形式の色データを作成 + // パレット情報から Color 形式の色データを作成 // X680x0 のパレットは %GGGGG'RRRRR'BBBBB'I で並んでいる。 for (int i = 0; i < 16; i++) { int I = (p[i] & 1) << 2; // 輝度ビット int R = (((p[i] >> 6) & 0x1f) << 3) + I; int G = (((p[i] >> 11)) << 3) + I; int B = (((p[i] >> 1) & 0x1f) << 3) + I; - cooked_palette[i] = R | (G << 8) | (B << 16); + cooked_palette[i].r = R; + cooked_palette[i].g = G; + cooked_palette[i].b = B; } + + // XXX たぶんこの辺でレンダラにパレット変更を通知するはず }