Dragon User


S-22 Toolkit /Ace Trace

Author: Keith Brain
Publisher: Ashby Computers
Machine: Dragon 32

 
Published in Dragon User #018

Getting To Grips With Machine Code

Keith and Steven Brain simplify the jargon as they take a look at the S-22 Toolkit from Ashby Computers and Microtanic's Ace Trace...

As home computer users become more experienced, they often feel that it is time they left the relatively safe haven afforded by Basic and begin to delve deeper into the box to get to grips with machine code programming.

A major problem for the novice who is looking for a machine code programming aid is that everything is steeped in jargon. There is not enough room here to explain all of this but to start with we will make a few simple definitions, which should make our comments later rather clearer.

Op-codes

A Machine Code Program consists of a series of memory locations coniaining numbers which represent specific instructions of the CPU. These numbers are known as op-codes. Although we normally use decimal (base 10) numbers the computer uses the more efficient hexadecimal (base 16) notation.

In this the letters A to F represent the digits 10 to 15, so that any number up to 255 can be indicated by two digits, which can be stored in a single byte. Unfortunately, most people find it difficult to think in hexadecimal (perhaps because they run out of fingers).

A Machine Code Monitor allows you to directly examine and modify the contents of specific memory locations. A machine code program can be created in this way: by entering the appropriate op-codes, but unless you have the memory of an elephant it is very tedious for anything other than very short programs.

As most of us are happier with words than numbers, each op-code can also be represented by a mnemonic, which gives a good indication of the action, For example: INCA (=4C) increments the value in register A by one.

A Disassembler reads the contents of memory locations and translates the opcodes into mnemonics.

A Machine Code Editor allows you to construct a text tile using mnemonics (rather like a Basic program) which you can easlily modify during program development. This text file is known as the source code and it cannot be executed directly.

An Assembler translates the source code into object code, which is the final machine code routine. This is very compact, but difficult to edit. A Trace program allows you to run your program in slow motion, with disassembly and/or display of the contents of each CPU register at each step.

Although a number of machine code programming tools have been available for the Dragon for some time, two new products have recently entered the arena.

The S-22 Microcomputer Systems Toolkit consists of a small cartridge and extensive manual in what can only be described as an emnormous cardboard box, whilst Microtanic Software's Dragon Ace Trace comes on cassette, together with a slimmer manual, in a "video box".

The S-22 Toolkit is extremely well-sealed into a small cartridge. Unfortunately, it is rather difficult to slide into the Dragon cartridge port, as to line up the PCB with the internal edge connector you must leave about 3mm of fresh air under the lower edge of the box! (Extensive fumbling and cursing soon gave way to standing the Dragon on its side for insertion!)

The manual is in two parts, extending to over one hundred pages, but we found that it did not live up to its promise of being "easy to understand". Undoubtedly the coverage is comprehensive but the style is a strange mixture of Listen with Mother, Advanced Computer Science, Successful Salesmanship and a political manifesto, in which the thread somehow seems to gat lost on the way.

Virtuous

For example, on page 3 the author states "I will now take a pause as you read the programming manual for the 6B09, and a book on machine code programming. If you return still in one piece and sane, I will continue to introduce S-22 to your machine". However, regrettably, he makes no suggestions on what to read, but instead continues to extol the virtues of the product at great length ("It's a workhorse and will probably never be to far from your micro" - "that will serve you in years to come".

One major difference between S-22 and many other machine code tools for the Dragon is that it does not contain an assembler. The manual explains mnemonics but then goes on to claim that "symbolic assembly is more associated with 'development rnachines' where very large programs needing mass disk storage are written".

Assemblers

Of course learning all the op-codes by heart is undoubtediy good lor the soul but many excellent small system assemblers are available which make life so much easier for the machine code programmer.

S-22 is independent of Basic having its own input/output routines with auto repeat and diversion to the printer port available. Commands are entered by single keypresses and a high degree of nesting is supported. A logical memory address system is used which saves a lot of unnecessary typing, and memory locations can be named (as for labels in an assembler).

A major feature claimed for S-22 is the tracing facility included which allows you to step through your machine code program examining register contents at each point. Breakpoints are set by automatically inserting the software interrupt op-code (&H3F) at appropriate points so that only routines resident in RAM can be traced. A disassembler is included and blocks of memory are easily relocated.

One interesting feature is the WRITE command which instantaneously transforms the contents of a series of defined memory locations into Basic data statements. This makes inclusion of machine code subroutines into Basic programs very straightforward.

Many internal S-22 routines are documented but of course these are only available with the cartridge in place - and you are warned against copying them! Some example programs are included, together with "pseudo data (?)" sheets on the 6809, 6883 SAM Chip, and 6847 video display generator, together with some incomplete information on standard Dragon routines.

Our overall feelings are that, although it contains some novel features, the lack of an assembler (despite the price tag of £39.95), and the confused documentation makes this a rather unattractive package.

Ace Trace

Ace Trace contains 9.25K of code which normally starts at &H600 (that is, the first graphics page) but since it was written in position independent code it can be located anywhere in memory between &H0600 and &H5B00 on the Dragon 32 (or even higher on the Dragon 64), providing considerable flexibility. This does, however, restrict the amount of memory available for your programs, although this is unlikely to be of practical significance for most users.

If you leave Ace Trace in its default location on the graphics pages it will almost survive a system reset and Basic cold start (only six documented bytes need to be re-entered). The screen display is rather unusual in that green characters are produced on a black background. This is claimed to minimise eye strain, and made it obvious when you switched back and forth to Basic.

The manual is much briefer than the S-22 version, but gives a well-presented introduction to the system with some example programs. The monitor provided a standard set of memory examine and modify commands, together with S(shift) of blocks of memory, V(erify) of two blocks of memory, Disassembly and R(egister) display.

The Editor provides a comprehensive range of two-letter commands to construct your source file which can then be assembled to memory. FCB, FCC, FDB, DRG and RMB directives, decimal, hex and binary number bases, addition, subtraction, ASCII characters and labels are all supported, and the line editor is easier to use than the Microsoft Basic version. Lines can be renumbered, so that it is easy to insert additional material.

The assembler is of the two pass type and plain English error messages indicating the defective line are produced. Source code can be saved and loaded within the editor/assembnier, and object code with the normal CSAVEM/CLOADM commands.

The Trace facility is very unusual and interesting as it runs in real time (at 1/500 speed) and allows tracing in both RAM and ROM. At each step disassembly and or a register dump can be displayed, without setting breakpoints, and tracing can be stopped and started by pressing the space bar at any point.

Appealing

Although it does not have all the features of some other "all singing - all dancing" assemblers (for example, assembly direct to tape or disk) the Trace facility is a plus point and this is a very competitive product which should appeal to the novice. It is perhaps unkind to say that one of the most attractive features of Ace Trace to many users must be the price, but at only £14.95 it undercuts most of the opposition by a mile, which leaves you with more than enough spare cash to buy some decent books on machine code programming. This must be a winner.

Keith BrainSteven Brain