______ ___ ___ ______ _____ __ ___ __ ______ |_ _| \ \ / / | _ \ | __| | | | \ | | / ____\ | | \ \/ / | |_| | | |__ | | | \| | | |___ | | \ / | ___/ | __| --- | | | | \___ \ | | | | | | | |__ | | | |\ | ____| | |__| |__| |__| |_____| |__| |__| \___| \______/ Useful, interesting, entertaining, curious - and all yours +-----------------------------------------------------------------------------+ |More than four | |-----------------------------------------------------------------------------| | This listing from Charles Gatenby of Emborough, Somerset, uses only four | | colours but draws a series of lines to give the impression that more than | | four colours have been used. As the lines are so close together, the | | colours will overlap slightly, giving the appearance of more shades. | | The program is set up to work with a joystick. However, if you wish to | | use a keyboard alter lines 40, 50 and 60 to read as follows. This lets you | | use the left and right cursor keys and the Copy key. | | | | 40 IF INKEY(1)>-1 THEN p=p+1 | | 50 IF INKEY(8)>-1 THEN p=p-1 | | 60 IF INKEY(9)>-1 THEN CLS | | | | Here is the main listing: | | | | [Listing - MORETHAN.BAS] | +-----------------------------------------------------------------------------+ +-----------------------------------------------------------------------------+ |3D cube | +-----------------------------------------------------------------------------+ Continuing the three-dimesional saga, Paul McLean of Oxted, Surrey, has sent in a routine to rotate a cube. It doesn't use colour-switching but draws up the lines for each new position. This explains the flicker. [Listing - 3DCUBE.BAS] +-----------------------------------------------------------------------------+ |Disk menu | |-----------------------------------------------------------------------------| | Joseph Halstead of Bradford in West Yorkshire has written a useful routine | | for all disk users, a disk menu. Run the program and a catalogue of all the | | programs on disk will be displayed. There will be a cursor on screen which | | can be moved, using the cursor cluster, to the program you wish to load or | | run. | | | | [Listing - DISC.BAS] | +-----------------------------------------------------------------------------+ +-----------------------------------------------------------------------------+ |Synth | |-----------------------------------------------------------------------------| | This astounding program from Alastair Scott of Stirlingshire turns your | | Amstrad into a three-channel synthesizer. Using the bottom two rows of | | keys, you can play up to three notes at once. | | Pressing Control and one of the function keys alters octave, attack and | | decay (for percussive sounds), release (rate at which a note dies away) and | | tone envelope (which produces warbling or vibrato effects). All the | | instructions are held within the program, so you don't need to repeat them | | here. If you have speakers attached to Arnold, you'll be impressed by the | | stereo sound from them. | | | | [Listing - SYNTH.BAS] | +-----------------------------------------------------------------------------+ +-----------------------------------------------------------------------------+ |Search-and-replace | +-----------------------------------------------------------------------------+ This routine, sent in by N A Smith of Cranbrook, Kent, reproduces a useful routine often found in expensive word-processing packages. This one is designed to be used on Basic programs. You can alter the names of variables without having to search laboriously through the listing and edit it by hand. You must first prepare a specially saved version of the program you wish to amend. To do this simply load the program and re-save it in Ascii form by typing SAVE"filename",A. (This means the actual letters you typed are now saved, rather than the space-saving 'tokens' Basic usually stores to represent keywords.) When run, the utility will ask several questions: the first is the name of the program to be altered (including the file extension), the second is the word or phrase you wish to replace, the third is the new word or phrase. The final question gives you the option to treat capital and small letters as the same. Every time the program locates a word to replace, it gives you the choice of altering the word or proceeding to the next occurrence. Search-and-replace is designed to work with one disk drive although it is possible to convert it to run on a cassette-based system. This involves adding a procedure which waits for the user to change cassettes. [Listing - SEARCHRE.BAS] ______________________________________________________________________________ | Sound to light | Here is a clever program sent in by Alexander Clark of the Isle of Arran, | Scotland. It will give coloured strobe-like effects on the screen in time | with any music fed into the computer. | The program will work on all three CPCs. However, as the 464 has an | internal tape deck, you can't adjust the volume or hear the music. If you | happen to own the Doubler from Evesham Micros though, the input to this | can be used instead; alterations to the program should be made as detailed | in the listing. | The best results are obtained if the cassette input is plugged into | the external speaker socket or headphone socket of a stereo cassette | recorder. In fact any source where the output can be fed to the audio-in | of the computer and heard at the same time will produce admirable results. | | [Listing - SOUND2LI.BAS] | ______________________________________________________________________________| +-----------------------------------------------------------------------------+ |Space tunnel | +-----------------------------------------------------------------------------+ An extremely short and hypnotic listing comes from David Hall of Stretford, Manchester. It gives you the impression of travelling down a never-ending tunnel. Don't watch it for too long, though - you may begin to act rather peculiarly. [Listing - TUNNEL.BAS] [There is a bug in Space Tunnel, which Amstrad Action did not correct in any subsequent issues. The two NEXT statements after "c=1" in line 70 need to be removed.] +-----------------------------------------------------------------------------+ |Invadders | +-----------------------------------------------------------------------------+ Here it is, after much arm-twisting: a game as one of the listings. Jim Ollerhead of St Helens, Merseyside, is the man to thank. Although it may appear to be a straight shoot-em-up, it is in fact intended to provide practice at addition. The game opens with aliens descending the screen. They have displayed on them a random number. You must shoot enough aliens to reach your 'target score'. If you exceed this score, you lose one of your three lives. A joystick controls your base. Happy shooting... [Listing - INVADDER.BAS] ------------------------------------------------------------------------------- PROBLEM ATTIC PROBLEM ATTIC ------------------------------------------------------------------------------- We try to solve your problems with Arnold - nothing is too simple or too complicated for our experts Moving pixels Please could you print a program showing how to move a single pixel around the screen under your control, without leaving a trail of pixels behind it? If possible please don't use data statements as I can't decipher them. M Lovelady Litherland, Liverpool Here is a short program to move a pixel: control is via the cursor cluster. The variables x% and y% refer to the current x and y positions of the pixel; a% and b% are the old x and y positions, that is, how far up and how far across the pixel was before it was moved. In this way, the pixel can be moved and the old one deleted. | [Listing - MOVEPIX.BAS] | |_____________________________________________________________________________| The saving puzzle I'm very new to computers and especially my 6128, so I find your magazine a great help. But the thing that puzzles me altogether is transporting programs from tape to disk. How can it be done? I've tried what the manual says in typing |TAPE.IN, but the game loads and that's it. Please put me out of my misery. Warren Diffey Peterhead, Aberdeenshire There are two file-types you will need to diferentiate when transferring programs. One is a Basic file, the other is binary. If you catalogue a cassette, a Basic file will have the character '$' associated to it, and a binary file will have '&'. If it's a Basic file you wish to transfer then type in direct mode (that is, don't use line numbers): |TAPE.IN LOAD"file1" SAVE"file2" At 'file1' fill in the name of the program you wish to load. When saving to disk, remember that the name for file2 can be a maximum of eight characters - that's the finicky disk operating system for you, I'm afraid. Loading and saving of binary files brings a few new problems: you need to know where the program starts in memory, length of the program in memory, and if applicable, the execution address (the position in memory that the program is run from). To help find these, type and run the program below. It is an enhanced catalogue which will display all the required information: | [Listing - EXTCAT.BAS] | |_____________________________________________________________________________| When run, the program will display all relevant file information. For example, suppose the following appeared: PROGRAM NAME CODE PROGRAM LENGTH 4578 START ADDRESS 34000 BINARY EXEC ADDRESS 34100 Jot down whatever is displayed as you will need it to load from tape and eventually save to disk. Using this information, type in direct mode: |TAPE.IN MEMORY 33999 LOAD"CODE" Note that the figure following the Memory command is one less than 'start address'. The binary program should have succesfully loaded into memory. Once this has occurred, type (again in direct mode): SAVE"CODE",B,34000,4578,34100 Remember a few points when saving a binary file: SAVE"filename",B,,, The filename must be in quotes followed by comma B. This tells the system that a binary file is to be saved. Following B is another comma with the start address of the program. Next comes another comma and the length of the program. The last parameter may not always be present (execution address). [There is a bug in Extended Catalogue, which Amstrad Action did not correct in any subsequent issues. The execution address of binary files is not displayed. To correct this, "IF a=2" in line 120 should be changed to "IF a=1".] ___ ___ ____ _______ _______ ___ _____ _____ | | / \ | | | | | | | | \ / \ | | | | | | | | | \ |----| | | | | | |___/ \ | | | | | | | | \ _|_ _|_ \____/ _|_ _|_ _|_ _|_ \_____/ Undazzling I dazzled with Roy Makely's Superdazzle (Hot Tips 16) - nice one, Roy - but how to undazzle again? Oh dear, not so easy. Border 0 doesn't work; it appears nothing save a reset will do the trick, which makes the routine less useful. But surely something will undazzle - it must. Well, POKE &801B,9 works. Graham Redman Teynham, Kent Your poke certainly stops the border dazzling, Graham. But unfortunately it sends an illegal value to the gate array, and the computer begins to behave rather oddly afterwards. Mine tended to crash rather rudely on most occasions. Here's the correct solution: [Listing - UNDAZZLE.BAS] An easier solution The December issue had a type-in entitled Motor Control. There is a much easier way to achieve this, as shown in the following three lines: [Listing - MOTORCON.BAS] If this is run it will program the function keys f1 and f2 to be motor on and off respectively. J Evans Leek Wooton, Warwick [There is a minor bug in this listing, which Amstrad Action did not correct in any subsequent issues. The program actually redefines the f3 and f4 function keys. To correct this, change "KEY 131" in line 10 and "KEY 132" in line 20 to "KEY 129" and "KEY 130" respectively.] The fourth mode I've written a program that creates a new mode. This is done by directly accessing the CRTC (cathoderay-tube controller) with OUT commands. It doubles the size of all displayed characters, changing the screen size to 20, 40 or 80 by 15. Everything works fine except that border and inks can't be altered. [Listing - 4THMODE.BAS] Nick Speakman Warrington, Cheshire Muddling Modes - follow-up Here is some further information regarding Muddling Modes (Hot Tips, AA 16). The locations at &B1CF to &B1D2 are the pixel masks used by the screen-writing routine in the 464 rom. The 664 and 6128 use a different routine which calculates the masks for each mode, rather than transferring them from rom to ram; there are therefore no masks to alter. The locations &B7C6 to &B7C9 have nothing to do with pixel masks - &B7C6 is in fact the high byte of the screen base address (which is of course &C0). There is thus no way for 664 or 6128 owners to achieve mixed-mode writing without resorting to interrupt-driven screen splitting (but see below for the next best thing). Readers with a 464 might like to try a similar effect mixing modes 1 and 0 on a mode-1 screen; this gives the advantage of different inks, and in fact some inks will give a stripey effect: MODE 1:POKE &B1C8,0;POKE &B1CF,&CC:POKE &B1D0,&33 [return] Stripey inks can also be achieved by poking the ink masks (rather than the pixel masks): 464 users 6128 users pen &B28F &B72F paper &B290 &B730 graphics pen &B338 &B6A3 graphics paper &B339 &B6A4 If you have a disk drive attached then a very useful poke is &A701 - it is the disk user number. What is extremely useful is the ability to see any erased files by poking &A701 with &E5. If, for example, you unwittingly erase an important file then here is a method of retrieving it without having to fork out for an 'unerase' program: POKE &A701,&E5:CAT:LOAD"filename" |USER,0:SAVE"filename" Using this method it is possible to make your files undetectable to a catalogue or directory (I use my initials): POKE &A701,&EF Other handy pokes (664 and 6128 only) use locations &B631 and &B632 and values &FF and 0 to turn shift lock and caps lock on and off respectively, eg: POKE &B631, &FF - shift lock off Finally, a little machine-code to provide double-width letters in any mode. The command syntax is |WPRINT,streamnumber,"text to be printed". If stream is omitted, the text will be sent to the current screen. However, 464 users must use the command as follows: a$="text to be printed":|WPRINT,@a$ 664 and 6128 owners have no such problems: text can be handled directly. [Listing - WPRINT.BAS] For the 464 machine the two italicised data items in line 90 must be altered to &A0,&AB. Ewen Flint Calside, Dumfries [The 464 version of Double-Width Characters does not work; it prints arrow characters instead of text.]