V9938/V9958 Vertical scrolling

By kanageddaamen

Rookie (25)

kanageddaamen's picture

30-09-2017, 21:51

Hello all,

As I have previously mentioned on previous posts, I am working on a project using the V9958 as a VDP. Everything in the project will be coded in assembly (or possibly C if I can find a good compiler for the processor I will be using,) and using Graphics mode 3 (which is 4, I believe in MSX BASIC?)

One thing that I can't seem to wrap my head around is using the vertical scroll register. It seems that this will simply loop the current page when doing the scroll. How would one implement a smooth scroll between page data? Do you have to manually do moves from the CPU to write over lines in the pattern name table? I can't seem to find any guidance on how to implement something like this.

Also, when doing this, are there any concerns about sprite positioning that need to be taken into consideration?

Finally, and somewhat tangentially related, what are the purposes of multiple pages being loaded into vram, other than in a scrolling situation? Simply to have access to more individual patterns and sprites?

Login or register to post comments

By NYYRIKKI

Enlighted (5385)

NYYRIKKI's picture

30-09-2017, 22:29

kanageddaamen wrote:

One thing that I can't seem to wrap my head around is using the vertical scroll register. It seems that this will simply loop the current page when doing the scroll. How would one implement a smooth scroll between page data? Do you have to manually do moves from the CPU to write over lines in the pattern name table? I can't seem to find any guidance on how to implement something like this.

Yes... You will write the new line just like you write the initial tiles.

Quote:

Also, when doing this, are there any concerns about sprite positioning that need to be taken into consideration?

Yes there is... When you move the screen up/down the sprites move with the picture (this does not happen when you move screen to left/right with V9958 scroll) In this mode you also can't place sprite to line 216 that can be a bit of a disappointment if you scroll in one pixel steps.

Quote:

Finally, and somewhat tangentially related, what are the purposes of multiple pages being loaded into vram, other than in a scrolling situation? Simply to have access to more individual patterns and sprites?

Yes. You can have multiple pictures in VRAM... This can be useful ie. for doing double/triple buffering, but practically you don't ever need all of the addressable VRAM in these tile modes. (16KB is enough most of the time) The amount of VRAM becomes more important in bitmap modes.

By syn

Paragon (1920)

syn's picture

30-09-2017, 22:52

The screen is 256 pixels tall but displays only 212 or 192 so the remaining part you can use as invisible "buffer" to blit new patterns to using the HMMM command. Screen 5 has 4 pages but only 1 is displayed, so the others can be used for storing tiles.

https://www.dropbox.com/s/3pvqknckcj1wh9b/scroll.avi?dl=0 here is a small test where i blit it to the top visible row, so you can see the actual screen buildup (16x16 tiles), but if I do this in the not displayed area you wont see it.

There is some distortion, those are sprites, I had not moved the sprite tables yet in this video.

*edit*oops I now realize you wanted to do it in screen mode 4, but it should be the same principles.

By kanageddaamen

Rookie (25)

kanageddaamen's picture

30-09-2017, 23:30

NYYRIKKI wrote:

Yes there is... When you move the screen up/down the sprites move with the picture (this does not happen when you move screen to left/right with V9958 scroll) In this mode you also can't place sprite to line 216 that can be a bit of a disappointment if you scroll in one pixel steps.

I was afraid of that. I assume there is now way around this restriction. Is the only method then to recopy the whole pattern and reset the scroll after 8 pixels of scrolling? I don't see how not doing so would be possible as the area where sprites would not be visible would be quite large a fair amount of time

By NYYRIKKI

Enlighted (5385)

NYYRIKKI's picture

30-09-2017, 23:48

Resetting after 8 pixels is ok, but requires you to update all 768 bytes. Many games simply move the sprite one line up or down... So in case it should be put to line 216 they put it line 215 or 217 instead... You can see it if you look for it, but many times this goes unnoticed in a gaming environment as there is so much other things going on. (This anyway happens only once in 256 lines) Other thing that you can do is to have two 16*15 sprites instead of 16*16 sprite so that one has empty line on top and other has empty line on bottom. This way you still need to skip the line 216, but you can make it look like it would be there by swapping to different sprite.

By kanageddaamen

Rookie (25)

kanageddaamen's picture

30-09-2017, 23:59

Ah, I misundertood, I thought that it would not display sprites on line 216 or greater. That is not so bad then. Thanks for the help!

By NYYRIKKI

Enlighted (5385)

NYYRIKKI's picture

01-10-2017, 11:08

No, you can display sprites on all lines, it is just a limitation that you can't use 216 as a Y-coordinate. (Other ways the sprite and all following sprites will cease to exist)