## Re: [stella] Repositioning Proof Of Concept

 Subject: Re: [stella] Repositioning Proof Of Concept From: Manuel Polik Date: Sun, 17 Mar 2002 20:38:52 +0100
```Hi Piero!

>>It repositions _both_ sprites in the same scannline!

>How do you do that?

It works pretty straightforward. Basically, as one would
expect, I just do

STA RESP0
STA RESP1

in one scannline.

With the second RESP, I loose one pixel, so using the
same HMOV values for both sprites would produce a one
pixel gap.

You lose 15 cycles every iteration in the timing loop
before the RESPs, but you have 16 different HMOV values,
i.e. a one pixel shift is just possible!

So I worked out two tables, that are shifted by one
pixel.

Here's a little example code:

LDA movetab1,X
sta HMP0
LDA movetab2,X
sta HMP1
AND #\$0F
TAY
RespLoop
dey
bpl RespLoop
sta RESP0
sta RESP1

The tables look like this:

movetab1
.byte \$6X,\$5X,\$4X,\$3X,\$2X,\$1X,\$0X,\$FX
.byte \$EX,\$DX,\$CX,\$BX,\$AX,\$9X,\$8X

repeat with X+1;
repeat with X+2;
...

movetab2
.byte \$7X,\$6X,\$5X,\$4X,\$3X,\$2X,\$1X,\$0X
.byte \$FX,\$EX,\$DX,\$CX,\$BX,\$AX,\$9X

repeat with X+1;
repeat with X+2;
...

>Are there any restrictions?

Well, there's some troubles at the left/right edges. I
have yet to determine the maximum range where the big
ships can be freely moved. And I've yet to find out the
ranges where RESPX is working properly.
(I think there's a table somewhere in the archive :-))

Another restriction is, that all you can do with this
technique is gaps with 0-2 pixels between both sprites.
This is working perfect for my game, but if your
intention would be total free positioning of both
sprites, the solution would be... uhm... complex. I
think it is possible, but...

Greetings,
Manuel

----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

```
Current Thread