Amiga blitter lab
Work out Amiga blitter set-ups: minterms from a truth table, Venn diagram or Boolean expression (and LF back to the shortest expression), cookie-cut, masked, XOR, clear, rectangle and area-fill blits stepped word by word with shifts, masks and modulos, line mode with octants and the Bresenham registers, the DMA cost, and the register set-up as C or assembler.
Added
Works with
- Amiga custom chip registers Retro computingdecodes each register value the blit writes
How to use it
Three tabs, one for each thing the blitter does.
Minterms — type the function of the sources as an expression (AB + aC, A^C,
A&~B | C; lower case means NOT, letters side by side mean AND, + means OR), type an LF byte,
click the D column of the truth table, or tap regions of the Venn diagram. You get the LF byte
for BLTCON0, the shortest sum of products, every minterm, and what the common ones are for
($CA cookie-cut, $5A XOR, $FA OR, $0A erase through a mask …).
Area blit — pick a preset and the lab sets up a real blit in a small model of chip RAM: a 32 × 24 shape and its mask, and a 96 × 32 destination plane (6 words per row).
-
Copy A → D, Cookie-cut (BOB) (A = mask, B = shape, C = background, D =
AB + aC), Masked copy (AB, no C read), XOR (A ⊕ C), Clear (D only, LF = 0), Rectangle with masks (A off, BLTADAT =$FFFF, BLTAFWM/BLTALWM trim the edges), and Area fill (descending, inclusive or exclusive, with fill carry in) on an outline drawn with line mode. -
Set x and y (or tap the destination) and the shift, masks, pointers and modulos follow: a shifted shape becomes one word wider, its source modulo −2 and BLTALWM
$0000, which is the standard way to blit a BOB stored without a spare word. Override the minterm, or tick DESC to see what descending mode does. -
Step through the blit word by word (◀ ▶, Play, or the slider). Coloured boxes show the word each channel reads and the word D writes; This word shows A as read, after the first/last word mask and after the shift, B before and after its shift, C, the minterm’s result, the fill carry, and where it is written.
-
Registers lists BLTCON0, BLTCON1, BLTAFWM/ALWM, every pointer and modulo (or the BLTxDAT constant for a channel that is off) and BLTSIZE; register names open the register reference with the value decoded.
-
DMA cost uses the HRM’s blitter speed rule — 4 ticks per word, 2 more with B, 2 more when both C and D are on (a tick is one 7.09 MHz PAL / 7.16 MHz NTSC clock; two ticks are a memory cycle) — as time and as a share of a frame.
Line mode — set the end points (or tap the plane twice) and choose normal ($CA) or XOR
($4A) drawing, a texture pattern and its start bit, and SING (one dot per line, for outlines you
will fill). The octant is shown on the HRM’s figure with its BLTCON1 code bits, and the registers
follow the HRM’s register summary for line mode: BLTAPTL = 4·dy − 2·dx (SIGN if negative),
BLTAMOD = 4·(dy − dx), BLTBMOD = 4·dy, BLTCMOD = BLTDMOD = the plane width, BLTSIZE =
(dx + 1) << 6 | 2, BLTADAT = $8000. Step through the pixels to watch the error term: when it
is not negative the blitter takes a diagonal step and adds BLTAMOD, otherwise a straight one and
adds BLTBMOD. Each pixel costs 8 ticks.
Both blit tabs export the set-up as C (custom.bltcon0 = … between OwnBlitter() /
WaitBlit()) or as assembler with the BBUSY wait loop, BLTSIZE last because writing it starts
the blit.
⛶ Full screen (or F) gives the planes the whole screen with the step controls above them —
the browser’s full screen where it is allowed, otherwise a full-window layer (iPhone); the
picture is redrawn as the window changes, and ◫ Panels hides the registers and export. Escape
leaves.
Notes
-
Bit n of LF is the output for the source combination 4A + 2B + C = n, so A alone is
$F0, B$CC, C$AA, and any function is built from them with AND, OR and NOT —AB + aC= ($F0&$CC) | (~$F0&$AA) =$CA. -
The barrel shifters carry the bits shifted out of one word into the next, including from the last word of a row into the first of the next row. The masks apply to A before it is shifted: BLTAFWM to the first word of every row, BLTALWM to the last (both when the blit is one word wide).
-
In descending mode the pointers start at the last word and go down, the modulos are subtracted, and the shifts go left. Area fill only works descending: each row is scanned right to left from bit 0, every set bit toggles the fill, and FCI sets the state at the start of each row. Inclusive fill keeps both edges; exclusive fill keeps only the first (right) one.
-
BLTSIZE holds the height in bits 15–6 (0 = 1,024) and the width in words in bits 5–0 (0 = 64); writing it starts the blit. ECS adds BLTSIZV/BLTSIZH for larger blits.
Sources: Amiga Hardware Reference Manual, 3rd edition (Commodore-Amiga / Addison-Wesley, 1991), chapter 6 "Blitter Hardware" — minterm selection, shifts and masks, descending mode, area fill, line mode (Figure 6-8, Table 6-3 and the register summary) and "Blitter Speed".
Limits
-
The cycle cost is the HRM’s best case: it leaves out set-up time and does not model the slots bitplane, sprite, copper and CPU DMA take — see DMA slot timing for those.
-
Line-mode texture is modelled as one bit of BLTBDAT per pixel, most significant first from the start bit; the exact texture phase of real chips, and the blitter’s quirks with very short lines, are not modelled. Pointers are shown relative to the planes in the model.
-
Descending mode with a shift is shown exactly as the hardware would do it, which moves the picture; the presets only use it for fill.
Related: copper and blitter playground (draw your own A/B/C bitmaps), Amiga registers, sprites and BOBs, DMA slot timing, 68000 cycle counter, 68000 disassembler.
Linking to an example
Share link copies the open tab with its settings. Parameters can also be written by hand:
| Parameter | Meaning |
|---|---|
|
minterm expression (Minterms tab), e.g. |
|
area preset: |
|
where the shape (or rectangle) goes, in pixels and lines |
|
descending mode, minterm override (LF number), |
|
line end points (Line mode tab) |
|
XOR line, one dot per line, texture word (number), texture start bit |
|
|
|
a preset below |
Examples: cookie-cut BOB at x = 21,
rectangle with first/last word masks,
exclusive area fill,
dashed XOR line,
SING line for fills,
XOR minterm. Other presets: cookie-aligned,
copy, masked, xor, clear, fill, line, line-steep.
Feedback is a gift. Something to improve, a feature to add, or a bug? Tell me.
Runs entirely in your browser; nothing you type leaves this page.