The Amstrad CPC’s video hardware offers three distinct screen modes, each trading color depth for horizontal pixel resolution. Webtile models this directly: every sprite has aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/johnlobo/webtile/llms.txt
Use this file to discover all available pages before exploring further.
videoMode field (0, 1, or 2) that controls how many ink slots are available, how pixels are sized on the editing canvas, and how frames are encoded into CPC hardware bytes when you export. Choosing the right mode at the start of a project is essential, because pixel encoding — and therefore the byte output — changes fundamentally between modes.
Mode Overview
| Mode | Colors | Pixels / byte | Canvas pixel width | Use case |
|---|---|---|---|---|
| 0 | 16 | 2 | 16 screen px (base) | Rich color sprites with wide pixels |
| 1 | 4 | 4 | 8 screen px (base) | Balanced color and horizontal resolution |
| 2 | 2 | 8 | 4 screen px (base) | High-resolution monochrome or 1-bit art |
Mode 0 — 16 Colors, 2 Pixels per Byte
Mode 0 gives the widest color palette (16 simultaneous hardware colors) at the cost of horizontal resolution. Each byte encodes exactly 2 CPC pixels using interleaved bit planes:W pixels wide produces W / 2 bytes per row.
Typical use: Character sprites, bosses, and other art where rich color is more important than fine horizontal detail.
Mode 1 — 4 Colors, 4 Pixels per Byte
Mode 1 doubles the horizontal pixel density of Mode 0, fitting 4 CPC pixels into each byte through a different bit-plane interleaving scheme:W pixels wide produces W / 4 bytes per row.
Typical use: Platformer tiles, UI elements, and other art where a 4-color restriction is acceptable in exchange for sharper horizontal edges.
Mode 2 — 2 Colors, 8 Pixels per Byte
Mode 2 packs 8 CPC pixels into each byte using a simple 1-bit scheme — no interleaving needed:W pixels wide produces W / 8 bytes per row.
Typical use: Text glyphs, monochrome icons, high-resolution line art, and anything targeting the full 640-pixel-wide Mode 2 screen.
Ink Index 0 and Transparency
Ink index 0 is always transparent in all video modes. It is never painted to the screen during byte export — the mask byte (when mask interleaving is enabled) marks those pixel positions as transparent so the background shows through. In the editor, ink 0 is rendered as the dark checkerboard background rather than a solid color.You cannot assign a visible color to ink 0 for export purposes. It is permanently the transparent ink. If you need a true black or background-colored pixel that is not transparent, use ink 1 or higher and assign it the desired CPC hardware color.
Palette
Each sprite stores apalette array of CPC hardware color indices — one entry per ink slot. The 27 CPC hardware colors are shared across all modes; what changes is how many palette slots are available:
- Mode 0: 16 ink slots (indices 0–15)
- Mode 1: 4 ink slots (indices 0–3)
- Mode 2: 2 ink slots (indices 0–1)
spriteService.js pre-populates the palette from DEFAULT_PALETTES, which provides a sensible starting set of CPC color indices for each mode:
Byte-Format Export
The EXPORT button opens the Export modal, which encodes all frames to CPC hardware bytes based onvideoMode. Two additional encoding options are available:
Mask Interleaving
When WITH MASK is enabled, a mask byte is inserted before each sprite byte in every row. In the mask byte, bits corresponding to transparent pixels (ink 0) are set to1; opaque pixel bits are 0. The resulting interleaved layout per row is:
AND with the mask to punch a hole, then OR with the sprite data to paint the sprite.
CPC Scanline-Interleaved Row Ordering
When INTERLEAVED is enabled, rows are re-ordered to match the non-linear CPC screen memory layout. The CPC screen is organised as 25 character rows of 8 scanlines each; consecutive scanlines within a character row are offset by 2048 bytes, while consecutive character rows are offset by 80 bytes. The export reorders sprite rows to match this layout so the data can beLDIR-copied directly into screen RAM without runtime reordering.
Output Formats
Three output formats are available in the Export modal:| Format | Description |
|---|---|
| HEX | Z80 assembler .db directives with #XX hex literals |
| DEC | Z80 assembler .db directives with decimal values |
| BASIC DATA | Locomotive BASIC DATA lines with decimal values |
The video mode is fixed at sprite creation time. To change a sprite’s mode, create a new sprite with the desired mode and re-import or re-paint the art. The Properties modal does not expose a mode-change option because it would invalidate all existing pixel data and byte widths.
Setting the Video Mode
The video mode is selected when you create a new sprite. In the SPRITES → New dialog you choose Mode 0, 1, or 2 along with the sprite’s pixel dimensions. For PNG imports via SPRITES → Import PNG, theImportSpriteModal lets you pick the video mode before confirming, and the width is automatically snapped to the nearest valid multiple for that mode (2 for Mode 0, 4 for Mode 1, 8 for Mode 2).