top of page
Search

[49] vmemprep(), Scrolling, Text, and Confusion

  • Writer: Conlan Walker
    Conlan Walker
  • Sep 16, 2022
  • 2 min read

There was quite a lot of work that went into a single function, and how it relates to the rest of the backend code. I also don't know how better to explain what this does other than that it prepares a bit of memory in RAM to be uploaded to VRAM after the main game loop finishes:

ree

The above routine is called a couple of times in C, shown below:

ree

Basically, you give it the source address in RAM that contains the bytes you want to write, and and destination in VRAM to want to write to. The last argument says how many bytes you want to write.


As I said earlier, the function doesn't write to VRAM immediately, rather it stores the data in a buffer. Another part of the program then writes that buffer to VRAM once it's time to do so.

This is the part that actually writes to VRAM, using that buffer:

ree

This function can be used for any write to VRAM, whether it be swapping palette colors, changing background tiles, or changing the palette those tiles use. Well, it should, anyway.

While it seems to work when swapping palette colors, things that I don't quite understand start happening when I change background tiles, or try scrolling the background

(this also counts as the first usage)

Some things of note here. The scroll in the Y direction is supposed to have a modulo applied to it so it stays within the bounds of 0 to 239, but it wasn't working properly.

Not shown in the video, but something I ran into earlier, is the scroll not initializing properly unless I did some odd things involving the ordering of certain things at startup.

Also, I don't know why there's a blank space where the "E" in "TEST!" should be.

There's also a bit of lag, though that might just be due to how I set up frame timing.


I'll have to figure that out at some point, but to finish this post here's the function that I used to put that text on the screen in the first place:

(Funnily enough, this actually puts the string in a separate buffer to be then put into the actual buffer. I might change that to be more streamlined at some point.)

ree

 
 
 

Comments


bottom of page