Machine language routine on [RESET] executing

 

Running a machine language routine on [RESET) is tricky. While nothing happens to your Atari’s built-in RESET routine itself (location 61723), DOSINI (memory locations 12 and 13) is affected. The RESET routine jumps to the operating system’s warm-start routine WARMSV (58484, $E474). But DOSINI is executed during warm-start, so we can use DOSINI to trap [RESET].

To do this, you must store the low byte of your routine’s starting address into location 12, and the high byte in location 13. However, DOSINI MUST be executed. The first instruction in your routine MUST be a JSR to the original DOSINI starting location.

Now when you press [RESET], the operating system jumps to what it thinks is DOSINI but is actually your program. Then your program will JSR to the real DOSINI, and when it returns, the operating system will continue on its merry way, running the rest of your machine language program.