Hardware Sprites
Every moving thing so far has been the blitter copying pixels into your picture — clear, redraw, repeat. The Amiga has another way: eight hardware sprites the chips overlay and move for you, floating above the bitmap without ever touching it. No Cls, no Blit. This is the chip feature AMOS hides most completely.
Every moving object you've made so far has been blitted — the blitter stamps the shape into the bitmap, and to move it you clear the screen and stamp it again, frame after frame. That's one way the Amiga puts things on screen, and it's a good one. But it's not the only way. The machine has a second, completely separate system: hardware sprites — up to eight small objects the chips draw and move over the bitmap, on their own, without disturbing a single pixel underneath. No Cls, no Blit, no redrawing. You tell a sprite where to be and the hardware does the rest. It's the Amiga feature AMOS hides most completely, tucking it away behind its Bobs — and Blitz hands it straight to you.
What you'll see by the end
A small object slides across the screen, passing over a box and a circle, while the backdrop sits perfectly still. Watch what doesn't happen: the backdrop never flickers, never redraws, never even gets a Cls. It's painted once, at the start, and then left alone. The moving object is a hardware sprite, floating above the bitmap on its own layer — the chips slide it across and lift it over everything below.
The whole program
; A hardware sprite the chips move for you, over a backdrop drawn once.
BLITZ
; build a shape, then turn it into hardware sprite 0
BitMap 2,16,16,2
Circle 8,8,7,1
Circle 8,8,4,2
GetaShape 0,0,0,16,16
GetaSprite 0,0
; a backdrop, drawn ONCE - the loop never touches it again
BitMap 0,320,256,3
Cls 0
Boxf 0,170,319,255,2
Circle 230,70,40,3
Boxf 50,40,110,100,5
Slice 0,44,320,256,$fff8,3,8,8,320,320
Use Slice 0
Show 0
x.w=0
dx.w=2
While Joyb(0)=0
VWait
ShowSprite 0,x,72,0
x=x+dx
If x>304 Then dx=-dx
If x<0 Then dx=-dx
Wend
Three parts: make a sprite, paint the backdrop once, then a loop that only moves the sprite.
Make a sprite
BitMap 2,16,16,2
Circle 8,8,7,1
Circle 8,8,4,2
GetaShape 0,0,0,16,16
GetaSprite 0,0
You already know the first four lines: draw a little picture on a work bitmap and grab it as a shape. The new line is GetaSprite 0,0 — it turns shape 0 into hardware sprite 0. From here the chips can display that sprite anywhere, and the shape's job is done.
One detail matters: the work bitmap is depth 2 (BitMap 2,16,16,2), not 3 like the display. Hardware sprites are deliberately spare — three colours plus transparent, which is exactly two bitplanes. Give GetaSprite a deeper shape than that and it has nowhere to put the extra colours. Sprites trade richness for the fact that the hardware moves them for free.
Paint the backdrop once
Cls 0
Boxf 0,170,319,255,2
Circle 230,70,40,3
Boxf 50,40,110,100,5
A ground strip, a circle, a box — drawn once, before the loop. This is the part to watch: after this, the program never draws to the bitmap again. Whatever's here stays exactly as it is.
Move only the sprite
While Joyb(0)=0
VWait
ShowSprite 0,x,72,0
x=x+dx
If x>304 Then dx=-dx
If x<0 Then dx=-dx
Wend
ShowSprite 0,x,72,0 places sprite 0 at position (x, 72) — the last number is the channel (the Amiga has eight, numbered 0 to 7). Each frame we change x and call ShowSprite again, and the sprite jumps to its new spot. Bounce it off the edges by flipping dx, and it glides back and forth. That's the entire moving part — no Cls, no Blit. The bitmap is never touched.
The chip does the moving
This is the thing to feel in your bones. With a blitted object you do real work every frame: clear the screen, draw the shape, manage two pages so it doesn't flicker. With a hardware sprite you do none of that. The sprite lives on its own layer that the display hardware overlays as it draws each line; moving it is one register write, and the picture underneath is never involved. That's why the backdrop in the video sits rock-still while the sprite roams over it.
That's also why AMOS keeps sprites at arm's length. AMOS gives you Bobs — blitter objects, the redraw-the-bitmap kind — because they're flexible and there can be hundreds. Hardware sprites are fewer (eight) and simpler (three colours), but they're free to move and they never disturb your artwork. Real Amiga games used both: sprites for the player's ship or a mouse pointer or a status bar that must never flicker, Bobs and the blitter for everything else. Knowing you have both — and reaching the sprites directly — is pure Blitz.
Type it and compile it
Type the program into Ted and press right-Amiga + X (recompile if Blitz asks about memory). The sprite glides over the still backdrop. Press fire — or reset — to stop.
Try this: more sprites at once
You have eight channels. Grab a second sprite (GetaSprite 1,0 reuses the same shape) and show it on another channel at a different height — ShowSprite 1,300-x,140,1 — so two objects cross in opposite directions, both for almost no work. Add a few more and you've a formation, none of them costing the bitmap a thing.
Try this: send it behind the scenery
By default sprites ride in front of the bitmap. InFront 2 flips that boundary: sprites on channel 2 and above drop behind the picture. Move your sprite to a high channel and add InFront 2, and it'll slide behind the box and circle instead of over them — the trick behind a character walking behind a pillar.
If it doesn't work
- The program drops back to the editor the moment it runs. The sprite's work bitmap must be depth 2 (
BitMap 2,16,16,2). A depth-3 source has too many colours for a hardware sprite and the program fails at run time. - No sprite appears. Check the slice is the full form that reserves sprite channels (
Slice 0,44,320,256,$fff8,3,8,8,...— the8is eight sprites), and thatGetaSpriteruns after the shape is grabbed. - The sprite is there but the wrong colours. Hardware sprites use their own small palette, separate from the bitmap's — three colours and transparent. Don't expect it to match your screen colours exactly; that's the sprite hardware, not a bug.
What you've learnt
The Amiga has two ways to move things: the blitter (stamp into the bitmap, clear and redraw) and hardware sprites (a separate layer the chips overlay for free). You make a sprite with GetaSprite from a depth-2 shape, then place it each frame with ShowSprite n,x,y,channel — eight channels, three colours plus transparent, no Cls and no Blit because the bitmap is never touched. InFront chooses front or behind. Sprites are the chip feature AMOS buries deepest, and reaching them directly — alongside the blitter you already know — is the Amiga programmer's real toolkit.
What's next
That's the last new idea. One unit remains, and it's a look back: The Blitz Way — what you've been learning all along, how Blitz compares with AMOS, and the genuine hit games that prove a BASIC can ship a classic.