Pcg Designer|The Amstrad User)Applications Creation Graphique
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

We have received many character redefining programs in the past but most of them were the same so did not get published.

This one is different, in that the output is saved to disc as a Basic program to be later incorporated into a main program.

Have you ever played a game, such as Roland In Time, and taken a close look at some of the animated characters that move around the screen at great speed. These, as you might already know, are achieved by re-defining a character from the ASCII code to make it appear as something different.

When I redefine a character, I find it is easier to draw up a few eight by eight squares on graph paper. The reason the square is eight by eight is because each character is built up of 64 tiny squares called pixels. The pixel lengths vary depending on which Mode you are in at the time. For example in Mode 0 the pixels are twice the length as they are in Mode 1, and in Mode 2 they are half the size as they are in Mode 1. This gives the effect of 'fat' letters in Mode 0, 'square' letters in Mode 1 and 'skinny' letters in Mode 2.

After ruling up your squares you can start to draw in your picture. Take a look at Fig 1.1 and you will notice I have already drawn a picture of a tractor, which appears at the start of the program accompanying this article.

As you can see some squares are filled and some are not, this is because the filled squares are the ones I want to be able to see and display and the ones left blank will show nothing.

So how do we go about making our pretty picture show up on the screen? To answer this question you must be familiar with the use of binary numbers. Now this all sounds very complicated but is very easy when you know how. The method has been explained in previous issues of The Amstrad User, but it will do no harm to take another look.

Unlike our daily decimal number system (1 to 9), binary numbers consist of just two numbers, these are "0" and "1".

How can we use binary numbers to re-define characters ? This is a very simple process but to accomplish it you have to understand the structure as shown in the following table:

As you can see it is a typical 8*8 grid except it has a few numbers up the top. It also has a few filled squares on each line. For each line across, a string of binary numbers (1's and 0's) are used to identify which squares are filled (the l's) and which are not (the 0's). The position of the l's determines the value they take from the top of the grid. So, to turn a binary number into a decimal number it is important that you know the eight values on the top row of the grid. As they never change, it is easy to remember.

Let me give you an example. We'll take the binary number 10110011 and turn it into a decimal number. There are two ways we can tackle this problem, we can either use the computer to work it out or solve it mathematically.

Using the computer type the following:

PRINT &X10110011 (ENTER)

The screen should look like this:

PRINT &X10110011



To solve this problem mathematically we first have to break the number up into eight separate numbers: 1,0,1,1,00,1,1.

By referring back to the grid we can see that if the first number from the right is a "1" it is equivalent to the value 128, if it was a "0" it would have a value of zero. Added onto this number is the value of the next number which happens to be a zero. If this number was a "1" it would have the value of 64. Can you see the pattern that is being used? After adding all the eight values you will come up with the value 179. This means that the number 179 is equal to the binary number of 10110011.

This sti'J doesn't explain how binary numbers can be used to redefine characters. Take another look at the tractor in Fig 1.1. again. The middle three 8*8 grids are the same as in Fig 1.3.

In the first square what is the binary number for the top line? If your answer came out to be 00000001 then you were correct. Next look at the other numbers in turn and write down their decimal equivalent.

When you have finished you should have a list of eight numbers looking like this:

Binary Decimal
Line 1-00000001 1
Line 2-00000000 0
Line3-00111111 63
Line4-01111111 127
Line5-01100000 96
Line6-01111111 127
Line7-01111101 125
Line8-01001111 79

If you take a close look at the above set of binary numbers, espacially the 1's, they form similar pattern to the picture in the first square in the second row. By changing these binary numbers into decimal numbers the computer will know what the shape will look like, and to do this we use the SYMBOL command.

When using the symbol command we do net worry about using the binary numbers but we use their decimal equivalent. Page 79 chapter 3 in the Instruction Manual tells you what each parameter in the symbol command docs, so when using the command it should look like this:

SYMBOL 65,1,0,63,127,96,127, 125,79 (enter)

NOTE: In this example, the number 65 means character 65, which is the letter A.

When you execute the above line you would have re-defined that letter. Press the key marked A and try it, but remember it must be an upper case A.

This is all very fine so how does P.C.G. Designer help me? P.C.G. Designer is a utility that redefines characters for the user.

It takes the eight binary numbers from each square and converts them to decimal and then saves them to disc as a basic program.

Lets have a look at the program and see how it works. The main part of the program starts at line 180. You may have noticed two input statements in the previous two lines.They collect information from the user to tell the computer how many times to go through the loop.

In the main program the following variables are used:

  • START - tells the computer at which character you wish to start re-defining your characters.
  • NUMBER - tells the computer how may characters you wish to redefine.
  • MAXX - maximum number that the character can be.
  • LINENUMBER-Goes in increments of ten, saves the line number of every statement to disc.
  • LOOP - this is the main loop, it loops the amount of characters which are being defined stops when it reaches MAXX.
  • LOOP2 - The loop for accepting the eight binary numbers.
  • COUNT - which binary number you are up to, number between 1 - 8.
  • BINN$ - String which holds binary number currently being used.
  • LOOP3 - which position of the string you are searching, with MID$ command.
  • N(LOOP2) - array which holds the decimal number after conversion stage.
  • A - Loop holding number between 2 - 7 for identification when saving to disc.
  • N(A) - decimal number which is saved to disc.
  • MES$ - string which holds copyright notice.

All the binary to decimal conversions are done in line 300 and is a lit lie too complicated to explain in this article.

To use the program simply answer the questions at the start arid then enter in your binary numbers, the program will do the rest.

The basic program creatcd is called SPRITE.BAS and is kept under the string of DISCNAMES which is defined in line 640. Make sure if you re-run the program, that your original SPRITE.BAS does not get overwritten (unless you want it to), by saving it under another name.

I hope you enjoy using P.C.G. Designer. It should take a lot of the hard work out of designing characters.

Note: This program was written fur the CPC664/CPC6128 but can be run on the CPC464 (with disc drive attached)-providing the 'FRAME' command in line 1400 is rephced with "CALL &BD19"


★ PUBLISHER: The Amstrad User (Australia)
★ YEAR: 1985
★ AUTHOR: Peter Doutch


Je participe au site:
» Newfile(s) upload/Envoye de fichier(s)
★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

» Applications » Multiscreen (CPC Amstrad International)
» Applications » Symbol - Basic
» Applications » Doodle - Simple Drawing Program (The Amstrad User)
» Applications » Artist (Popular Computing Weekly)
» Applications » Colfunkt 2
» Applications » Letterhead Designer


L'alinéa 8 de l'article L122-5 du Code de la propriété intellectuelle explique que « Lorsque l'œuvre a été divulguée, l'auteur ne peut interdire la reproduction d'une œuvre et sa représentation effectuées à des fins de conservation ou destinées à préserver les conditions de sa consultation à des fins de recherche ou détudes privées par des particuliers, dans les locaux de l'établissement et sur des terminaux dédiés par des bibliothèques accessibles au public, par des musées ou par des services d'archives, sous réserve que ceux-ci ne recherchent aucun avantage économique ou commercial ». Pas de problème donc pour nous!

CPCrulez[Content Management System] v8.7-desktop/cache
Page créée en 912 millisecondes et consultée 677 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.