Best way to do Nemesis-like scroll in screen 2

Page 2/2
1 |

By theNestruo

Champion (267)

theNestruo's picture

21-01-2021, 12:35

Uninteresting wrote:

So NAMTBL is in RAM, and the same amount of data is moved from RAM to VRAM every frame in both cases? (I'm verifying because I intend to try doing something horizontally scrolling maybe next year.)

Yes, the entire NAMTBL.

Uninteresting wrote:

(When I was young, I tried to create in MSX-BASIC a snake game where the head was at array's first index and moving the snake meant moving all the body piece coordinates one step down in the array and assigning a new coordinate for the head (basically, the equivalent of that ldir operation). Obviously, I was dismayed when the snake slowed down before getting to any reasonable length...)

Snake is another good example of circular buffers: if you store i_head (e.g.: 8) and i_tail (e.g.: 0) you don't need to move the elements inside the array, but just advance by increasing i_head and i_tail, and storing the new position in positions[i_head]. The array doesn't need to be infinite; it can be 128 o 256 bytes long and adjust i_head to be always in range after increasing. I used that to code a snake-clone game in TI-BASIC in a TI-83 calculator Smile

By Metalion

Paragon (1312)

Metalion's picture

21-01-2021, 13:28

wimpie3 wrote:

So to get things straight: there is no way to copy from vram to vram, right, like you could do on screen 5? You always have to redraw the entire screen by copying the nametable from ram to vram?
(edit: basically the same question as above I see)

No, it's not possible.
The VDP commands you are referring to are only available on MSX2, and only in screen 5-8.

You could, of course, use the CPU to read from VRAM and write to another VRAM address. But it's faster and more efficient to manipulate the data in RAM and then rewrite the name table.

Page 2/2
1 |