Hi folks,
Take a look at the first Blitter demo for FIGnition - I think you'll
be impressed!
As part of the next firmware upgrade I've been working on an initial
version of the blitter, mostly because I know I need to make it fit in
Flash with the other firmware changes. I always figured the blitter
would be pretty good, but now we can finally see it in action:
http://www.youtube.com/watch?v=vqwK4lum0Hs
So, this is the first (albeit silent) demo. In this demo you can see
FIGnition's blitter blitting a number of 4x3 nyan cat sprites across
the bitmapped screen using the 2blt command. The sprites themselves
start at random locations and move at constant, random speeds between
1 and 16 pixels per step.
Initially there are 10 sprites, and the 2blt blitter is able to move
them at around 50 frames per second. As I increase the number of
sprites to 44, the frame rate slows down to about 11 fps. This means
that FIGnition is blitting at effectively 12,000 8x8 tiles per second
(because moving each of these sprites requires drawing 12 tiles in the
new location and undrawing 12 tiles in the old location: so 2 (drawing
ops)*12 (tiles/sprite)*10 (sprites)*50 (fps) = 12K tiles / second). It
can do this for sprites of any width and height up to the size of the
full frame buffer and at any pixel location, the shifting is performed
in real-time as it copies the image to the frame buffer.
This is good I believe, compared with the performance of most 8-bit
computers moving graphics images. It's certainly good enough for most
shoot-em-ups. For example, space invaders requires 55 aliens each of
which require 2 tiles. FIGnition would typically blit them all at
50fps.
Of course this is all done by copying images from internal tile space
to dog-slow* serial SRAM frame buffer while FIGnition is actually
generating a bitmapped video image from a frame buffer on the same
serial SRAM. Although it's only monochrome, it offers the kind of
versatility you can't get from a microcontroller alone.
The Blitter isn't finished yet. I need to add clipping (though this
will speed up the blitter), so that you can specify an area of the
screen outside of which blitting has no effect. I also need to add the
blts command to rapidly dump background patterns on the image.
I've changed the semantics of 2blt. I found that it was awkward to
have to generate what would be 6 inputs for the command. Instead the
at command now manages the clever part. Here's how it works. Normally
when you're moving images around the screen in a game, you want to
calculate the new location, blit the new sprite's image to the new
location then xor blit the old-sprites image to the old location to
make it disappear. That way you reduce the flicker on the screen if
the display operation didn't complete before the next frame starts.
This is pretty awkward because you have to remember the old location
all the way to the end of the operation. The new at command stacks the
previous at coordinates to make this easier. So now the general
operation is:
oldx oldy at CalcNewCoords
newx newy at ( oldx oldy get saved too by at)
prevSpriteTile prevSpriteDimensions newSpriteTile newSpriteDimensions 2blt
For my nyans routine the central routine is now:
: catsBlit ( --)
0 catList
numCats @ 0 do >r ( : catListPointer)
r c@ r 1+ c@ 2dup at ( old Coords)
swap r 2+ c@ catMv ( gen newCoords based on oldCoords and speed)
over r 1+ c! ( new x)
dup r c! ( new y!) ( update new Coords in catList)
swap at ( set new coords and save old ones)
0 772 0 772 2blt ( draw new location, erase old one)
r> 3 + ( next cat)
loop drop
;
I think the rest of the development will take several more days, it
always takes longer than you expect and then I'll have a bit of
tidying of the firmware to do. But at least this little demo lets you
know what I've been up to and also some of the game possibilities
FIGnition will offer in the much near future!
-cheers from julz
( *dogs aren't really slow admittedly :-) )
--
The DIY 8-bit computer from nichemachines™