Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - How can I hide the bottom 8 pixels?

Reply to topic
Author Message
  • Joined: 21 Aug 2021
  • Posts: 41
Reply with quote
How can I hide the bottom 8 pixels?
Post Posted: Sun Aug 29, 2021 12:04 am
I'm writing a game that allows the player to move freely in 8 directions.
Everything works fine, except the bottom of the screen.

I'm using the horizontal and vertical scrolls, and the number of pixelsI scroll in range from +/-2 to +/- 6 up, down, right, left and combinations.

I have set the bit to hide the first column (8 pixels), which works perfectly.
But, every time I move vertically, the bottom of the screen moves up and down, depending on the value of the scroll-y.

I believe the way to fix this has something to do with generating an interrupt on the 184th line, to swap all colors with black (or, in my case, blue), or disable screen output... or something.

I wonder if that's the right way to do it.

Any ideas?
Thanks in advance for any input.

Cheers!
  View user's profile Send private message
  • Joined: 09 May 2008
  • Posts: 24
Reply with quote
Post Posted: Sun Aug 29, 2021 1:40 am
ruibjr wrote
I'm writing a game that allows the player to move freely in 8 directions.
Everything works fine, except the bottom of the screen.

I'm using the horizontal and vertical scrolls, and the number of pixelsI scroll in range from +/-2 to +/- 6 up, down, right, left and combinations.

I have set the bit to hide the first column (8 pixels), which works perfectly.
But, every time I move vertically, the bottom of the screen moves up and down, depending on the value of the scroll-y.


I've never seen a SMS game with the bottom row hidden. You can scroll freely in Sonic games and only the first column is hidden.
  View user's profile Send private message Visit poster's website
  • Joined: 09 Jun 2014
  • Posts: 375
Reply with quote
Post Posted: Sun Aug 29, 2021 5:44 am
What do you mean by "the bottom of the screen moves up and down"?

Could it be an issue with your viewport and tilemap? How does your tilemap look when the issue occurs?
Meka tilemapper.png (23.9 KB)
Meka tilemapper.png

  View user's profile Send private message Visit poster's website
  • Joined: 01 Feb 2014
  • Posts: 877
Reply with quote
Post Posted: Sun Aug 29, 2021 7:18 am
The bottom 4 rows of the tilemap are always hidden or rather outside the visible screen area. You don't need to hide any more if you want to do vertical scrolling.

You need to keep in mind the 32 pixels gap, though, as the tilemap is only 224 pixels in height. Any scrolling routine needs to be aware of this, otherwise there will be weird jumps in the scrolling, because the missing (tilemap) lines will be mapped by the hardware to existing screen lines.

If, for which ever reason, you need to mask more than 4 rows of tiles, then the method you mentioned is the way to go. Set up a line interrupt, then turn off the screen when it triggers. You'd still need to address the frame interrupt that follows shortly after, though.
  View user's profile Send private message
  • Joined: 21 Aug 2021
  • Posts: 41
Reply with quote
Post Posted: Sun Aug 29, 2021 10:32 pm
Thanks for the answers.

My problem is: since the main character can move at 2px, 3px, 4px, 5px or 6px up and down, I adjust the v-scroll register as needed - that works perfectly.

But, when I scroll, for instance, 4px, the whole screen moves 4px up, so the whole screen (and the bottom of the screen) move 4px up.
The screen now is 188 pixels high (192 pixels minus 4 pixels).

If the player move again, another 4px, I reset the v-scroll register and next time I update the screen, I update it starting one row (8 pixels) up.
This works, but now the screen is 192 pixels hight again, because scroll is now 0.

I am sure I'm doing this wrong.
So, how would you suggest I should handle the vertical scroll?
The way I'm doing it, the only way I could think of is to hide the bottom 8 pixels, so the screen is going to alway be 184 pixels hight.

I am totally doing this in the wrong way, I can tell.
Can you guys pint me at the right way to do this?

Thanks again.
Cheers!
  View user's profile Send private message
  • Joined: 01 Feb 2014
  • Posts: 877
Reply with quote
Post Posted: Mon Aug 30, 2021 6:24 am
I'm not sure if I understand it correctly, but it seems to me that you're trying to scroll a screen that's not bigger than the visible area and thus you scroll parts with undefined tiles into view, which leads to the effect of the bottom moving.

What you want to do instead is making use of the whooping four rows of tiles that are outside the visible screen area. Prepare the next row that's supposed to scroll into view there before you scroll, so the tiles will be immediately visible even if you scroll just a part of them into view.

Also, there's no need to reset the v-scroll register and refresh the whole screen every time it moves 8 pixels. Just use the full range of 224 pixels and only refresh the rows that are about to get scrolled into view.
  View user's profile Send private message
  • Joined: 21 Aug 2021
  • Posts: 41
Reply with quote
Post Posted: Mon Aug 30, 2021 1:04 pm
Thanks!

That's exactly what I needed.
I wasn't aware that despite only showing 192 pixels, I could prepare the other 32 pixels.

Cheers!
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!