Home > Books > Amstrad CPC > User Defined Graphics (UDG) Definer

Online User Defined Graphics (UDG) Definer for Amstrad CPC, ZX Spectrum, and other 8-bit computers

A common feature in home computers of the 1980s was the ability to redesign the character set in BASIC with new symbols. User Defined Graphics (UDGs), as they were known, could be used to restyle the text or more commonly to create images that could be used in games and other BASIC programs.

My online User Defined Graphics (UDG) generator enables you to design your symbols, and then gives you the numbers you need to use them in your BASIC listing. This software was originally part of my Amstrad BASIC programming tutorial, The BASIC Idea, but the data it generates works equally well for other platforms, including the ZX Spectrum and BBC Micro. See below for instructions.

Click the game window to activate it, and then use the cursor keys to use it.

How to use the User Defined Graphics (UDG) Definer

The character set is made up of symbols (letters, numbers, punctuation, and other symbols). Each one is designed on a grid of 8 by 8 pixels. Here are the first four capital letters, as shown in the Amstrad CPC6128 user manual:

Images of the letters A, B, C, and D, each drawn on an 8x8 grid of pixels.

You'll notice that they left the right-most column and the bottom row of pixels empty. That means when the characters are displayed next to each other on the screen, there's a one pixel gap between the letters so you can read them clearly.

To define your own shape, you draw it on a grid like this. You then need to convert that shape into data. You do that by looking at each row in turn. Each column has a number. Starting at the right they are valued at 1, 2, 4, 8, 16, 32, 64, 128. You add up the values of the columns that are filled in for that row. At the end you have eight numbers, one for each row. You can then use those numbers to redefine one of the characters.

My UDG Definer program does the maths for you. Use the cursor keys and space bar to design your character on the grid. The totals for each row are shown on the right in real time.

How to redefine characters on the Amstrad CPC computers

Here's the code to redefine symbol 220 and display it in Amstrad CPC BASIC. You use the SYMBOL AFTER command once to set aside memory for the symbols you want to redefine.

SYMBOL AFTER 220
SYMBOL 220,60,90,219,255,189,195,102,60
PRINT CHR$(220)

screenshot of my redefined character set, DatarunUsing SYMBOL AFTER 220, you can redefine characters 220 to 255 (the last one). You can redefine characters above 240 without using the SYMBOL AFTER command. Using SYMBOL AFTER means you can redefine the entire character set if you want, including the normal text font. The screenshot here shows an incredibly 1980s font I designed, which you can find on my Amstrad software disc.

Find out more about how you can use UDGs and the built-in characters in Amstrad CPC BASIC.

How to redefine characters on the ZX Spectrum computers

I try to test everything on this site, but I haven't been able to test this ZX Spectrum code. Please let me know if you encounter any problems, or equally if it works fine for you. I'll remove this notice when someone confirms it works. Thank you.

On the ZX Spectrum, you redefine characters by poking the row values from the UDG Definer into memory. To find the memory locations to poke, you use USR to find where a particular character is stored. Here's an example that redefines the shape of the A character:

POKE USR "A",60
POKE USR "A"+1,90
POKE USR "A"+2,219
POKE USR "A"+3,255
POKE USR "A"+4,189
POKE USR "A"+5,195
POKE USR "A"+6,102
POKE USR "A"+7,60
PRINT "A"

There are, of course, more elegant ways to achieve this. You could use a loop to READ a DATA statement and then poke it into memory:

10 READ a$
20 FOR b=0 TO 7
30 READ c
40 POKE USR a$+b,c
50 NEXT b
60 PRINT "A"
70 DATA "A",60,90,219,255,189,195,102,60

That program could be shortened by combining multiple statements onto one line.

How to redefine characters in BBC BASIC

In BBC BASIC, you use a VDU 23 instruction to redefine a character. You follow VDU 23 with the character number you want to redefine, and then the list of row data generated by the UDG Definer above.

This code shows how to redefine character 220:

VDU 23,220,60,90,219,255,189,195,102,60
PRINT CHR$(220)

Load another game into the emulator

Amstrad disc You can download my Amstrad CPC games and utilities disc to use these programs in your favourite emulator.

Where next?

Credits

© Sean McManus. All rights reserved.

Visit www.sean.co.uk for free chapters from Sean's coding books (including Mission Python, Scratch Programming in Easy Steps and Coder Academy) and more!

Discover my latest books

Coding Compendium

Coding Compendium

A free 100-page ebook collecting my projects and tutorials for Raspberry Pi, micro:bit, Scratch and Python. Simply join my newsletter to download it.

Web Design in Easy Steps

Web Design IES

Web Design in Easy Steps, now in its 7th Edition, shows you how to make effective websites that work on any device.

100 Top Tips: Microsoft Excel

100 Top Tips: Microsoft Excel

Power up your Microsoft Excel skills with this powerful pocket-sized book of tips that will save you time and help you learn more from your spreadsheets.

Scratch Programming in Easy Steps

Scratch Programming IES

This book, now fully updated for Scratch 3, will take you from the basics of the Scratch language into the depths of its more advanced features. A great way to start programming.

Mission Python book

Mission Python

Code a space adventure game in this Python programming book published by No Starch Press.

Cool Scratch Projects in Easy Steps book

Cool Scratch Projects in Easy Steps

Discover how to make 3D games, create mazes, build a drum machine, make a game with cartoon animals and more!

Walking astronaut from Mission Python book Top | Search | Help | Privacy | Access Keys | Contact me
Home | Newsletter | Blog | Copywriting Services | Books | Free book chapters | Articles | Music | Photos | Games | Shop | About