Jump to content
IGNORED

Jumpy Screen Noob Blues


Recommended Posts

Boy I hope I didn't post this twice. Listen, I am not tech savvy, as I will demonstrate later on. Long story short: I'm new to Atari 2600 programming. I tried making a title screen. Bad way to start off, I know, but I just wanted to make something simple. Turns out it's not so simple. Why is my screen so jumpy? On an emulator it looks ok-ish. On an actual Atari it's a mess. What's up with that?

beyondsynth.a

Link to comment
Share on other sites

Your frame scanline count continually jumps between 262 lines and 263 lines.  This can be seen when running in Stella: press Alt-L to see line count & frame rate.

 

I see you are not using the RIOT timers to do your frame timing.  Using them can help alleviate most timing issues, especially for running code during VBlank / Overscan.

 

Cool title screen so far.

  • Like 2
Link to comment
Share on other sites

I tried using the macros that 8BitWorkshop uses. I'd say it's even worse now, the scanline count still goes from 262 to 263, only even faster, which I think is an achievement. Nuts, I was hoping to expand on this and maybe make an entire full length tune. Thanks for the advice everyone. I'll figure this out eventually. Currently trying to use the RIOT timing code to see if that does anything. Thanks, Spledidnut!

Link to comment
Share on other sites

3 hours ago, alex_79 said:

Moreover, you must set/clear VSYNC at the beginning of a scanline (right after a "sta WSYNC"). Currently it is set at cycle 44. Many TV don't like that and as a consequence the screen will roll/jump.

 

 

So I saw this and moved loading the music further down, since it loads before the vertical sync. Oops! However, this caused the screen to hop around even more. How do I mitigate this? Where do people usually put the music? How would I mitigate, say, a full tune? Thanks for pointing that out, by the way. I didn't even see it. New to this stuff.

Link to comment
Share on other sites

18 minutes ago, CobraYouFools said:

How do I mitigate this? Where do people usually put the music? How would I mitigate, say, a full tune?

The issue you are having is that you are not tracking how long the music routine takes to run each frame.  Currently the timing of the routine (in the first post) varies enough that it's actually adding an extra scanline to your frame.

 

Welcome to the world of 2600 programming, where you actually have to time how long your code takes to run OR wrap it in a timer to keep things under control... i.e. make sure the frame timing doesn't vary.

 

The music routine can run in either the VBlank area or the Overscan area.  BUT, you should/kinda-need-to wrap the code in a timer to make sure that area of code always takes the same amount of time.  Wrapping the code in a timer involves: starting a timer before the routine.  Then either call out or do your routine.  Then after the routine is finished, run a loop to wait for the timer to expire.

 

----

 

The example I provided wraps each region of the display in a timer:  VBlank, Display, and Overscan.  I typically do this in my projects so that I don't have to worry too much about scanline counts and frame variance... The only thing I need to worry about is my code running fast enough to fit within these regions.

  • Like 3
Link to comment
Share on other sites

Gotcha. I guess I was avoiding this because up until now I've only written simple little programs on the Atari. I guess I thought I could get away with it. You guys, this helped me out immensely. I guess I have some reading to do regarding timers. I've experimented with INTIM a bit but I've never done anything substantial with it. If I can get the timing down I think it would go a long way towards actually figuring out the rest of what I want to make. You guys are the best.

 

On a somewhat related sidenote, has anyone messed with Slocum Tracker? That thing outputs ROMs with full tunes. I should probably disassemble one of the ROMs it outputs to see how it does it. The timing never fails on that thing. It's uncanny.

Link to comment
Share on other sites

On 10/1/2022 at 4:44 PM, splendidnut said:

 

The example I provided wraps each region of the display in a timer:  VBlank, Display, and Overscan.  I typically do this in my projects so that I don't have to worry too much about scanline counts and frame variance... The only thing I need to worry about is my code running fast enough to fit within these regions.

You are an ABSOLUTE GENIUS! I can't thank you enough! Just when I thought I was getting a handle on this whole Atari programming thing I realize I have so much more to learn. Stella forgives my mistakes. An actual Atari? Not so much! I tested this out with my CRT TV and a Harmony Flash Cart. Worked like a charm! It's still a little wonky on the bottom of the screen but it's outputting a steady frame rate/doesn't trigger motion sickness from all of the bouncing. Sweet success! How did you figure this out? Every newbie bit of literature I've read says to do it the way that I was doing it. Apparently it only works for simple, newbie programs. The second you bring in things like music it all falls apart. I guess my next course of action is to figure out how your code even works. I need to familiarize myself with the RIOT timers. They're way too useful to be ignored! Honestly, thank you so much. You're the best and this made my day.

beyondsynth.a

  • Thanks 1
Link to comment
Share on other sites

I just took a look at the newer code you posted.  Your sprite / ball movement code is not wrapped in a timer area... it's between the Display area and the Overscan areas.

 

To fix:  Immediately after the waitForDisplayEnd loop, do a STA WSYNC, set VBLANK and then start the timer for the overscan area.  Then, all your code will be wrapped within the timer areas (if I'm not missing anything).

 

---

 

I should probably redo my example code with MACROs to help make things a little more clear.

  • Like 1
Link to comment
Share on other sites

Nice! Yeah that fixed the bottom of the screen. Thanks for the pro-tips! Now I have to do the rest of the game. I have to admit, I kind of want to keep going on the tune. That is my strong suit, after all---the only thing I have any sort of professional training and a degree in. All of this programming is really just me reaching middle age and wondering about the things I still want to do with my life now that it's more than half over. I think I found the right hobby, despite the fact that I am bad at math.

beyondsynth (6).a

Link to comment
Share on other sites

You might like to check out my tutorial, covers writing a complete 2K game from scratch.  Use of the timers is in Step 2.

 

I notice you're using separate Div15Loops for each object. Step 4 has an X positioning subroutine that works for all objects, would save you ROM. 

 

 

Link to comment
Share on other sites

10 hours ago, SpiceWare said:

You might like to check out my tutorial, covers writing a complete 2K game from scratch.  Use of the timers is in Step 2.

 

I notice you're using separate Div15Loops for each object. Step 4 has an X positioning subroutine that works for all objects, would save you ROM. 

 

That's awesome! Would you believe that I had a subroutine for all of the horizontal positioning? I don't know what I messed up but it made everything so incredibly wonky. Would be nice to do it the right way! I wonder if I have an earlier version of this lying around so I can see what it is exactly that I messed up. Thank you so much! Yeah, this will hopefully be 2K. I can't imagine me and my limited brain capacity doing bank switching, but then again I got this far so who knows? I am making this a full tune first, just to see what I can do musically on this system. It's the ultimate exercise in pitch limitation. At some point I'd like to go big with the Atari Vox+ and do something of a lo-fi music video/demoscene thing, but who knows if that's even possible, at least for me. Big plans, small knowledge. Thanks for all the help! I'll be reading this start to finish and implementing what I can from it.

Link to comment
Share on other sites

2 hours ago, CobraYouFools said:

Thank you so much! Yeah, this will hopefully be 2K. I can't imagine me and my limited brain capacity doing bank switching

 

You're welcome!

 

You can go up to 4K without having to worry about bank-switching.  Only difference is the ORG for the start of ROM:

  • 4K uses org $F000
  • 2K uses org $F800

You can generate a display using TIA, you definitely don't have limited brain capacity.

 

image.png.e5242c016937f93720d8622a2e77f9a7.png

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...