|★ APPLICATIONS ★ PROGRAMMATION ★ LARA|Amstrad Action) ★|
LARA is a toolbox utility for machine coders and it's a teensy bit on the clever side. No hang on, it's more than that - it is in fact remarkably clever!
If somebody walked up to you in the street, and whispered in your ear, "Ere, squire, fancy a top-quality machine code utility for only £5?” you'd probably be quite tempted. But buy it, and you'd have wasted your money, because this month's covertape contains just such a utility and it's completely free.
We couldn't put the instructions for LARA on the tape, because they're 45K long. There also written in German. This is a pity, because it can be tricky to use. However, this short tutorial should get you acquainted with what is possibly the best Z80 monitor available for the CPC.
LARA positions itself in extra memory if you have a 128K computer, so as not to corrupt the main program. You can load LARA, exit (press E followed by ENTER), load the program you want to have a look at, and then re-enter LARA (with SHIFT and function key 9). 64K users are restricted to the memory below &4000, which is okay for programs of less than 16K.
LARA commands mostly consist of a single letter, sometimes followed by one or more parameters. The first command you should know is H (or ?) which brings up a help-screen of all the available commands. When it pauses, press any key to progress to the second screen.
Let's have a look at a few of these commands. To dump memory to the screen, type D followed immediately by the address from where you want to start (for example, DBB00 to start from &BB00). After a while, the memory dump will stop: just press D and ENTER to carry on from where you left off. You can also disassemble code: instead of typing D, use L instead.
This is all well and good, but it's possible that you don't have anything in memory to look at right now. No problem: load in a file using the R command. If you want to load it to a specific address, add a comma followed by the address (in hex) at the end of this. CP/M .COM files can be read by using the CR command.
You can also use LARA to look at ROMs. To do this, type K followed by the ROM number (for example, K07 will select the disk ROM), and then disassemble or dump as usual - remember that ROMs sit between &C000 and &FFFF. KFF returns to RAM.
To alter the contents of memory, use the S command followed by an address ($4000 alters &4000 onwards). The address will be shown, followed by its present contents, and a cursor for you to type in a new value - or simply press ENTER to move to the next one. ESC quits this mode. To make it easy to enter text into memory, the P command is available, which is followed by the relevant address and text (e.g. P170,Another great program with AA!)
Perhaps you need to search for some bytes. LARA's Q command comes in here: for example, to search between &4000 and &7FFF for the sequence &CD,&18,&BB, type Q4000,7FFF,CD,18,BB . You can also look for strings: if you wanted to search the whole of memory for the string “hazelnuts', you would type QT0000,FFFF,hazelnuts - Easy!
At some time you'll probably want to execute a machine code routine in memory: to do this, type G followed by the address. Two break points (i.e. places where the computer pauses and reports what's going on) can be set, the address of which should be added to the G command with a preceding comma (for example, G3000,3012 would execute code from &3000, and stop when &3012 is reached).
If you're not exactly sure what effect the routine will have on memory, 128K owners can use the commands YG and YP: YP puts the contents of memory into your extra memory (as a backup), and YG gets it back again. 64K owners, obviously, can't use this facility. You can move small areas of memory to a safe place somewhere else using the M command (M2800,29FF,8000 copies the bytes between &2800 and &29FF to &8000).
We could go on for hours, but now that you know the basics, you can just as easily find out by experimentation. (Besides, there's no space left.) The program is great for debugging code and examining other people's: 128K owners should even be able to use it in conjunction with the Multiface's "jump” function to hack into games. Now, no program is safe (evil cackle)...