Jump to content
IGNORED

Weird problems with COLUPF/COLUBK inside Main Loop


IuriNery

Recommended Posts

Hello everyone, I'm trying to create a playfield with different colors, but something weird is happening. Some of the lines of PF/BK are not aligned properly.

 

Here is the Screenshot:

post-59407-0-17853700-1518908510_thumb.jpg

 

Here is the assembly code:

atari3.asm

 

If I set COLUPF or COLUBK on the main loop, it seems that it messes with some of the lines, but if I set a single color for both COLUPF and COLUBK before the StartOfFrame, everything seems to work fine.

I don't know what I'm doing wrong here, if someone could help me I would be really glad. Thank for your time.

Link to comment
Share on other sites

I think you are waiting too many cycles to write to the registers after WSYNC. You only have 22ish cycles of Hblank .

 

try moving the writes to COLUxx right after WSYNC and before writes to PFx . Still not perfect but it is better.

 

I think you might also be writing to PF after HBLANK and need to preload graphics for next line.

Edited by easmith
Link to comment
Share on other sites

I think you are waiting too many cycles to write to the registers after WSYNC. You only have 22ish cycles of Hblank .

 

try moving the writes to COLUxx right after WSYNC and before writes to PFx . Still not perfect but it is better.

I moved COLUPF & COLUBK as you said, it's better indeed. There are only 2 small issues now:

post-59407-0-35043200-1518961364_thumb.jpg

 

atari4.asm

 

 

 

I think you might also be writing to PF after HBLANK and need to preload graphics for next line.

Can you please elaborate on that?

 

 

 

Work your way through the Collect tutorial. This particular issue is known as shearing, and is covered in Step 4 - 2 Line Kernel.

I will take a look, thanks!

 

 

 

 

It even occurred in released games back in the day, like on the right side of Air-Sea Battle:

Interesting, so this is a common thing that happens with Atari games that has lots of colors, gradients etc.?

 

 

EDIT: is there a way to set the COLUPF and COLUBK for all the lines once? (outside the game main loop)

Edited by IuriNery
Link to comment
Share on other sites

Putting a WSYNC before you blackout the playfield should fix the bottom line.

 

The other anomaly I think is caused by writing to PF1 1 or 2 cycles late. Not sure how to fix it , I am pretty new.

I think the 2 LK in Collect Tutorial might be the only way to fix it . I'm not sure I understand it 100%

Link to comment
Share on other sites

When designing kernels you have to mind WHEN the various registers are being updated. The TIA is continuously drawing images, so if you change something while the TIA is in the middle of a scanline, that change will appear at that point.

 

A carefully designed kernel will try to keep track of where things are and which part of the screen the TIA is drawing to avoid updating them exactly when they're being rendered.

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...