____ ______ ___ ___ ______ _____ _ __ ___ __ ______ _____ ____ |_ _| \ \ / / | _ \ | __| _ | | | \ | | / ____\ ____ ______ | | \ \/ / | |_| | | |__ | | | \| | | |___ ______ ______ | | _ \ / | ___/ | __| --- | | | | \___ \ ____ ______ | | __ | | | | __ | |__ _ | | | |\ | ____| | ____ ______ |__| __ |__| |__| __ |_____| _ |__| |__| \___| \______/ _____ More hues for your modes, delightful doodles to design, clever curves to create, disk-inlays to instigate - type-ins to type in +-----------------------------------------------------------------------------+ | Psychedelic strobe | +-----------------------------------------------------------------------------+ Stephen Stokes of Aylesbury, Bucks, has sent in a listing similar to Alexander Clark's Sound to Light (AA 19).However, this program works in a different way and is faster because it is written in machine-code. The results are most satisfying if the cassette input is plugged into the headphone socket of a music system. Run the program. Setting up the machine-code and initial screen pattern takes a few minutes. Plug the cassette lead into the music system. If nothing happens increase the volume: increasing the volume will result in faster and brighter patterns. Effects are best in a darkened room. Pressing any key will halt the program. [Listing - STROBE.BAS] +-----------------------------------------------------------------------------+ | Curve | +-----------------------------------------------------------------------------+ Below is a neat one-liner from Jamie Wynn of London. The routine will ask for a number enabling it to calculate the cross-hatching required for the curve. [Listing - CURVE.BAS] +-----------------------------------------------------------------------------+ | Disk inlay | +-----------------------------------------------------------------------------+ A very useful listing by Mark Gannon of Leabrooks, Derbyshire: it produces very accurate blank inlay cards suitable for three-inch disks. The program will work on any Epson-compatible printer. Before running, ensure that the buffer mode is set to download. On the DMP 2000 this is achieved by setting dipswitch DS2-4. Mark suggests using light card and friction feed. [Listing - DISKINLA.BAS] +-----------------------------------------------------------------------------+ | Shapemaker | +-----------------------------------------------------------------------------+ Mr A Hilton of Cheadle Hulme, Stockport, has shown how to greatly speed up graphic designs from Basic. By dimensioning two arrays to hold all the sines and cosines of angles between 0 and 360 degrees instead of calculating them each time they are needed, the increase in program speed is quite phenomenal. After a short delay at the beginning of the program, you will be asked to enter the height and width of your design and four distortion factors. Different numbers give different shapes. Run the program and note the speed with which your designs appear. [Listing - SHAPEMAK.BAS] +-----------------------------------------------------------------------------+ | Multi-coloured modes and border | |-----------------------------------------------------------------------------| | | | Remember a listing in AA 17 called Multi-coloured Modes by TA Shah of | | Blackburn, Lancashire? Well here's the follow-up from Mr Shah. It really | | does push your Arnold to the limits: allows 8 colours in Mode 2, 16 in Mode | | 1 and all 27 in Mode 0. It also lets you have multi-coloured borders (as | | seen in the Melbourne House game Fighting Warrior). Many readers have asked | | for an explanation of how the program works - watch for a future article, | | because it will take more space than we've got here. | | The listing is long, but the results are truly stunning. Type in both | | the first listing and the demo (as you'll get a better idea of what is | | actually possible). Save the first program as COLOURS.BAS and the second as | | COLSDEMO.BAS. Run it and watch. Once you've had a good look, you might like | | to experiment. | | Five new commands are incorporated into the system after the program | | has run: | | ON puts the computer into multi-coloured mode. | | OFF takes the computer out of multi-coloured mode. | | MODE,a allows computer to change mode without any flicker. The variable a | | can be 0, 1 or 2. For example MODE, 1 assumes Mode 1. | | BORDER,a,b,c,d sets the four border colours. All four variables must be | | present when issuing this command. The values can range from 0 to 31 (see | | later). For example, BORDER, 26, 2, 12, 9 will have a border consisiting | | of four different colours; |BORDER, 23, 23, 11, 11 will split the border | | into two colours. | | |INK,z,a,b,c,d sets the ink z to the colours held in a, b, c and d. The | | variable a refers to the top of the screen and d to the bottom (see | | diagram). The value of z can range from 0 to 15. A value 0 will indicate | | the paper colour. Variables a to d range from 0 to 31. For example, |INK, | | 0, 26, 2, 4, 6 will cause the screen to have four paper colours; |INK, 0, | | 2, 2, 8, 8 will split the paper into two colours; |INK, 1, 5, 0, 2, 7 | | allows four different ink colours on screen. | | The diagram will help you if you're completely lost: | | ___________________ | | | | | | | a FIRST INK | | | |___________________| | | | | | | | b | | | |___________________| | | | | | | | c | | | |___________________| | | | | | | | d LAST INK | | | |___________________| | | | | DIAGRAM TO SHOW THE FOUR DIFFERENT AREAS OF THE SCREEN | | | | ___________________________________________________________________________ | | | | Grey Hardware | | scale Colour code | | --------------------------------------------------------------------------- | | 0 Black 20 14 Pastel blue 31 | | 1 Blue 4 15 Orange 14 | | 2 Bright blue 21 16 Pink 7 | | 3 Red 28 17 Pastel magenta 15 | | 4 Magenta 24 18 Bright green 18 | | 5 Mauve 29 19 Sea green 2 | | 6 Bright red 12 20 Bright cyan 19 | | 7 Purple 5 21 Lime 26 | | 8 Bright magenta 13 22 Pastel green 25 | | 9 Green 22 23 Pastel cyan 27 | | 10 Cyan 6 24 Bright yellow 10 | | 11 Sky blue 23 25 Pastel yellow 3 | | 12 Yellow 30 26 Bright white 11 | | 13 White 0 | | ___________________________________________________________________________ | | | | The routine uses hardware code for colours, not normal greyscale | | | | Using this information, to get a paper colour of red, green, blue and | | white, the command is |INK, 0, 28, 2, 4, 0.Still confused? Look at the demo | | listing to see how it's done. | | | | [Listing - COLOURS.BAS] | | | | [Listing - COLSDEMO.BAS] | |_____________________________________________________________________________| [There is a minor bug in Multi-coloured Modes and Border. In the COLOURS.BAS listing, if the user types in a DATA statement incorrectly, an error is displayed, but the wrong line number is shown. To correct this, change "L=160" in line 10 to "L=80". The program still works without the correction if it is typed in without any mistakes. Amstrad Action did not print a correction in any subsequent issues.] +-----------------------------------------------------------------------------+ | Spirograph | +-----------------------------------------------------------------------------+ | | | As the name suggests, this program can produce designs like the classic toy | | with its pens and cogs. From only circles and ellipses, stunning pictures | | are possible. You are asked to input details for the graph: x and y radii | | for the outer ellipses (for circles the two values are equal), x and y | | radii for inner ellipses, line colour. Andrew Smith of Selby, North | | Yorkshire, is the person to credit for this listing. | | | | [Listing - SPIRO.BAS] | |_____________________________________________________________________________| [Amstrad Action forgot to mention that Spirograph only works on CPC664 and CPC6128 machines. Amstrad Action did not mention this in any subsequent issues. Amstrad Action also did not mention that the designs can be dumped to a printer by pressing the P key at any time.] +-----------------------------------------------------------------------------+ | 3D Picture designer | +-----------------------------------------------------------------------------+ Here is a marvellous utility to design three-dimensional pictures. Sent in by MJ Williams of Kingsheath, Birmingham, it draws up a two-dimensional grid where you can fill in or clear squares. You can then display the finished design in three dimensions and save it if you wish. All instructions are displayed when the program runs. Only one drawback to this listing: it works only on 664 and 618 machines. [Listing - 3DDESIGN.BAS] [There is a bug in 3D Picture Designer. When the user is told to press a key to save the picture on the screen, nothing happens. To correct this, "GOTO 840" in line 840 should be changed to "GOTO 820". Amstrad Action did not print a correction in any subsequent issues.] +-----------------------------------------------------------------------------+ | Scrolling message | +-----------------------------------------------------------------------------+ A short scrolling message routine has been supplied by Mark Bonsher of Loughborough, Leicestershire. Alter the text in line 20 to suit your needs - run - and watch your message scuttle across the screen. [Listing - SCROLL.BAS] [Below is an extract from part 4 of the "Programming with the Pilg..." section of the Pilgrim's adventure column, in which the Pilgrim explains how to program an adventure game.] Just before we finish, however, I want to introduce the idea of decision trees. Just as the structures we use to hold our data are important, so are the structures of the routines that handle that data. For example, we can use the IF-THEN construct to process information, sifting through a number of different conditions until we reach a conclusion, as in the following pseudo-Basic sequence: 10 IF THE DRAGON IS IN THE KITCHEN GOTO 30 20 SIGH WITH RELIEF: GOTO 70 30 IF THE PLAYER IS STRONG THEN DRAW SWORD AND GOTO 50 40 DIE OF FRIGHT: GOTO END 50 IF THE DRAGON IS ONLY ONE INCH TALL GOTO 70 60 DIE BRAVELY: GOTO END 70 PUT DRAGON IN POCKET: CARRY ON PLAYING... The problem with this, however, is that you are liable - even in a small game - to end up with pages and pages of IF statements. What we really need is something a little different. So, to end this month's Pilgy Prog Piece, type in the listing and run it. Can you work out how it works? Find out next month... [Listing - PILGRIM.BAS]