Beam-Racing Rasterbars [message #384399] |
Tue, 11 June 2019 20:39 |
Vince Weaver
Messages: 136 Registered: April 2013
Karma: 0
|
Senior Member |
|
|
Hello
So I made some beam-racing rasterbars which turned out to be unexpectedly
popular so I thought I might as well post about it here.
http://www.deater.net/weave/vmwprod/rasterbars/
It's an extension to the cycle-counting stuff I've done before, but this
time actual beam-racing is involved.
This lets you have 40x192 15-color graphics for up to 1/3 the screen
on a stock Apple II (no double hires or double lores needed).
Previously in lores you could get 192 lines of 15-color graphics, but since
you flip between PAGE1 and PAGE2, for each 4-line block you end up
with a max of 2 colors repeated in that block.
What you can do is notice that each line takes 65 cycles to draw, and
so you have 65-cycles (well, 61 if you take out the page flip) where you
can do anything, including re-writing the line you just displayed to have
different colors before the beam gets back.
It turns out that's enough to draw 14 blocks to the screen if they are
all one color, or 9 blocks if they are arbitrary colors. So you can
make nice looking rasterbars fairly easily.
You could probably also make sprites with this, or even some enhanced images
that are 40x96 but 9 blocks per hlin could have enhanced colors.
I had actually done some work on this earlier, but forgot about it, but
it came up again in discussions with FrenchTouch so I got inspired to
put this together.
The next step will be to see if I can manage to play PT3 music in the
3000 or cycles still left per frame. Obviously this gets hard, as the
PT3 player is not cycle-invariant.
Vince
|
|
|
Re: Beam-Racing Rasterbars [message #384401 is a reply to message #384399] |
Wed, 12 June 2019 01:45 |
qkumba
Messages: 1584 Registered: March 2013
Karma: 0
|
Senior Member |
|
|
This is amazing.
In your code, both X and Y are available in the unrolled part.
Isn't it possible to index into a colour array and still hit the 14 blocks draw, by dropping a couple of the delay instructions?
|
|
|
Re: Beam-Racing Rasterbars [message #384404 is a reply to message #384401] |
Wed, 12 June 2019 10:35 |
Vince Weaver
Messages: 136 Registered: April 2013
Karma: 0
|
Senior Member |
|
|
On 2019-06-12, qkumba <peter.ferrie@gmail.com> wrote:
> This is amazing.
> In your code, both X and Y are available in the unrolled part.
>
> Isn't it possible to index into a colour array and still hit the 14
> blocks draw, by dropping a couple of the delay instructions?
Do you mean having something like
lda color_array,Y
iny
at the beginning of each line instead of the constant load?
I guess then you could have a linear framebuffer of colors and would make
the vblank code a bit simpler.
Interesting.
I was going to try to get music playing next, but enough people want to
see some sort of many-colored sprite that I might see if I can throw
that together first. This method of doing things gives nice smooth
vertical movement, but horizontal movement jumps 7 pixels so I'm not
sure how well it would work for making a game.
Vince
|
|
|
Re: Beam-Racing Rasterbars [message #384405 is a reply to message #384404] |
Wed, 12 June 2019 14:57 |
qkumba
Messages: 1584 Registered: March 2013
Karma: 0
|
Senior Member |
|
|
> Do you mean having something like
>
> lda color_array,Y
> iny
>
> at the beginning of each line instead of the constant load?
Yes, that's exactly what I meant.
> I guess then you could have a linear framebuffer of colors and would make
> the vblank code a bit simpler.
>
> Interesting.
:-)
|
|
|