Previous Page > Listing Index > Ace Protection.
Personal Computing World December 1983
T J's Workshop logo

The following three words for
the Jupiter Ace should be of some use to anyone who wants to protect the programs they are writing for example, if they are selling them.

The three protection words all work by altering the dictionary in some way so that the word cannot be listed or edited. P1 changes the code-field of the word the bit that tells the computer how to execute the word to something that the listing mechanism will not recognise and so will not list,
but which the computer will still execute correctly.
if an attempt is made to protect a word that does not exist, has already been protected, or is not normally listable, the word generates an ERROR 15.

(This is done by storing the required error number in the system variable ERR_NO, and then executing ABORT.) If you try to list a protected word, you get ERROR 14 as you do when you try to list a variable, etc.

P2 should only be used once a Forth program is complete as once it has been used on a word it becomes impossible to type in the name of that word. It works by making the first character of the name an inverse space. This makes the listing mechanism think that the word's name is a single space, which of course you cannot type in as it is the normal delimiter. Any words that call the word you have just protected will still operate correctly so long as you don't try to edit them.

The best way to use the protection words is to use P1 on the main word or any ones that the user is going to have to

type in and then to use P2 on all the other words in the dictionary. After this has been done, P1 and P2 can be forgotten if required.

The third word, P3, enables you to put a passcode on a word. To use it, define the word as normal, but with the name consisting of a letter followed by the passcode you have defined for that word.

For example,
: xpass ('pass' is the passcode)
(normal word definition)

Now type P3 xpass which protects the word. Now VLIST, and you will see that the word name has changed to just X and your pass code has not been shown. However, if you try to execute, list, or edit the word, you have to type in the full name including the passcode.

The syntax for all three words is 'pi wordname' .

- Adam Hinkly

: P1

3779 = SWAP 4229 =
OR SWAP 4360 = OR

DUP @ 1- SWAP !


15 15421 C! ABORT



: P2

FIND DUP 1- C@ 63
AND 5 + - 128


: P3

63 AND 5 + -
DUP C@ 128 0R SWAP


Ace Protection