Skip to content
Game 0 Unit 2 of 15 1 hr learning time

Amiga Mode and Blitz Mode

Blitz can run your program two ways. Amiga mode plays nicely with the operating system — windows, the mouse pointer, multitasking. Blitz mode switches all that off and hands your program the whole machine, for graphics that run flat out. Knowing which mode you're in is the key to everything fast.

13% of Meet Blitz

Your first program ran in a tidy little window on the Workbench screen, with the mouse pointer still there and the operating system humming along beside it. That's Amiga mode — Blitz cooperating with the OS. But a game doesn't want to share the machine; it wants all of it. So Blitz has a second gear: Blitz mode, where it switches the operating system off and your program takes over the entire Amiga — every scanline, every cycle. This is the single most important idea in the language, because everything fast lives in Blitz mode.

What you'll see by the end

A filled pink rectangle and a purple circle outline on a black full-screen display.
A box and a circle, drawn on a display your program owns outright. No window, no Workbench — in Blitz mode, the whole screen is yours.

A filled box and a circle on a black screen. The contrast with unit 1 is the whole point: that was text in a window; this is graphics on a display your program took over completely. The operating system has stepped aside.

The whole program

; Blitz mode takes over the whole machine for full-speed graphics.
BLITZ
  BitMap 0,320,256,3
  Cls 0
  Boxf 40,50,200,160,2
  Circle 240,110,55,5
  VWait 100
  Slice 0,44,3
  Show 0
  MouseWait

The first word does the big thing; the rest builds a picture and puts it on screen.

  • BLITZ switches into Blitz mode. From here on, the operating system is off — no Workbench, no multitasking, no mouse pointer. Your program has the machine to itself. (Its partners are Amiga, which hands control back to the OS, and QAmiga, which slips back briefly without disturbing the display.)
  • BitMap 0,320,256,3 makes a bitmap — a block of drawing memory, numbered 0, 320×256 pixels, 3 bitplanes (which gives 8 colours). A bitmap is just a canvas in memory; nothing is shown yet.
  • Cls 0 clears that canvas to colour 0 (black), so we start clean.
  • Boxf draws a filled box and Circle an outline, in colours from Blitz's starting palette. They're drawn onto the bitmap, still off-screen.
  • VWait 100 waits about two seconds for the display to settle — a safety habit before showing a Blitz-mode display.
  • Slice 0,44,3 creates a slice — Blitz's description of a region of the screen. This one starts near the top (scanline 44) and is 3 bitplanes deep, matching the bitmap.
  • Show 0 displays bitmap 0 in that slice. Now the picture appears.
  • MouseWait holds it until you click.

So the shape of a Blitz-mode display is: make a bitmap, draw on it, make a slice, show the bitmap in the slice. You'll meet slices properly later; for now, that four-step rhythm is all you need.

Bitmaps and slices

Two new words worth pinning down, because the rest of the course leans on them:

  • A bitmap is where you draw — a canvas in memory. It isn't on screen until you show it. You can have several, and draw on one while another is displayed (that's how smooth animation works, later).
  • A slice is what the screen shows — a description of a display region: how tall, how many colours, where it sits. Showing a bitmap in a slice is what makes it visible.

Keeping "the canvas" and "the display" separate is exactly what lets Blitz do its fast tricks — and it's the heart of Blitz mode.

The trade: speed for the OS

Why switch the operating system off at all? Because the OS, for all its cleverness, gets in the way of raw speed. In Blitz mode there's no multitasking stealing cycles, no Intuition managing windows — just your code and the hardware. The cost is real: while you're in Blitz mode you can't use the OS's services (opening windows, reading files), and a Blitz-mode program that misbehaves can lock the machine. That's the bargain every Amiga game struck: give up the safety net, gain the speed. Blitz lets you make that trade with a single word.

Type it and compile it

Type the program into Ted and press right-Amiga + X. (The first time you compile a program that uses graphics, Blitz may ask about memory — choose to recompile, and it'll size things to fit.) The screen switches to your Blitz-mode display. Click the mouse to return to the editor — and notice the Workbench come straight back, exactly as it was. Blitz mode is a borrowed machine, returned when you're done.

Try this: more colours

Change the 3 in BitMap 0,320,256,3 and the 3 in Slice 0,44,3 to 5. That's 5 bitplanes — 32 colours instead of 8. Now change Circle 240,110,55,5 to use a higher colour number like Circle 240,110,55,20. More bitplanes, more colours to draw with — at the cost of more memory and a little speed. The two numbers must match: the slice has to be as deep as the bitmap it shows.

Try this: hand the machine back

Add Amiga on its own line just before MouseWait. Run it: the display flicks back to Workbench before the wait, because Amiga returned control to the OS. It shows the switch is yours to make in either direction — into Blitz mode for speed, back to Amiga mode when you want the OS again.

If it doesn't work

  • Blitz asks about object memory every time. That's normal on a fresh setup — a program that makes bitmaps and slices needs memory set aside for them. Choose the recompile option; it sizes memory to fit and runs.
  • The screen shows junk below your drawing. The bitmap is shorter than the slice. Match them — a 256-tall bitmap for a full PAL slice — and Cls it first so it starts clean.
  • Nothing appears, or the machine locks. Check the order: BitMap and your drawing first, then Slice, then Show. And the slice's bitplane count must match the bitmap's.

What you've learnt

Blitz runs in two modes. Amiga mode cooperates with the operating system — windows, mouse, multitasking. BLITZ mode switches the OS off and gives your program the whole machine, for full-speed graphics; Amiga and QAmiga hand control back. A Blitz-mode display is built from a bitmap (the canvas you draw on, made with BitMap) shown through a Slice (the screen region) with Show. The trade is speed for the safety of the OS — the bargain every Amiga game made.

What's next

You've drawn in colours from Blitz's starting palette, and stored sizes as plain numbers. Next — Variables and Blitz's Types — you'll meet something AMOS hides from you: Blitz lets you choose how big each number is, because it's working much closer to the machine.