Re: [stella] Object handler organisation

Subject: Re: [stella] Object handler organisation
From: Manuel Polik <cybergoth@xxxxxxxx>
Date: Fri, 08 Nov 2002 08:57:20 +0100
Hi Christopher!

While I'm trying to assimilate all you've written 
(thanks a zillion!) let me explain some thing, I'm not 
sure you're aware of.

> This will eliminate the whole "CMP #$20/BMI 
> NoMeteorSprite" testing

I've a data structure for things the kernel can display. 
The kernel just executes and draws these objects, 
without knowing what is what, they all are treated 
equal, obviously I don't have the time in the kernel for 
distinguishing between drawing a ship or a meteor or 

Now, this is the structure:

xpos          ds #MAXOBJECTS      ; horizontal position 
ypos          ds #MAXOBJECTS      ; vertical position
xymov         ds #MAXOBJECTS      ; xy motion
zmov 	         ds #MAXOBJECTS      ; z motion
sprtsizetype  ds #MAXOBJECTS      ; size/type/color

(Ten objects = 50 bytes!)

To let the kernel draw these, I'm constantly Y sorting 

That means in the first frame the motherships data might 
for example be stored in 


in the next frame it might be located in


So, I originally don't know in the object handler which 
object is which and I'm forced to test this, no other 
choice. Except sacrificing another 10 bytes RAM for 
indexing the object types, but I'm not that desperate - 
yet :-)

But thanks for all you other insights.

Again, I originally had this big chunky mess of 
straightforward *grown* code. It was when I started 
loosing control over it, that I decided to clearly 
extract it into subs with proper defined functionality.

It was good to do that anyway, since now I've clearly 
defined subs, I can optimize them all separately for 
speed and having all functionality seperated in logic 
blocks helps me mentally entwining the chaos.

In future steps I'll now carefully go back step by step 
to the "big mess", only it'll be way less chaotic and 
more optimized then :-)


Archives (includes files) at
Unsub & more at

Current Thread