Personal Computer News
16th June 1984
Published in Personal Computer News #065
Brian Cadge welcomes a toolkit useful to all Dragon machine code programmmers.
Dig Into Dragon Code
Brian Cadge welcomes a toolkit useful to all Dragon machine code programmers
The 6809 CPU at the heart of the Dragon computer is the most powerful 8-bit processor currently available - and has given rise to more software suppliers providing more assemblers, disassemblers, monitors, debuggers and so on.
The S-22 Microsystems Toolkit Cartridge from Ashby Computer Centre combines many of these programming aids. Cartridges use almost no RAM at all, leaving it free for your machine code and Basic programs. But they do cost a few pounds more.
Features
The S-22 program is co-resident with Basic, so it can be called up at any time, either directly or from within programs. Once the cartridge is in place, all that is needed to start up S-22 is to enter EXEC 49152. Documentation for the S-22 comes as a hefty manual. As well as describing all S-22 commands, this includes tutorial and pseudo data sheets on the Dragon's hardware. In addition, there is a very basic memory map of the Dragon 32 and the S-22 cartridge. Also included is the plastic-coated Action Card, listing all the 6809 instructions and their op-codes.
G | - | Execute commands or return to Basic |
H | - | Toggle printer |
L | - | Disassemble from following address |
M | - | 'Open' memory location |
N | - | 'Names' - delete or list |
T | - | Trace facility |
W | - | Produce DATA statements |
Z | - | Reset all internal control bytes |
Some of the S-22 package's main commands, each of which can be followed with a number of values or directives |
In Use
Once S-22 is up and running, there are a number of commands available, each being invoked by a single keypress, followed by further values of directives. The G command is used to execute routines or return to Basic. H can be used to toggle printer output on and off. The manuals state that some printers may not work directly with S-22, but give no information as to which these are.
The toolkit uses the concept of opening memory locations. This can be confusing for the beginner; it's a powerful, if a little clumsy, method of addressing memory. The M command opens a memory location. If this is followed by a space character then the last address is assumed, otherwise the hex address is entered. In addition, labels can be used; a number of predefined routines are set up in S-22, such as $OUTCHV, which displays the character in the A register. All I/O is vectored, so it is relatively simply to customise.
Once a memory location is opened, you can change it by entering the new hex value or character. This method is the only way of entering machine code or data into memory from S-22. The toolkit will allow use of labels and will calculate branch offsets for you, but there is no assembler included, and all programs you write will have to be converted manually into their hex op-codes.
This same command can also be used to search for a particular byte or string of bytes in memory, useful for locating strings of text or references to routines with JSR type jumps.
The full disassembler is invoked by the L command. The amount of memory to be disassembled can be set between 1 and 255 bytes and output can also be sent to the printer. The disassembler can be used to check programs that have been entered using M as it will point out any illegal op-codes. Once you have your routine or program working properly, you might want to put it into a Basic program, using data statements.
The S-22 W command will produce data statements at the end of the current Basic program using data in RAM, together with a Rem line to identify separate routines. S-22 does not, however, check that there is sufficient memory left for the Basic before attempting to produce it; this is left to the user.
Most useful are the three separate trace tables available, each with their pseudo registers and stacks. Using the trace facility a program can be run one step at a time, the contents of each register shown after each step. This is obviously useful for rooting out bugs that are not immediately obvious.
Even more powerful is the ability to set the trace tables to the expected values of a register or registers, and have the trace aborted if the program produces the wrong results at any time. Display options available with this command include controlling the speed at which the trace runs.
GEECH ($C4BB) | Get last key input |
INTCH ($C48D) | Key input |
KLINE ($C0FE) | Effectively 'LINE INPUT' |
NAMSOR ($C1EF) | Sort a data table |
$OUTCHV | Output routine |
$PDATA | Sends a string of ASCII characters to $OUTCHV |
S-22 features a number of built-in routines which can be called by your programs |
Verdict
The S-22 toolkit is a useful addition to anyone seriously interested in machine code programing at all levels. The displays produced are easy to understand and the command system is faster to use than a menu selection method. But the lack of an assembler spoils what should and could be an excellent package. The halfway approach of allowing labels and offsets is no substitute.
However, the powerful debugging techniques offered make S-22 a good competitor to similar packages for the Dragon, such as DASH/Demon from Compusense, Dragon Data's All Dream, and Mace from Windrush.
Rating
Features 4/5 Documentation 5/5 Performance 4/5 Reliability 5/5 Overall valule 3/5