Overview
DevCPC includes automatic conversion tools for graphics:- Sprites: PNG → ASM format for use in games
- Loading Screens: PNG → SCN format for full-screen images
devcpc build.
Sprite Conversion (PNG → ASM)
Configuration
Add to yourdevcpc.conf:
CPC Modes
| Mode | Colors | Pixels/byte | Bits/pixel | Resolution |
|---|---|---|---|---|
| 0 | 16 | 2 | 4 | 160x200 |
| 1 | 4 | 4 | 2 | 320x200 |
| 2 | 2 | 8 | 1 | 640x200 |
Directory Structure
Usage
- Searches recursively for PNG files
- Converts to CPC palette
- Generates ASM with sprite data
- Includes palette information
Build Output
Generated ASM Format
Using Sprites in Code
CPC Color Palette
The Amstrad CPC has 27 hardware colors (INK 0-26):Tolerance Settings
Tolerance controls how closely PNG colors must match the CPC palette:Transparency
Define an INK for transparent pixels (alpha=0):Loading Screen Conversion (PNG → SCN)
Configuration
Add to yourdevcpc.conf:
Screen Requirements
PNG files must match the CPC mode resolution:| Mode | Resolution | Colors | Use Case |
|---|---|---|---|
| 0 | 160×200 | 16 | Title screens, menus |
| 1 | 320×200 | 4 | High-res graphics |
| 2 | 640×200 | 2 | Text screens |
Directory Structure
Usage
Build Output
SCN Info Files
Each screen generates a.scn.info file with palette data:
Using Screens from BASIC
Using Screens from ASM
PNG Requirements
Sprite PNGs
Width constraints:- Mode 0: Multiple of 2 pixels (2, 4, 6, 8, 10, 12, 14, 16…)
- Mode 1: Multiple of 4 pixels (4, 8, 12, 16, 20…)
- Mode 2: Multiple of 8 pixels (8, 16, 24, 32…)
- Mode 0: Maximum 16 colors
- Mode 1: Maximum 4 colors
- Mode 2: Maximum 2 colors
Screen PNGs
Resolution (exact):- Mode 0: 160×200 pixels
- Mode 1: 320×200 pixels
- Mode 2: 640×200 pixels
Complete Example
Project Configuration
Create Graphics
Build and Test
BASIC Loader Example
Troubleshooting
Common Errors
“Pillow no instalado”- Mode 0: Width must be even (2, 4, 6…)
- Mode 1: Width must be ×4 (4, 8, 12…)
- Mode 2: Width must be ×8 (8, 16, 24…)
- Reduce colors in your PNG
- Use a mode with more colors
- Mode 0 = 16, Mode 1 = 4, Mode 2 = 2
- Increase tolerance:
SPRITES_TOLERANCE=16 - Use automatic:
SPRITES_TOLERANCE=-1 - Adjust PNG colors to CPC palette
- Mode 0: Must be exactly 160×200
- Mode 1: Must be exactly 320×200
- Mode 2: Must be exactly 640×200
Best Practices
- Use CPC colors - Design with the 27-color palette
- Test tolerance - Start with 8, adjust if needed
- Organize sprites - Use subdirectories for categories
- Check .info files - Verify palettes before coding
- Validate early - Run
devcpc buildfrequently
Sprites vs Screens Comparison
| Feature | Sprites (ASM) | Screens (SCN) |
|---|---|---|
| Format | ASM source code | Binary data |
| Size | Variable | 16KB (fixed) |
| Usage | Game graphics | Full screens |
| Load address | Any | 0xC000 only |
| Included in | Compiled binary | DSK as file |
| PNG size | Any width (aligned) | Exact resolution |
| Output | One ASM file | Multiple SCN files |
See Also
- Creating Projects - Set up asset directories
- Compiling Code - Build process details
- Disk Images - How files are added to DSK