Classic Computer Magazine Archive COMPUTE! ISSUE 11 / APRIL 1981 / PAGE 136

Working With Basic 4.0

Jim Butterfield, Toronto

Machine Language Monitor

If you want to get printed output from the Machine Language Monitor in Basic 4.0, you'll have to call the monitor with SYS 54386.

Open your printer first, or course, with OPEN 4, 4 and set the output with CMD4 — then give the SYS call. You can't give the usual SYS 1024 or SYS 4 commands: these get to the MLM by means of a Break command, and on the 4.0 system, a break cancels the CMD.

There's a good reason for this. The BRK (Break) instruction is normally used for debugging: it stops a program in mid-execution and allows you to examine registers and memory, and to make changes if you wish. If your program under test mistakenly set the CMD value to something unwanted, you'd lose control unless the BRK set it back. So... the Break action resets output to the screen.

When you want printed output from the MLM, however, you want to enter it without resetting the output. Use the call above, which enters the monitor directly and skips the reset part.

For normal output to the screen, the usual SYS 4 will still do the job nicely.

DOS Commands

It's nice to be able to say things like SCRATCH "WORKFILE", either as a direct statement or in a program. At first glance, however, it seems that variables won't work: you can't say SCRATCH X$, where X$ defines the file name. Similarly, you can designate drive zero within a command as D0 or drive one as D1, but you can't use DN to designate drive N, where N is a variable of value 1 or 0.

It all becomes easy when you learn the syntax. Just put the variable name in parentheses and it all works. So you can say, SCRATCH (X$), D(N) and you'll remove the file whose name is defined in X$ from the drive whose number is defined by N. This kind of syntax applies generally to the DOS commands.

IEEE-488 Timeout

Most of us will never meet a timeout on the GPIB; it only happens when certain slow devices are fitted. If you do have such a device and you get a timeout, the only solution was to go back and keep trying until the device becomes ready.

On Basic 4.0, you're allowed to defeat the timeout feature if you wish and tell the PET to wait forever. You do this by setting location 1020 (hex­adecimal 03FC) to a negative value: POKE 1020, 255 will do the trick nicely in Basic. Reset the location to zero when you want to restore normal timeout action.

©Copyright 1981 Jim Butterfield