Re: A86: Tile based games


[Prev][Next][Index][Thread]

Re: A86: Tile based games




> Please help: 
> I know that in order for a tile\sprite to scroll every pixel in that
> sprite must be shifted (SLA=left, SRA=right, ???=up, ???=down) to which
> ever direction that it is supposed to move, multiple times.  But what
> about the pixels that get bumped off the sides.

The pixel that gets knocked off when doing sla or sra goes into the carry flag.
 
> Suppose we want to move the sprite left, one pixel.
> 
> 00000000   11101110
> 00000000   10001000
> 00000000   11101000
> 00000000   00101000
> 00000000   11101110
> 00000000   00000000
> 00000000   11111111
> 00000000   00000000
> 
> A SLA for each byte leaves us with:
> 
> 00000000   11011100
> 00000000   00010000
> 00000000   11010000
> 00000000   01010000
> 00000000   11011100
> 00000000   00000000
> 00000000   11111110
> 00000000   00000000
>        ?
> But what about the missing column?

Take the bit from the carry flags after sla or sra to make the column.

> Would the contents of the carry flag be copied to BIT 0 in the next byte,
> and then the byte to the left would also have to be SLAed?

Yep.. that would scroll
 
> Is this how to scroll?

yes

> If it is, then how do I scroll up or down?

Scrolling up and down is easy by subtracting 16 from the memory address to 
move the byte of pixels up a row.

-Jim Alverson
 ICQ: 1451168


References: