APPLICATIONSDIVERS ★ Transformers ★

Transformers (Your Computer)Applications Divers
★ 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 ★ 

Transformers, an Amstrad program, lays down the basic method for turning any shape or size wire-box diagram into any other shape or size wire-box diagram, providing that each shape does not contain more than 26 straight lines. In a computer program, or title page for a program, it might be appropriate to transform one shape into another. You might not have occasion to turn a caterpiller into a butterfly but you might want to change a house into a robot or reduce a logo - such as your initials - into one small spot in the centre of the screen.

Alternatively, you might prefer to break your logo into 26 pieces and cause them to take up different shapes and positions round the screen, or perhaps to fly off the screen altogether. What we have is simple animation, with the wire-frame picture changing shape for each frame of the sequence. All the user has to do is draw the starting and finishing frames of the picture, which admittedly is time-consuming if you do not have a light pen, and the computer will fill the in-between frames.

The program consists of three sections, two of which the user has to enter. Section 1 is in Basic. This part of the program holds the coordinates of all the lines in both the first and the final frame of the picture - i.e., the co-ordinates for the diagram with which you want to start and the co-ordinates for the diagram with which you want to finish.

The diagrams may be only one pixel in size; alternatively they may be 26 random lines all over the scene - there is no requirement for both start and finish diagrams to be conventional, although one at least of them should represent a recognisable object. The main task of this section is to generate the co-ordinate data for all the intermediate frames.

Section 2 is a series of machine code routines which will put the frames on the screen at a speed which lends the transformation a reasonably smooth degree of animation. There is no need to laod this section, since the Basic does that for you.

Section 3 is the numerical array of co-ordinate data. It starts at address &8440 and grows in size proportional to the number of frames in the animation sequence. Basic limits the number to 10, to ensure that the array does not overwrite the important operating-system bytes which live in high memory.

Once the Basic program has been given diagram co-ordinates and run at least once, it can be removed from the computer memory. The co-ordinates for the start diagram, the finish diagram and the animation sequence are preserved, and the transformation can be run any number of times by CALLing the machine code routine.

The Transformer program has been written so that it can be used in ways which go beyond turning diagram A into diagram B. The Basic listing contains some demonstration co-ordinates which will transform a small square into a large square but it is best to consider the simple case of changing one line into another. Figure one shows a START DIAGRAM, consisting of LINE A, and the intended FINISH DIAGRAM, which is the same LINE A. only shorter. The co-ordinates of the start line are given by SX, SY, EX, EY, and the co-ordinates of the finish line are given by LSX, LSY, LEX and LEY. They are standard Amstrad graphic-screen co-ordinates - 0-639 on the X axis and 0-399 on the Y axis. The Basic program holds those values in eight variables.

Information passes into those variables from the DATA lines. There is one data line for each lettered line. The caterpillar has 26 such lines, from A to Z, and so the data table is at its maximum size.

If 10 frames are planned for the transformation, the value of SX must be incremented by a certain amount 10 times until the value LSX is reached. SY similarly must be incremented. It is those incremental steps on the alpha and beta trajectories which the program calculates and stores in the machine-code array. This method of storing step values instead of co-ordinate values enables experimentation which would otherwise not be possible. For example, having metamorphosed a butterfly from a caterpillar or, more boringly, a large square from a small square, the end-frame can become the starting frame of a new transformation. The stepping values will then expand the butterfly into another, probably unrecognisable, shape. If the same principle of "going on from the finish frame" is applied carefully to geometrical shapes like the square, the effects can be a sensible enlargement of the shape, or a meaningful distortion.

The Basic program is complicated by the need to cater for certain situations which do not arise in the figure one example but which will occur in most transformations. For example, many trajectories will involve decrements, not increments. There is also the case where the gap between LSX and SX is only a few pixels. Dividing that gap by 10- the number of frames - to find the step value returns a fraction, with which the Amstrad graphic coordinates cannot cope. The program over-rides that situation and supplies some sensible values of its own.

The work of the Basic is achieved within the Q For-Next loop, lines 150 to 280. That sets various machine code arrays, which can be thought of as three invisible tables, TABLE 1,2 and 3. TABLE 1 is set to the pattern SX, SY, EX, EY and TABLE2, to LSX, LSY, LEX, LEY. The value in TABLE 1 becomes changed as the transformation takes place and should achieve values identical to LSX, LSY, LEX and LEY on completion of the the last frame.

Since the original contents of TABLE 1 are lost, a copy of them can be created in TABLE3. There are four machine code routines: CALL &8003 copies TABLE 1 to TABLE3. Call &8005 restores TABLE 1 using the contents of TABLE3. Call &8007 interchanges the contents of TABLE 1 with that of TABLE2. Calling &8008 performs the transformation.

Finally, POKE &8092,&ED.POKE &8093,&42 reverses the direction of transformation, and POKE &8092,9:POKE &8093,0 restores normality. POKE &806B,&18:POKE &806C,&12 causes each frame to leave a trail behind on the screen, and POKE &806B,&28:POKE &806C,12 restores normality. By using those CALLs sensibly, it is possible to obtain an endless variety of wierd and wonderful effects.

YOUR COMPUTER (MAY 1986)

★ PUBLISHER: YOUR COMPUTER
★ YEAR: 1986
★ CONFIG: 64K + AMSDOS
★ LANGUAGE:
★ LiCENCE: LISTING
★ COLLECTION: YOUR COMPUTER 1986
★ AUTHOR: Ferguson Main
 

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listings:
» Transformers    (Your  Computer)    ENGLISHDATE: 2020-04-29
DL: 196
TYPE: ZIP
SiZE: 5Ko
NOTE: 40 Cyls
.HFE: Χ

» Transformers    LISTINGDATE: 2013-08-24
DL: 228
TYPE: PDF
SiZE: 216Ko
NOTE: 1 page/PDFlib v1.6

★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
Je participe au site:
» Vous avez des infos personnel, des fichiers que nous ne possédons pas concernent ce programme ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 083 millisecondes et consultée 1553 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.