|★ APPLICATIONS ★ DIVERS ★ Spheriscreen ★|
|Spheriscreen|The Amstrad User)||Applications Divers|
Discover a program's secrets: how it works, improvement that can be made and techniques worth remembering.
Peter Featherstone has written a spectacular program that takes a normal screen and distorts it in several wavs The effects are similar to those achieved on the Quantel graphics computer used by television companies to produce video effets. The screen, once loaded, can be folded or rolled into ; sphere or cone and subsequently saved.
As it stands Spheriscreen will only run on 664 and 6128 machines. To gut it running on a 464 simply alter a 11 occurrences of POKE &B7C6,192 to POKE &B1CB,192. Similarly change POKE &B7C6,64 to POKE &B1CB,64
Notice the manner in which Peter tests for a key press. Lines 150 to 170 print the options, the end of line 170 waits for your input and line 180 checks that you haven't typed anything but a number between 1 and 4.
Spheriscreen has been programmed to work in Mode 0. This means 16 colours may be allowed on screen in one go. Line 260 reads each DATA item held in line 270 and changes colour accordingly. You may substitute the colours of your choice. The first number refers to ink pot one, the second to ink pot two and so on. The User Instructions contain a list of all the colours and their corresponding colours.
Line 290 loads the screen of your choice into memory location
16384 (&4000). Don't forgot to place ;he desired filename between the quotes in line 290.
Peter has made clever use of the GOTO command in the line above. The line the program branches to depends or the value: 1 and it goes to line 210, 2 and if s off to 380.
The CPC screen can have a maximum of 640 pixels across bv 200 down. Mode 0 has 160 by 200 dots. In each Mode the ' addressing system is the same. The STEP in line 320 accounts lor thy horizontal resolution. Similarly for the vertical resolution in line 330. The screen being manipulated is stored out of view, at address &4C00. Each pixel on the lower screen is TESTed and then replotted on the upper screen, but in a different position | (depending on the effect chosen). When the computer TESTs a pixel it must do it on the screen held lower in memory. To fool the computer into thinking the actual screen is low down a POKE is used. All screen operations will now take place in the lower image. Once the screcn has been TESTed a second POKE is issued. This tells the system that the screen is back in its original position.
The vertical distortion routine starts at line 380. It is identical to the horizontal routine, but just acts in a different plane.
Again, you may increase or decrease distortion by altering variable s in 310. Once the picture has finished drawing you may press S to save it. Insert the filename in line 420. The same goes for all the routines.
A clever piece of mathematics in lines 370 and 380 turn your original picture into a sphere. By altering variable x you can alter the view of the sphere. If you ran the program several times - using the same picture - altering x by a little each time you could save a sequence of spherical screens and then redisplay them quickly to give the impression of rotation.
Each distorted image takes anything from half-an-hour to produce. A long time to wait, but the results are astounding. Just look at the pictures on the this page. Can anyone produce a speedy machine code version?