Jump to content
Sign in to follow this  
jbs30000

Need help with VBLANK

Recommended Posts

In my Super Mario Bros game when Mario is causing the screen to scroll it constantly flickers. I've tried using vblank but I can't do it right.

 

My game is 32K so I know that I have to put it in bank 8. If I put

 

vblank

pfscroll left

return otherbank

 

in bank 8 then the screen continuously scrolls, even if I don't gosub to it. If I just put

 

vblank

return otherbank

 

gosub to it, then do a pfscroll the screen still flickers.

 

So, how do you properly use vblank and fpscroll in a multibank program? Thank you.

Share this post


Link to post
Share on other sites

I forgot to say that you don't jump to it yourself using a gosub either:

 

http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#vblank

The code in vblank will be run automatically every time a drawscreen is called. You can specify vblank only once, and the code should be physically separate from the rest of your code (in other words, it's inadvisable to allow your regular bB code to 'run into' the vblank code). Since vblank is a subroutine, you need to end it with a return. And since you will not be calling the subroutine yourself, you do not need to use a label or line number.

 

I'll make one of those "Did You Know" boxes so it will be extra clear.

Edited by Random Terrain

Share this post


Link to post
Share on other sites

I did read your notes, but you have

 

vblank

pfscroll left

return

 

Is that example for a program that constantly scrolls non-stop? Or if you want to control when you scroll the screen, how do you do so without a gosub to the vblank command?

 

Anyway, tomorrow (or technically later today) I'll try just adding

 

vblank

return

 

to the end of my program and see what happens (it's 3:26am and I need to get some sleep).

Share this post


Link to post
Share on other sites

I did read your notes, but you have

 

vblank

pfscroll left

return

 

Is that example for a program that constantly scrolls non-stop? Or if you want to control when you scroll the screen, how do you do so without a gosub to the vblank command?

batari just used that as an example. You can put pretty much anything you want in there as long as it doesn't take too much time and you want it to happen all of the time.

 

If you want to control scrolling, forget about vblank and do it in your main loop.

Share this post


Link to post
Share on other sites

I did read your notes, but you have

 

vblank

pfscroll left

return

 

Is that example for a program that constantly scrolls non-stop? Or if you want to control when you scroll the screen, how do you do so without a gosub to the vblank command?

batari just used that as an example. You can put pretty much anything you want in there as long as it doesn't take too much time and you want it to happen all of the time.

 

If you want to control scrolling, forget about vblank and do it in your main loop.

I already do it in my main loop, and there's flickering. That's why I want to try the vblank.

Share this post


Link to post
Share on other sites

I recently made a mock-up screenshot for RevEng for his "Good Touch: Bad Touch" game idea. I made a finger and a doll out of pfpixels. The screen would scroll up and down to simulate the finger moving. The doll looked like it stayed in place because I used pfppixels to redraw it when the screen scrolled. Sure as shoot I had alot of flickering.

 

I didn't notice this when I first started programming in Batari BASIC. Either I just never noticed or drawing pfpixels is causing flickering in recent BB builds.. hmmmn..

 

I haven't reported this because I'm still not sure if it's my bloated coding doing it.

Edited by theloon

Share this post


Link to post
Share on other sites

I just found the source of the flicker and it wasn't a vblank that fixed it. In my routine to move Mario to the right I was drawing him twice. First when the routine was entered, and then again if the screen needed to be scrolled. By taking out the second set of commands to draw Mario the screen doesn't flicker as bad.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...