OpenMSX - V9990PixelRenderer::updateScrollAYLow()

By Metalion

Paragon (1587)

Metalion's picture

10-05-2022, 13:25

Hi everyone,

I'm looking for information on "on the fly" scroll registers modifcation on v9990.
I have found this in the OpenMSX source:

Quote:

Changing high byte of vertical scroll registers only takes effect at the start of the next page. These members hold the current value of the scroll value. note: writing the low byte has effect immediatly (or at the next line), but the effect is not the same as on V99x8, see V9990PixelRenderer::updateScrollAYLow() for details

But looking at V9990PixelRenderer::updateScrollAYLow() code, I do not understand its meaning, nor do I see any additional information. What is the ' lastY ' value?

void V9990PixelRenderer::updateScrollAYLow(EmuTime::param time)
{
	if (displayEnabled) {
		sync(time);
		// happens in all display modes (verified)
		// TODO high byte still seems to be wrong .. need to investigate
		verticalOffsetA = lastY;
	}
}

Can someone shed some light on this ?

To give some context : I'm trying to make a scroll-split on the v9990. After setting an HBLANK interruption at Y=188, I change the value of the layer_B Y scroll register (only 0-255, so writing only on R#21), and restore it at VBLANK. It does not work, and I don't understand why. Furthermore, I tested writing 0 at HBLANK, and writing again 0 at VBLANK (basically not changing the value at all), and all I get is that the part below Y=188 disappears. Which does not make sense at all ... I really don't understand what's happening.

Login or register to post comments

By Metalion

Paragon (1587)

Metalion's picture

10-05-2022, 14:56

After multiple tests, I found out how it worked:
Y_scroll_register_value = hblank_line + 1 - (screen_position - real_position)
The '+1' is needed to because the register value change actually happens on the next line.

So for example, if you have an HBLANK interrupt at line 186, and you want the screen area below that line to be scrolled down 8 pixel, your Y scroll register value needs to be 186 + 1 - (186+8 - 186) = 179

I'll test tonight on real hardware.

By Metalion

Paragon (1587)

Metalion's picture

10-05-2022, 16:51

Metalion wrote:

After multiple tests, I found out how it worked: ...

Not so easy, after all ... I have found out it does not work like that oO
I continue my tests.

By ToriHino

Paladin (803)

ToriHino's picture

10-05-2022, 17:05

Interesting indeed, also curious about the behavior on real hardware.

By wouter_

Champion (491)

wouter_'s picture

10-05-2022, 17:43

Hi,
First of all openMSX v9990-emulation is much less mature than the V99x8 emulation. Always verify on real V9990 hardware (and then please report any discrepancies).

I did some digging in the openMSX code, and apparently the implementation is based on the information provided by 'GhostwriterP' in this MRC forum topic from 2008.

By Metalion

Paragon (1587)

Metalion's picture

10-05-2022, 19:28

As I should have guessed from the OpenMSX code, it's actually simpler than that, but also counterintuitive. When you change the scroll Y register value after an HBLANK interruption, the v9990 considers that the starting line of the screen (y=0) is located at that HBLANK line.

By Metalion

Paragon (1587)

Metalion's picture

11-05-2022, 20:10

Metalion wrote:

I'll test tonight on real hardware.

I just tested it on a real V9990, and I confirm that the scroll split works like it should.

By GhostwriterP

Paladin (680)

GhostwriterP's picture

12-05-2022, 17:43

Scrolling little bits up or down with vertical scroll will work fine AFAIK. Only in case of full vertical wrap around or crossing 256 line border you may get issues, this because the most significant scroll bit(s) (bit 8 and higher) is not looked at by the VDP during display period... at least that is how I remembered it.