Classic Computer Magazine Archive ANTIC VOL. 7, NO. 9 / JANUARY 1989

Macro RESET

Customized command triggering

By Brad Timmins

Macro RESET is a handy, powerful routine enabling programmers to use the [RESET] key to trigger any command series controlling the BASIC Editor. The BASIC program creates a machine language routine that works on all 8-bit Atari computers of any memory size, with disk drive.

Just about anybody who ever wrote a BASIC program has sometimes wanted to customize the BASIC Editor for various special uses. You might want to change the screen colors, for instance, or change the left and right screen margins. Such changes are quite easy to make – requiring only a few simple POKES. But then if the [RESET] key is pressed, virtually every change made to the Editor will return to its default value.

There have been many machine language routines written that "protect" selected memory locations from being set back to their default values when the [RESET] key is pressed. This makes it easier for you to customize a few aspects of the Editor. But what if you want something more complicated? Maybe you'd like your program to automatically LIST every time you press [RESET]. Or maybe you want [RESET] to automatically SAVE an updated copy of your program?

Macro RESET lets you create your BASIC subroutines which will be RUN every time you press the [RESET] key. In other words, you can now easily program [RESET] to perform any series of BASIC commands you wish.

GETTING STARTED

Type in Listing 1, RESET. BAS, check it with TYPO II and SAVE a copy before you RUN it. When RUN, RESET.BAS creates a machine language program called RESET.EXE. Antic Disk Subscribers will find RESET.EXE on the monthly disk, along with RESET.M65, the MAC165 assembly language source code. You do not need RESET. M65 to use Macro RESET.

Don't try to run Macro RESET from the Antic Monthly Disk. Copy RESET.EXE to another disk that has the DOS.SYS file on it. Then rename RESET.EXE to AUTORUN.SYS.

Turn your Atari off and place your Macro Reset disk into drive 1. Now, turn on your Atari and Macro RESET will automatically load and start. You'll first see a message teffing you that Macro RESET is turned off. Hold down the [OPTION] key and press the [RESET] key to turn to it on. Holding down the [OPTION] key and pressing the [RESET] key acts as a toggle switch, turning Macro RESET on and off.

Let's try a short example. Turn on Macro RESET and type:

	31000 PRINT "HI, MOM!"
Now press the [RESET] key and watch Macro RESET go to work. Whenever you press the [RESET] key, Macro RESET enters two BASIC commands:

	POKE 842,12:GOTO 31000
When BASIC receives these commands, it executes them the same way it would have if you had typed the line and pressed the [RETURN] key.

The first command – POKE 842,12 – turns off the Forced Read mode. The second command sends your Atari to your own subroutine. Make sure your subroutine starts at line 31000 and it will automatically execute every time you press [RESET]. Macro RESET uses Page Six, but leaves the first 84 bytes free for your use.

FORCED READ

After Macro RESET prints its two BASIC commands on the screen, it uses your Atari's "[RETURN] key mode" or "Forced Read mode" to enter those commands into BASIC.

If you imagine an invisible finger rapidly pressing the [RETURN] key over and over again, you've got a good idea of what this mode is all about. Next time you use TYPO II, keep an eye on the cursor After TYPO II calculates a two-letter code for the line you typed, it uses the Forced Read mode to add that line to your program.

Forced Read mode comes in handy when you want a BASIC program to modify itself. The program will PRINT the program line in the middle of the screen, put the cursor at the top of the screen, then use the Forced Read to enter that line into the program. This technique forces the Editor to execute BASIC commands generated by another program.

Brad Timmins of Sandy, Utah has been programming on the Atari for five years. He is making his Antic debut in this issue.

On DISK: RESET.EXE Download

On DISK: RESET.M65 Download / View