Re: [stella] Revolutionary Horizontal position discovered!

Subject: Re: [stella] Revolutionary Horizontal position discovered!
From: Manuel Polik <cybergoth@xxxxxxxx>
Date: Wed, 30 Oct 2002 20:09:36 +0100
Hi Kirk!

>and lowly apprentices trying not to blow ourselves
>up with the potions again


Apropos, reminds me that I should mix a "White Russian" 
for my girlfriend waiting in the bath. One moment 
please... :-)

>I think I don't quite understand it.

Ok if you never ran into such an algorithm, that's a 
normal reaction :-)

>I keep meaning to write a minifaq about the typical
>math it something you'd run in 
>the VBLANK, to put stuff right where it belongs 
>based on a variable holding the horizontal position?

Phew... well.

The routine would be probably be framed by something 

LDA #XXX		    ; Position between 0-159
LDX #$0X		    ; Offset for RESP0,X
JSR TheMagicRoutine ; :-)
STY HMP0,X		    ; Fine positioning value

Actually, you can call this wherever you want, even 
midscreen. I think the routine presented could be even 
tweaked to reposition an object in a single scannline - 
without using any table!

Ok, since the inner workings of the routine as such have 
been explained before, I'll just give you a pointer:

Here Robert Colbert explains the general inner working 
of horizontal positioning in deepest details.

Now, while the principle is exactly the same, I'm sure 
you'll find that the routine I just posted uses half the 
bytes of the one Colbert discusses. It's way more 
elegant and can in some cases probably save a whole 
scannline for you.

One thing that is left to test, is wether the new 
discovered routine is working precisely on the borders. 
With very small values, the RESP may come too early, 
with very high values the cycle limit per scannline 
might get exceeded...

And another thing: Battlezone does the black HMOVE lines 
on the whole visible screen, I don't know how/if the 
algorithm works without that.

I don't need this technique for Star Fire at all, 
because all my repositioning is way more complex and 
therefore table driven, but I thought others might never 
ever use the old ugly Air-Sea-Battle thing again :-)

> How deep is your understand of Battlezone at this 
> point?

I started partially reverse-engineering it, but my only 
intention is to analyze how the "crash" works. I'm 
almost done, maybe I'm posting the result tomorrow or on 
friday. Obviously I wanted to have that or a similar 
effect in Star Fire :-)


Archives (includes files) at
Unsub & more at

Current Thread