|Machine Code Tutors|
UNTIL RECENTLY the term 'utility' has been used by software companies to mean any product which handles machine code, such as assemblers, disassemblers and toolkits. Those products help you to exploit the potential of the Spectrum giving enhanced graphics and sound and also provides aids for writing Basic programs such as line or block delete, memory available and REMkill.
The utility market has, however, expanded to include programs which provide you with information on how to use machine code or assembler language. Those programs could be classified as educational but most of them also include utility routines which simulate the Spectrum Z-80A microprocessor and allow you to experiment with machine code in an environment controlled by the program so that any errors do not cause a crash.
The first of such programs to be released was Beyond Basic produced by Sinclair Research with the help of Incognito Software. The back of the cassette package primes the purchaser for an adventure into the world of assembly language in which they will be guided by the Spectrum through the intricate workings of the Z-80 processor.
It is also claimed that the program will "take the agony out of machine code". That may be true but it also puts the agony into loading the program from cassette. Of the samples received at Sinclair User only one would load and that was after it had been coaxed through the tape deck several times.
Unfortunately, the crashes made it evident that most of Beyond Basic has, ironically, been written in slow-moving Basic. It therefore has a greater tendency to crash and is slower and less polished than if the program had been written in machine code.
Once loaded, the package displays four options, three of which correspond to sections of the program which deal with lessons and examples of assembly language and the fourth sends the machine back into Basic. The last option is pointless as you can go back into Basic at any time by pressing the BREAK key.
The first section explains how information is stored within the Spectrum and provides details on the machine registers through which information is passed to and from the other chips and in which the results of calculations are stored.
At first no machine code instructions are explained. The author provides a set of pseudo-instructions which are not Basic or machine code commands but bridge the gap between the two languages. You might think that is a good idea but could get confused when real assembly language instructions are introduced and the pseudo-instructions are discarded.
The second section on the tape give a brief rundown of standard assembler mnemonics. The rundown is a little brief and explanations which would require a whole chapter in a book on the same subject are given only one or two screens.
The final part of the tutor involves writing and running your own machine code program using the Beyond Basic version of a Z-80 simulator. Once the program has been entered you can watch how the registers and internal memory change as each instruction is effected. When it has run you can edit the lines of code and watch sections of your program run if debugging is necessary.
The potential of a real simulator and effective lessons in machine code seems to have eluded Incognito with Beyond Basic. Sinclair Research states that the philosophy behind the package is one of simplicity. It is not simple to use, its style is not simple to learn from and it is certainly not simple to load.
The Complete Machine Code Tutor, from New Generation Software, is unlike Beyond Basic in one respect: it is simple to use. It provides a series of 33 lessons covering all aspects of assembly language programming together with a powerful simulator program on which you can run examples and write your own routines without fear of fatal crashes.
The simulator makes the package better than a book and the lessons are comprehensive enough to help even the beginner who has failed to learn from other texts. The package also succeeds because it does not adopt the style of the huge tomes about machine code which so often take pride of place in bookshops. It is also more helpful than a book as it draws attention to any ideas that you have failed to understand in a lesson. The package is very user-friendly in that respect and if an error does occur the computer not only locates and explains it but also gives you the opportunity to try again with some help from the Spectrum.
It is hard to crash the Tutor, even when loading one of the lessons. If a tape-loading error occurs the Spectrum will not crash, which is the case with Beyond Basic, but a message is displayed on the screen showing that an error has occurred and asking if you still want to load the next lesson. If not the package returns to the main menu of the previous set of lessons.
The Complete Machine Code Tutor provides an excellent introduction to assembly language. It may not give the necessary spur to beginners who want to give up Basic and become machine code programmers but it will give an extra push to those who are already committed to going through the agony of learning machine code from a book.
The same cannot be said of Spectrosim, from Shiva Software. As with Beyond Basic it is written in Sinclair Basic which, of course, the program is attempting to encourage users to replace with machine code.
The package is a Z-80 simulator but has none of the power or attraction of its rival from New Generation. While The Complete Machine Code Tutor can handle 16-bit registers as well as eight-bit in its simulator, Spectrosim can only handle the eight-bit registers from A-D. No mention is made of the E, F, G, H and L registers which all have special jobs within the Z-80. That means that the true power of the chip is not simulated.
New Generation have an excuse for cutting back its simulator on the grounds of memory restrictions but Shiva has none. If the author could not get a full simulator to fit into 32K using Basic he should perhaps take lessons from his own book and write it in machine code to make it fit within the Spectrum RAM. That would have been better than releasing a product which many intermediate Basic programmers could write.
The main menu of Spectrosim provides nine options, the titles of which may prove confusing to the beginner. For instance, the term 'load' is used twice in the menu. The first option is 'Load program'. You might think that you have to reach for the tape recorder and the LOAD key but the author means that you should start typing in a program from the keyboard. There is also a Tape-Load option but even someone with some knowledge of computer buzzwords might get confused at the terminology.
The other main display within Spectrosim is one in which the contents of the Z-80 registers and flags are shown together with the current program name and the number of instructions which have been processed so far by the simulator. It is immediately obvious that only three of the six main system flags can be used by the simulator and those are Carry, Zero, and Sign. They are the most important of the flags that you can change but the omission of the others is a gross oversight.
The best aspect of the package is the 44-page booklet included as an aid to working the simulator. It includes the assembly language instructions which can be used with the simulator, some of which do not correspond to Z-80 assembly mnemonics. It is, however, more helpful than the program could ever be in showing the potential of Z-80 code.
Once you have finished learning about machine code you will need an assembler or monitor to help you put your program into the Spectrum. One of the only assemblers available for both the 16K and 48K machines is the ZX Spectrum Machine Code Assembler from McGraw-Hill.
The software allows the use of full standard Z-80 mnemonics and also includes the usual time-saving devices to make the computer assemble at a given address and define blocks of data or text strings within a program. If you make an error the program provides adequate error messages and allows you to correct the usual mistakes which often occur when you are learning about machine code.
Unfortunately the way in which you have to write assembly language programs is made difficult by the program and errors are bound to creep into even an expert's program. The assembly code has to be typed into REM statements within a Basic program. That may seem to make the job easier but, without the neat display of a full screen editor with which most assemblers are equipped, your code will soon turn into a jumble of instructions.
The other problem with the assembler is the instructions, or lack of them. The purchaser is supplied with eight pages of text which give a quick introduction to the program and a few example routines. It is written in a style that few beginners would understand and few experts will bother to read. The assembler may be as powerful as most others on the market but it will lose customers when they learn that the instructions are so sparse and the program is so unfriendly.
If the assembler from McGraw-Hill does not sound enchanting then you might be more inclined to buy Spectre-Mac-Mon, a complete machine code development system from Oasis Software. The publisher has given it a grand name and the product certainly deserves it.
The package includes a 48K assembler and a 16K monitor both of which are microdrive-compatible. Spectre-Mac, the Editor/Assembler, is the most impressive part of the package. The full-screen editor allows up to 254 characters on one line and will scroll sideways to the left when the cursor reaches the right-hand side of the screen.
The assembler includes commands which cover any eventuality, including searching code files, deleting blocks of lines, merging and copying files and replacing one part of a file with new code. There is also a help option which will give you the key names of all the commands available through the assembler without the need to look through the well-written manual.
Spectre-Mac will also allow you to personalise commands so that you can replace the Z-80 instruction set with one of your own. That would be helpful if you had learnt assembly code programming from a book that did not use standard mnemonics.
The tailoring of commands to your own needs is the icing on the cake as far as Spectre-Mac is concerned. It is an excellent product in its own right, but the addition of a monitor of an equally high standard on a separate tape makes the package even more attractive.
Spectre-Mon provides disassembly functions on both ROM and with the ability to run machine code programs, stepping through them one instruction at a time.
Oasis has produced a powerful package which provides all the utilities which could be reasonably asked for by a machine code programmer. If, however, you do not want to write your own machine code routines you may want to use a toolkit such as SuperCode II from CP software.
That package includes 120 routines which can be used either when writing programs or within them. It covers utilities for sound graphics, error trapping of Basic programs and program protection. Supercode also includes a novel routine for entering and replaying a voice or music with the aid of a microphone or tape recorder.
The authors have thought of everything a Basic programmer might want to do in machine code but cannot.
|BEYOND BASIC||Memory: 48K||Price: £9.95||Gilbert Factor: 5|
|THE COMPLETE MACHINE CODE TUTOR||Memory: 48K||Price: £14.95||Gilbert Factor: 8|
|SPECTROSIM||Memory: 48K||Price: £7.95||Gilbert Factor: 4|
|ZX SPECTRUM ASSEMBLER||Memory: 16/48K||Price: £7.95||Gilbert Factor: 4|
|SPECTRE-MAC-MON||Memory: 48K||Price: £14.95||Gilbert Factor: 8|
|SUPERCODE II||Memory: 16/48K||Price: £9.95||Gilbert Factor: 8|