ON ERROR! by Miles Kinloch [The loader didn't work as listed as there were only 103 bytes of DATA and ] [it tried to load 104. The 104th byte is just used to store the error code,] [so I just added 0 at the end. JimG] Miles Kinloch, that rings a bell. Ah! Here we are - Issue 46 Fractal Triangles ~ by Miles Kinloch. I thought as much. So no stranger to these fair pages, Miles returns in style with, as you may have guessed from the title, an error-trapping routine. Nice and short, just as it should be, and the whole thing oozes with user-definability. Not only can you tell the routine which program line to jump to in the event of an error, but you can also read the number of the error, and relocate the actual routine absolutely anywhere in the RAM. Good, eh? To get the routine up and running, type in and run the Decimal Loader. This will save out the machine code to tape. Then reset your Speccy and type in the demo program, saving it with SAVE "prog" LINE 9990 (so it will load in the machine code on running). The Instructiony Bit! First of all, you must tell the routine which line to jump to when an error is detected. To do this, divide the line number by 256. Then POKE the answer into the 81st address, and the remainder into the 80th address. In the example program (line 150), the code begins at 40000, and so the required line number (500) is POKEd into 40079 and 40080 (the 80th and 81st addresses). Next, turn the error-trapping on by using RANDOMIZE USR folLowed by your start address (in the demo it's 40000). This MUST be done from a BASIC program, though, as simply entering it as a command has no effect. Also, don't try to turn the trapping on when it's already on, as this could have nasty results. When the routine detects an error, the number of the error can be found by PEEKing at the 104th address (40103 in the demo). Finally, trapping can be turned off by RANDOMIZE USR, then the 90th address. On compatibility - the routine works best on 48Ks, as it recognises all the 48K errors, but might not be able to cope with those resulting from special 128K commands (which, if I'm correct, comprise just PLAY and SPECTRUM). And finally, SAM owners needn't feel left out, as the Coupe already has an error-trapping routine built into the ROM. Read the manual!