Amstrad 6 min read

Building a Retro Sprite Engine on the Amstrad CPC

The Amstrad CPC was never designed to compete with dedicated arcade hardware, yet developers managed to create impressive games by pushing the machine’s limits. In this article, we explore how to build a simple sprite engine using BASIC and Z80 assembly concepts, recreating the techniques used by 1980s programmers to move characters, handle collisions, and bring classic games to life.

Admin
Admin
.NET & IoT Developer
Building a Retro Sprite Engine on the Amstrad CPC

The Amstrad CPC holds a special place in the history of home computing. Released in the mid-1980s, it offered impressive graphics and sound compared with many of its competitors. While machines such as the Commodore 64 and ZX Spectrum had larger software libraries, the CPC provided developers with a powerful combination of a Zilog Z80 processor, Motorola 6845 graphics controller, and flexible colour modes.

Modern developers are used to powerful graphics engines handling sprites, animation, collision detection, and rendering automatically. On the Amstrad CPC, programmers had to build these systems themselves. Every byte of memory and every processor cycle mattered.

Creating a sprite engine on the CPC is a great way to understand how early game developers worked and how the foundations of modern game programming were created.

What Is a Sprite Engine?

A sprite engine is a collection of routines that allow a game to display and control moving objects on screen. These objects might be the player's character, enemies, bullets, explosions, or power-ups.

A typical sprite engine needs to handle several important tasks:

Displaying graphics on screen.

Moving sprites smoothly.

Erasing old sprite positions.

Detecting collisions.

Managing animation frames.

Updating multiple objects efficiently.

On modern systems, these tasks are usually handled by graphics libraries or game engines. On the Amstrad CPC, the programmer was responsible for every part.

Understanding Amstrad CPC Graphics

The CPC464 included three main graphics modes.

Mode 0 provided 160 pixels across the screen with 16 colours. This mode was popular for arcade-style games because the larger pixels allowed more colours.

Mode 1 provided 320 pixels across the screen with 4 colours and was commonly used for adventure games and utilities.

Mode 2 provided 640 pixels across the screen with only 2 colours and was mainly used for text and high-resolution graphics.

Most action games used Mode 0 because the colourful graphics suited arcade gameplay.

A sprite in Mode 0 is usually created as a collection of pixels stored in memory. The sprite data can then be copied into video memory when required.

Creating Your First Sprite

A simple sprite might be stored as a series of bytes representing the pixels that make up the character.

For example, a small spaceship sprite could be stored like this:


11111111
00111100
01111110
11111111
11011011

Each row represents part of the image. The game engine reads this data and draws it onto the screen.

In BASIC, this can be achieved using commands such as SYMBOL to create simple graphics characters, but for faster games developers usually moved to machine code.

Why Use Z80 Assembly?

The CPC464 runs at approximately 4MHz, which sounds extremely slow compared with modern computers. However, the Z80 processor is very efficient when programmed directly.

Assembly language gives developers complete control over:

Memory access.

Processor registers.

Screen calculations.

Timing.

Graphics routines.

A sprite routine written in assembly can move objects much faster than equivalent BASIC code.

This is why many commercial CPC games used a mixture of BASIC for menus and game logic, combined with machine code routines for graphics and sound.

Drawing Sprites Efficiently

One of the biggest challenges is updating the screen without causing flickering.

A simple method is:

Draw the sprite at its new location.

Restore the background where the sprite used to be.

Repeat every frame.

However, constantly redrawing large areas of the screen uses valuable processor time.

More advanced sprite engines use techniques such as:

Background buffering.

Hardware-assisted scrolling.

Dirty rectangle updates.

Pre-shifted sprites.

These techniques allowed programmers to create smoother movement despite limited hardware.

Handling Sprite Movement

A sprite needs a position stored somewhere in memory.

For example:


Sprite X Position = 100
Sprite Y Position = 80

When the player presses a joystick direction, the engine changes these values.

Moving right:


X = X + 1

Moving left:


X = X - 1

The sprite routine then redraws the character in the new location.

Although this sounds simple, creating smooth movement required careful timing because the CPC screen was constantly being refreshed.

Collision Detection

Collision detection determines whether two objects have touched.

For example:

A spaceship hits an alien.

A player collects a bonus item.

A bullet hits an enemy.

The simplest method is bounding box collision detection.

Each sprite has an invisible rectangle around it. If two rectangles overlap, a collision has occurred.

More advanced games used pixel-perfect collision detection, but this required more processing power.

Building a Simple Game Engine

Once a sprite system exists, it becomes the foundation for a complete game.

The main game loop normally follows this pattern:

Read player input.

Update object positions.

Check collisions.

Draw sprites.

Update the score.

Repeat.

This same structure is still used today in modern game development.

The difference is that modern engines hide much of this complexity, while CPC programmers had to create everything themselves.

Learning From 1980s Developers

Building a sprite engine on the Amstrad CPC is more than a programming exercise. It provides an insight into the creativity and skill of early game developers.

With only 64KB of memory and a modest processor, programmers created classics such as platform games, shooters, and adventures that are still remembered today.

Understanding these techniques helps modern developers appreciate how much computing has changed and how clever programming can overcome hardware limitations.

Bringing Retro Techniques Into Modern Development

Many modern programming concepts started on machines like the Amstrad CPC.

Game loops.

Object management.

Memory optimisation.

Animation systems.

Collision handling.

Learning how these systems were created manually provides valuable knowledge for anyone interested in game development.

The limitations of retro hardware forced developers to write efficient, elegant code. Those lessons are still relevant today.

Conclusion

Creating a sprite engine for the Amstrad CPC is a fantastic way to explore the foundations of game programming. Whether using BASIC, Z80 assembly, or modern tools that target retro hardware, the process reveals the clever techniques that powered the golden age of home computing.

The CPC may now be considered vintage hardware, but the programming lessons it teaches remain timeless. Building something from scratch on an 8-bit machine is not only challenging; it is also a great reminder of why many people fell in love with computers in the first place.

Share:

Become a member

Get the latest news right in your inbox. It's free and you can unsubscribe at any time. We hate spam as much as we do, so we never spam!

Read next

BASIC vs Assembly on the Amstrad: When to Switch

Every Amstrad CPC programmer starts with BASIC, but sooner or later performance becomes a limitation. Whether you're writing games, demos or utilities, knowing when to move to Assembly can make a huge difference. In this article we'll explore the strengths of both languages, when BASIC is enough, and when Assembly is worth learning.

Admin 28-Jun-2026

The Bedroom Coder — retro computers, modern .NET, and late-night experiments.

Navigation

Contact

Want to talk retro tech or modern coding? I'd love to hear your thoughts.

© 2026 The Bedroom Coder. All rights reserved.