Disabling the STOP key

Started by Blacklord, July 28, 2009, 07:29 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Blacklord

The STOP key can be disabled so that a program cannot be accidentally (or deliberately) stopped.

METHOD A is quick. Any cassette tape activity will reset the STOP key to its normal function, however.

Original ROM: Disable STOP with POKE 537, 136
              Restore STOP with POKE 537, 133
Upgrade ROM:  Disable STOP with POKE 144, 49
              Restore STOP with POKE 144, 46
4.0 ROM:      Disable STOP with POKE 144, 88
              Restore STOP with POKE 144, 85

Method A disconnects the computer's clopk (TI and TI$). If your program needs these, use method B.

METHOD B is more lengthy, but does not disturb the clocks. This method prohibits cassette tape activity.

Original ROM:  100 R$ = "20 > : ?? : 9??8 = 09024 < 88 > 6"
               110 FOR I = 1 TO LEN(R$)/2
               120 POKE I + 900, ASC(MID$(R$, I * 2- - 1))* 16 + ASC(MID$ (R$, I*2)) - 816 : NEXT I

After the above has run:

                Disable STOP with POKE 538, 3
                Restore STOP with POKE 538,230
Upgrade ROM:    100 R$ = " 20> :??: 9??8 = 9;004 <31> 6"
                110 FOR I = 1 TO LEN(R$)/2
                120 POKE I + 813, ASC(MID$(R$,I* 2-1))*16 + ASC(MID$(R$, I*2))- 816 : NEXT I

After the above has run:

                Disable STOP with POKE 145, 3
                Restore STOP with POKE 145, 230
4.0 ROM :       100 R$ = "20 > :??: 9??8 = 9;004 <58> 4"
                110 FOR I < 1 TO LEN(R$)/2
                120 POKE I + 852, ASC(MID$(R$,I*2 - 1))*16 + ASC(MID$*R$, I*2)) - 816 : NEXT I

After the above has run:

                Disable STOP with POKE 145, 3
                Restore STOP with POKE 145, 228

How they work: Method A skips the clock update and stop key test. Method B builds a small program into low memory which allows the clock update and stop key test to be performed, but then nullifies the result of this test. The small program for method B is contained in R$ in "pig hexadecimal" format. Machine language programmers would read this as: 20 EA FF (do clock update, stop key test) A9 FF 8D 9B 00 (cancel stop test result) 4C 58 E4 (continue with keyboard service, etc.)

Copyright 1981 Jim Butterfield

Blacklord

This note provides a method for disabling the STOP key on either old (2001-4, 2001-8) or new (2001-16, 2001-32) PETs with a single algorithm, even though the locations and contents to be POKED are different. It is based on Len Lindsay's PET-POURRI column in the July 1979 issue of Kilobaud Microcomputing, but provides a correction and avoids a potential problem in the procedure he presented.

In PETs using Version 1 ROMs (models 2001-4 and 2001-8 which have not been modified), the STOP key is disabled with

10 POKE 537, 136

and re-enabled with

20 POKE 537, 133

PETs equipped with Version 2 ROMs (2001-16, 2001-32, and modified 2001-4 and 2001-8) may use the following to disable the STOP.

10 POKE 144, 49

To re-enable the STOP,

20 POKE 144, 46

A composite procedure, which will work on either machine, is based on the contents of memory location (50003). In the old ROM, PEEK (50003) gives a value of 0, while the new ROM returns a value of 1. The following BASIC program segment uses that value to adjust a POKE command for the machine it's running on.

To disable the STOP, use

10 PT = PEEK (50003) : SL = 537-393 * PT : DL = 136-87 * PT : POKE SL, DL

To re-enable the STOP, use

20 PT = PEEK (5003): SL = 537-393 * PT : DL = 133-87 * PT : POKE SL, DL

The advantage of this version of the routine is that it always pokes the same value into the control location, no matter how many times the program is run.

Versions of the form

POKE SL, PEEK (SL) + 3

can cause unpredicted results (including loss of control) if they are executed more than once.