What you’ll see by the end

Your greeting used an output window supplied through AmigaOS, the operating system. This program uses Blitz mode to control a display through Blitz’s own graphics commands. The important difference is which services are available while each part runs.
The whole program
; Let disk activity finish before entering Blitz mode.
VWait 100
BLITZ
BitMap 0,320,256,3
Cls 0
Boxf 40,50,200,160,2
Circle 240,110,55,5
Slice 0,44,3
Show 0
MouseWaitThe display has two parts: a bitmap, the memory you draw into, and a slice, which describes how that bitmap is shown.
VWait 100waits 100 display frames before entering Blitz mode: about two seconds on the PAL setup. Let disk activity finish before continuing; a delay alone cannot prove a drive has finished.BLITZenters Blitz mode. Normal OS multitasking is suspended, so commands that need OS services, such as opening a window or reading a file, are unavailable here.BitMap 0,320,256,3makes bitmap 0, 320×256 pixels with 3 bitplanes, allowing 8 colour indices. It supplies drawing memory; it does not show that memory on screen yet.Cls 0clears the bitmap to colour index 0.Boxfdraws a filled box andCirclean outline into that bitmap.Slice 0,44,3sets up slice 0 starting at display line 44, with three bitplanes to match the bitmap.Show 0shows bitmap 0 in the slice.MouseWaitwaits for a left mouse click.
The drawing order is make a bitmap → draw into it → make a slice → show the bitmap. You can have drawing memory without a visible picture.
Choosing a mode
In Amiga mode, your program cooperates with AmigaOS and can use its windows and file services. In Blitz mode, it uses Blitz’s display facilities while normal multitasking is suspended. That changes access to the machine; it is not a measured speed increase for every operation, or a requirement for every Amiga game.
Amiga restores normal Amiga mode and its display. QAmiga returns to Amiga mode while retaining the Blitz display, for work such as file access before re-entering Blitz mode. These commands also tell the compiler which mode’s commands are allowed in the following source.
The Blitz BASIC 2.1 manual, chapter 7, pp. 47–51, explains the mode switch and disk-access precautions. Do not enter Blitz mode while disk activity is in progress. Suspending the OS is not a memory-protection switch: an erroneous program can still damage data or hang the machine.
Load and compile it
Use the first lesson’s plain-text import procedure with a new file called blitzmode.ab3. Keep its three-line RuntimeDebug = 0 settings header, and put this lesson’s listing below it. Load the file into PED. Wait for disk activity to finish, then choose Compiler → Compile & Run, or press right-Amiga+#.
Check that the box and circle both appear. Left-click to finish MouseWait. If AmiBlitz shows its termination prompt, press Return to restore PED.
Try this: move the drawing
Before changing anything, predict which shape will move if you change Circle 240,110,55,5 to Circle 260,110,55,5. Change that one line in PED and compile again. The circle’s centre should move 20 pixels to the right; the box should stay put. The bitmap size and slice have not changed.
Try this: hand the machine back
Add Amiga on its own line just before MouseWait, then compile and run. This returns to the OS display before the wait. Explain why the drawing can still exist in bitmap memory even though you are no longer looking at its Blitz display.
If it doesn’t work
- A compile error says a command is only available in Amiga mode. Check which mode precedes it. Window and file commands need the OS; do that work in Amiga mode.
- No complete picture appears. Compare the listing’s order and dimensions. Check
Show 0, that the bitmap is 320×256, and that both bitmap and slice use three bitplanes. - PED cuts a line instead of compiling. Use Compiler → Compile & Run or right-Amiga+#. Right-Amiga+X is PED’s cut command.
- A requester reports an object limit. Note the exact message and affected object. Do not assume every memory error can be fixed by recompiling; the setup and compiler’s object limits both matter.
What you’ve learnt
A bitmap stores the picture; a slice describes its Blitz-mode display. BLITZ suspends normal OS multitasking, while Amiga and QAmiga restore OS access with different display behaviour. Choose the mode for the services the program needs.
What’s next
You used numbers to place shapes. Next — Variables and Blitz’s Types — choose how a program stores numbers, and explore what happens when a value does not fit.