--- nono/vm/tvram.cpp 2026/04/29 17:04:32 1.1.1.2 +++ nono/vm/tvram.cpp 2026/04/29 17:04:36 1.1.1.3 @@ -1,13 +1,17 @@ // // nono -// Copyright (C) 2017 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt +// + // // TVRAM // -#include "renderer.h" #include "tvram.h" -#include "vicon.h" +#include "crtc.h" +#include "renderer.h" +#include "videoctlr.h" // // TVRAM はワード単位でホストバイトオーダ配置なので、 @@ -121,6 +125,20 @@ TVRAMDevice::Invalidate() } } +void +TVRAMDevice::SetScrollX(int x) +{ + tvram.xscroll = x; +} + +void +TVRAMDevice::SetScrollY(int y) +{ + tvram.yscroll = y; + // 全ラインを無効にする XXX とりあえずね + Invalidate(); +} + // CRTC R21 での同時アクセス設定を反映する // CRTC から呼ばれる void @@ -161,7 +179,7 @@ TVRAMDevice::Render(uint8 *imagebuf) dst0 = imagebuf; // パレット取得 - palette_w = gVicon->GetPalette(); + palette_w = gVideoCtlr->GetPalette(); // パレット前半 256 ワードはグラフィックパレット、 // テキストパレットは後半。 palette_w += 0x100; @@ -190,7 +208,7 @@ TVRAMDevice::Render(uint8 *imagebuf) plane1 = (uint16 *)&mem[0x20000]; plane2 = (uint16 *)&mem[0x40000]; plane3 = (uint16 *)&mem[0x60000]; - int sy = 0; + int sy = tvram.yscroll; for (int dy = 0; dy < 512; dst0 += 768 * Renderer::BPP, dy++, sy++) { sy &= 0x3ff;