This month's listings have got something for everyone. On the serious side there's Unerase for disc users and Key-RSX for key-definers. If that doesn't sound like you, try the snappy graphics of Trix or the two ridiculously short Oneliners. Last but not least, there's a special treat for all you regular type-ins readers - a handy Reset function to add to March's much-loved Drumkit. _____________________________________________________________________________ | | | Notes on entering the listings | | | | You must take care to enter the listings EXACTLY as they are printed. A | | single comma or bracket out of place will prevent them working. Remember to | | press the Enter key (or on the 6128 the Return key) after completing each | | numbered line of the program. | | If, after you've tried to RUN the program you get a message saying eg | | "Improper argument in 20", that doesn't necessarily mean there is an error | | in line 20. Line 20 is where Arnold had got to when he realised a mistake | | had been made. The mistake could well be somewhere else - almost anywhere | | else, in fact. You may have no choice but to check the listing character by | | character from the first line. | | A little knowledge of BASIC goes a long way when it comes to debugging, | | but there are a couple of tips novices can use. For one thing, "Syntax | | error in 20" really does mean a mistake actually in line 20. Syntax errors | | are always in the line reported in the error message. Another error you can | | track down easily is "Subscript out of range". Nine times out of ten, this | | means an error either in the line reported, or in a line elsewhere which | | contains the word DIM. | | Where there are a lot of DATA statements to be typed in, some programs | | use checksumming, a kind of self-test to find typing errors. Where you get | | a message like "Checksum error in line 160" you know you've probably typed | | line 160 wrong. Similarly, "Checksum error" on its own means there's a | | mistake somewhere in the data statements, but doesn't tell you where. | | Finally, always save the program BEFORE you try to run it. Some of the | | type-ins we print will self-destruct as soon as they've done their job, so | | you'll need a copy to use another time. You have been warned! | |_____________________________________________________________________________| DRUMKIT REVISITED If you typed in John Keneally's Drumkit from the March issue of AA, you'll have noticed something annoying. Namely, there's no easy way to shut the thing up. What you need, especially if you don't like the start-up rhythms, is a Reset function to set a whole channel to silence in one go. These extra lines from Peter Newman of Dungannon let you do just that. All you need to do is load in Drumkit, type the extra lines and then save the modified listing - couldn't be easier. __________________________ | | | [Listing - DRUMKIT.BAS] | |__________________________| UNERASE If you use disks, you need this program. Quite simply, if you erase a file accidentally, Unerase will get it back for you. The program is pretty well fool-proof to type in, having not one but two sets of checksums. It's easy to use as well, but there are a couple of points you'll need to watch. Firstly, you can run into problems if there are two erased files of the same name, or if you've written to the disc since erasing the file. Secondly, the program as given here only works on system or vendor format discs. You should use the substitute line 190 if you want Unerase to handle data (ie non-CP/M) format discs. Other than this substitution, you shouldn't need to modify the program yourself. Indeed, as its author Alexander Clark points out, it is very unwise to try. You'll need to be well up on machine code and disc firmware to achieve anything, and a botched rewrite could easily wipe out important data. As a general precaution against typing errors, try the program out on a disc you could afford to lose data from. If it works, you'll get eg FILE.BAS restored as FILE.ERA - and you'll wonder how you ever got by without it! ___________________________________ | | | [Listing - UNERASE.BAS] | | | | Substitute line 190 | | | | 190 POKE &A514,0:FOR a=&C1 TO &C4 | |___________________________________| [A correction to Unerase was published in the August 1986 issue (#11), which fixed a problem where the wrong line number is displayed if the user types in a DATA statement incorrectly. However, the program still works without the correction if it is typed in without any mistakes.] __________________________ | | | [Listing - ETCH-A-S.BAS] | | | | [Listing - TYPING.BAS] | |__________________________| ONELINERS Two great little programs here from Dick Ruck of Brighton. They're both just one line long, and they both actually do something. Etch-a-Sketch lets you draw to your heart's content. Use "A" and "Z" to move up and down, or "<" and ">" to move left and right. If you draw off one edge of the screen, you reappear on the opposite edge - try it. Typing Tutor is even more impressive, being a machine code program complete with loader, all on one line. It lets you practice your typing, and is very responsive indeed. Be warned, though, you can only get out of this one by resetting the machine - so save it first! TRIX Philip Gardner of Bridgwater, not a million miles from AA HQ, sent us in this sharp little mini-listing for drawing patterns. Trix draws seven different patterns, holding each one until you press a key. Once it's done all seven, it repeats itself. If you want to make patterns of your own, try altering the data in line 130 - all the numbers are angles in degrees. Pointless, of course, but fun! __________________________ | | | [Listing - TRIX.BAS] | |__________________________| KEY-RSX If you do a lot of key redefining, the chances are you often find it hard to remember which keys do what. Of course, you could always press the relevant keys and see what characters are produced. This has the drawback that any control codes - carriage returns and the like - are obeyed rather than shown. What you need is a way of listing the expansion strings - the key definitions, that is - in such a form that you can read and edit control codes. Philip Pepperell of Aylesbury has sent us just that. The program sets up an RSX called |KEY. To get the expansion string of a key, type in and run the program. Then type |KEY,n where n is the ASCII value of the key in question. If you type |KEY,140 for example, you'll get the [ctrl][enter] expansion used for loading games from tape. It comes up as KEY &8C,"RUN"+CHR$(&22)+CHR$(&0D) - so you can edit it using the cursor/copy keys, and then hit return to enter the new definition. __________________________ | | | [Listing - KEY-RSX.BAS] | |__________________________|