★ APPLICATIONS ★ UTILITAIRES PROGRAMMATION EN LIGNE DE COMMANDE (RSX) ★ BEEBUGSOFT - TOOLKIT BASIC PROGRAMMER' S AID ★ |
TOOLKIT (Computing with the Amstrad) | TOOLKIT (c) BeeBug Soft (Amstrad Computer User) | Toolkit - The Basic Programmer's Aid from Beebugsoft (CPC Magazin) |
No Amstrad should be without one! Pete Freebreg finds that it pays to be lazy One thing indelibly printed on my personal memory banks comes from when I was at school. We had a cheerful Welsh mathematics teacher whom we called Taffy - of course - and one of his favourite sayings was "... the best mathematicians are lazy". The inference was that we should not slog away with pages of figures when a little thought would present us with a short, elegant solution. What has this to do with toolkits? Well, I often write fairly long programs and any aid that can help me concentrate on the program and free me from a lot of tedious key pushing is a must. This is the idea behind a toolkit - it supplies a suite of short, elegant utility routines that you wish the computer manufacturer had supplied in the first place. Routines that enable you to be as lazy as possible! The Beebugsoft Toolkit for the Amstrad (CPC 6128, 664 or 464) comes on cassette, disc or ROM. All three versions have the same routines, the only differences are the cost (£14.95, £17.95 and £29.95) and the fact that the cassette and disc versions take up some of the computer's memory space. This last aspect could be a problem if you are writing long programs, so Beebugsoft include two additional programs on the cassette and disc versions. These each contain about half of the routines, so releasing about 4k extra memory for your programming. Knowing what you want to do, you can load the appropriate set of utilities before loading in your own program. Although the ROM version is by far the most convenient, it will not plug directly into the Amstrad. You will need to buy an external ROM socket attachment -which will push the price up. Once Toolkit has been initialised in ROM or loaded from cassette or disc, the computer may be used quite normally and the routines called as needed. |TOOLS displays a menu from which most of the routines may be called by just pressing a single key (A-X). |TOOLS also assigns often used commands to the numeric kevpad (MODE 1, MODE 2, |HELP, |FREE, |TOOLS and so on.) All toolkit routines may be called as a bar command either directly or from within a program. Most will be used in the direct mode either as programming aids or as tools to make debugging much easier. Bar commands on the CPC464 cannot accept any text within quotes (file names or search strings). The use of |TOOLS overcomes this problem and is also very easy to use, as you are prompted for all information on any parameters required. Focus on ease The whole idea of a toolkit is to make writing and debugging programs easier for the programmer. One of the first routines that obviously fulfils this intention is IKON. This allows the entry of many Basic keywords in a very abbreviated form. The form used is quite logical and is therefore easily remembered, for example: L.100 for LIST 100, N. for NEXT, E.200 for EDIT 200 and LO. for LOAD. Note that with abbreviated forms you do not have to enter a space after the keyword. Later listings of the program do not appear in this form because Toolkit converts all these abbreviations into the normal Amstrad Basic format automatically. |KOFF switches this routine off if you want to revert to the old laborious method of typing everything in full. Often you will wish to use a similar routine several times within a program. The normal approach here is to use the routine as a subroutine accessed by a GOSUB. Sometimes this is not possible as even though the structure of the routine is very similar, you may have to alter certain parameters within it. |LMOVE will perform a similar operat ion but will move a specified block of lines to another specified position within the program. At first sight these two routines seem extremely powerful and very useful but sadly there is another consideration - the routines also renumber the program to keep everything neat and tidy. This sounds good but it is quite diabolical! If you are writing any program you will have assigned your line numbers in some form of logical order. Perhaps starting all the key operations at lines 1000, 2000, 3000 and so on. After using either of the two commands |LCOPY or |LMOVE you will find the program completely renumbered and your carefully chosen line numbers have been changed. While on the subject, you will no doubt have cursed the Amstrad command RENUM for a similar thoughtless operation. Toolkit has an improved renumberer - |RENUM - that allows renumbering just a specified block of lines and not also all the following lines. Additional programming aids are there in the shape of |KEY and |KEYDEF. The former will list the commands assigned to the function keys which are displayed on the screen and may be edited in the normal Amstrad manner to suit your requirements. But remember that |TOOLS will reassign these keys! |KEYDEF lists what codes any group of keys have been set to. This display is also given in a form that may be edited and gives information on key number, auto repeat, Ascii code, Ascii code with Shift and Ascii code with Ctrl. An asterisk by any display indicates a definition that has been changed from the default setting. Lost and found Two routines that are extremely useful in both writing and debugging programs are |SEARCH and |REPLACE. If you are in the middle of writ ing a long program and want to use an additional variable - what do you use? Ideally you have made a note of all variables and should have no problem. Sadly we all forget to do this sometimes and confusion sets in, especially if we come back to a program after a rest period of a few days or weeks. |SEARCH will readily check through a program in memory and list all lines with the specified variable, keyword, or number. If for any reason you do not want to search the entire program, you may specify a block of lines. It will find anything you have entered in your programs with equal ease and together with |REPLACE recognises ? and * as wild cards. If you search for A?$, it will find AB$, AC$, AD$ and so on. Search for CO* and it will find words like SCORE and COPPER. As it will look for exactly what you type in, check that you type in the correct case - searching for COPPER will not find Copper. This selective option is very sensible on occasions. Change 960 to 970 (there is no need to specify GOSUB 960) and you may well find that 9600 becomes 9700. The routine is also intelligent enough to know that changing IN to OUT should not result in the keyword PRINT being changed to PROUTT. Toolkit will also find the variables you have used in another way - |XREF. Calling this routine will display a remarkable amount of information about selected groups of variables. Many toolkits will only display variables after the program has been run and the variables have been assigned a value or string. Not so |XREF, you need only LOAD a program, for all the numeric and string variables, arrays, functions and GOSUBs or any mixture thereof, to be displayed together with the line numbers where they occur to the screen or printer. Once the program has been run, |REF will also display what each variable contains (numeric or string), including each element of all arrays. Another excellent debugging tool is the trace facility |TRON. This is a far superior version to the Amstrad's normal TRON function. It may be called to operate over a limited number of lines and program operation may be slowed down by holding down Shift or temporarily halted by pressing the spacebar. Kwick print Toolkit has a couple of useful routines to enable you to get hard copies from your programs more easily. To get an output to a printer from an operating program, the Amstrad requires special PRINT commands to be written into the program. IPRON will allow all outputs to go to both screen and printer. As all Toolkit routines are usable from within a program, a very simple Basic subroutine can be included to ask the user whether hard copies are required. The second printer routine is |DUMPA (or DUMPE) and will produce a screen dump to either the Amstrad DMP1 or an Epson type printer. The dump will work in any screen mode and represents up to 16 ink colours by using different types of shading. Memory lane Delving into a computer's memory can be a hacker's delight, but it can also teach you a fair bit about the computer and how Basic programs are stored and operate. |EMEM will display the contents of the memory and allow you to edit what you find there. These contents are displayed in a standard format showing the Hex address, the Ascii contents of that address and any printable character represented by that Ascii code. There are better utilities available to access, write to and manipulate the Amstrad's memory but the routines within Toolkit are as good a place to start Odds Have you got a program that is getting so large you wonder if you can get it all into the memory? Then consider I PACK. This is a very powerful command that will compact a Basic program in several different ways. Any or all of the following can be implemented - remove all REMs, remove all unwanted spaces, replace all variable names with ones of the shortest possible length and finally rewrite groups of Basic lines as single multistatement lines - whew! The routine is intelligent, so if you have inadvertently got a GOTO that directs the program to a REM, it will not remove that REM. As the routine works, the display is continuously updated with the number of bytes being saved. You may hardly recognise your program after it has had the whole treatment and quite amazing savings can be made. |FORMAT gives you an easy to use disc formatting routine that offers the option of system, data or IBM formats. |LIST enables you to list another program directly from cassette or disc without affecting any program in the Amstrad's memory. |FREE displays information concerning any program in memory - start and end addresses, size, HIMEM, free memory and so on. |ROM lists details of any ROMs present and |RSX lists any system extensions - these are any bar commands resident in RAM - for instance all the Toolkit commands. Beebugsoft is always considering improvements to its utilities and Toolkit is no exception. Latest versions will have an added command |FAST that increases the speed of screen handling. This means all your program listings, the memory displays for |EMEM and most other screen displays will be noticeably speeded up. The company has even taken note of my criticisms regarding |LCOPY and |LMOVE so if you have a valid comment, let me know. Conclusion If you write your own programs and have not got a toolkit, you just do not know what you are missing. The Beebugsoft Toolkit for the Amstrad should definitely be on your shopping list - no computer should be without one. Amstrad User August 86 |
|
|