Screen 4 VRAM Question

By CodeIndigo

Supporter (1)

CodeIndigo's picture

07-02-2019, 19:59

I'm new to 8-bit programming, but I have a decent amount of experience with frameworks like XNA and Monogame. From what I understand of the VRAM mapping for Screen 4, there are four pages of memory. If I only use two of those pages as actually intended, is it feasible to use the rest to store additional patterns for use later?

Login or register to post comments

By MsxKun

Paladin (919)

MsxKun's picture

07-02-2019, 22:06

Hi

Screen 4 doesn't use pages as in bitmap modes do, it's pattern based.
You can set your pattern table more or less freely. Same for color table, name table, sprites... then the rest of the VRAM, you can store whatever you want. And yes, that includes additional patterns for use later. You can change the pattern adress table to the direction you have stored another set of patterns and then, change let's say on the fly.

Unless for pages you mean something else or I missed something. The VDP is quite flexible and can be tricked in some ways. Here at MRC there was a talk about using VDP commands (used to transfer VRAM data in bitmap modes) also in SC4. So maybe pages as in MSX-Basic Set Page can be used after all but I think it's simpler to think about SC4 like in SC2 and think in terms of pattern/name/sprite tables that, with more VRAM available, can be set in different tables, so in fact you have more than 1 table of whatever you want...

Dunno if I explained myself well Smile2

By DarkSchneider

Paladin (862)

DarkSchneider's picture

14-02-2019, 10:02

On screen 4 what you have are 2 segments of 64KB. You can switch the active segment using the control registers, but I recommend you to use 64KB that is easier, and is not easy to fill it in SC4.

By zett

Hero (563)

zett's picture

14-02-2019, 11:13

to see wat you can do with sc4, look at f1 spirit. sc4 is a tile mode screen with 3x tile sets. so you can emulate a bitmapmode

By Grauw

Ascended (8395)

Grauw's picture

14-02-2019, 11:26

MsxKun wrote:

You can set your pattern table more or less freely. Same for color table, name table, sprites... then the rest of the VRAM, you can store whatever you want. And yes, that includes additional patterns for use later. You can change the pattern adress table to the direction you have stored another set of patterns and then, change let's say on the fly.

So to add to this, this means that you can basically use the entire 128K for name (256 bytes), pattern (2K) and colour tables (2K).

Since the screen is divided in either 3 (192 lines) or 4 (212 lines) parts with one name, pattern and colour table each, you need 12.75K (192 lines) or 17K (212 lines) per screen, you can fit 7-10 screens in memory. This is the normal mode.

However if you share one pattern and colour table for the entire screen you need 4.75K (192 lines) or 5K (212 lines) per screen, then you can fit 25-26 screens in memory.

And then additionally, if let’s say you have only one name table and just swap out the pattern and colour table, you could fit 31 pattern + colour tables in memory.

Note that there are some requirements regarding alignment of the tables, so in practice these numbers will turn out lower. However this should give you a general impression of how much will fit, and some trickery can be done on the table base addresses, or you could copy data around with the CPU if needed.