Re: [stella] Collaboration

Subject: Re: [stella] Collaboration
From: Christopher Tumber <christophertumber@xxxxxxxxxx>
Date: Fri, 17 Jan 2003 22:48:48 -0500
>The biggest problem for me now is to avoid those nasty tearing effects
>that happen when you change a register while the object is drawn. With
>four object writes within two lines that have to happen nearly
>completely outside the visible screen this is not an easy task.
>And those effects are even more visible when the tearing happens at
>different horizontal positions due to the many different kernels.
>Therefore it's IMO a MUST to avoid them (even if we have to give up the
>single pixel Y-positioning of the zombies).
>What do you think?
>BTW: This conversation is open to *all* [stella] members. ;-)

I think you could be looking at a very complex kernal (smile)...

One possibility would be to create multiple kernals. The different kernals would write to the registers in particular order depending upon where objects are positioned on the screen. So kernal 1 would write P0, P1, M0, M1. Kernal 2 would write M1, M0, P0, P1. &etc.

Given you already have several kernals it's going to be an awfully complex kernal, but there you go.

Or, you could put each section into subroutines and sort the subroutines during your housekeeping. So your kernal would look like:

 jmp ($80)
 jmp ($82)
 jmp ($84)
 jmp ($86)

Where each of those pointers points to one of the (P0/P1/M0/M1) routines. Though you have some problems getting back to that jump list.

Okay, so what about the RTS idea from a previous thread...

In your Vertical Blank/Overscan you sort the routines according to horizontal position. Then you load the addresses on the stack:

    lda >#return_to_kernal
    lda <#return_to_kernal
    lda >#routine4
    lda <#routine4
    lda >#routine3
    lda <#routine3
    lda >#routine2
    lda <#routine2
    lda >#routine1
    lda <#routine1

Then in your kernal, to draw a scanline:


And end each routine with an RTS.

The big downside is the huge hit you're taking on the cycle count, but, since you have the Horizontal Blank to work with maybe you could simplify so there are only 2 kernals and you flip/flop which order to execute them in.

Or, put your kernal into a RAM routine and drop the sections in with the order depending upon where objects are on the screen.

Or, can you make your objects generic enough so that that they can be drawn by any of the sprites? (ie: Car1 can be either P0, P1, M0 or M1, Car2 can be either P0, P1, M0 or M1, Gremlin1 can be either P0, P1, M0 or M1, Gremlin2 can be either P0, P1, M0 or M1). Then you pre-sort which corresponds to which depending upon horizontal positioning so the leftmost object gets the first set of registers, &etc. You're going take an hit on the overhead, changing constants to variables but I'm just throwing out ideas here without a lot of concern for practicality...

Or, you could use VDELPx like it's intended and go to a two scanline resolution for movement ...


Archives (includes files) at
Unsub & more at

Current Thread