jbs30000 #1 Posted September 16, 2010 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. Quote Share this post Link to post Share on other sites
+Random Terrain #2 Posted September 16, 2010 As far as I know, you just use return, not return otherbank. Quote Share this post Link to post Share on other sites
+Random Terrain #3 Posted September 16, 2010 (edited) 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 September 16, 2010 by Random Terrain Quote Share this post Link to post Share on other sites
jbs30000 #4 Posted September 16, 2010 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). Quote Share this post Link to post Share on other sites
+Random Terrain #5 Posted September 16, 2010 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. Quote Share this post Link to post Share on other sites
jbs30000 #6 Posted September 16, 2010 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. Quote Share this post Link to post Share on other sites
+Gemintronic #7 Posted September 16, 2010 (edited) 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 September 16, 2010 by theloon Quote Share this post Link to post Share on other sites
jbs30000 #8 Posted September 16, 2010 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. Quote Share this post Link to post Share on other sites