Jump to content

Recommended Posts

Posted

MAJOR EDIT: I found out how to get what I wanted (a lock on a computer that utilized multiple passwords and different actions depending on which passwords are input). Here's the code:

You'll need to make some commands:

: STRING

32 ALLOT

SWAP

!

;

: SET

@ 32 CR ." : " ACCEPT

CR

;

: PRINT

@ CR ." '" TYPE ." '"

CR

;

Then, the variables you're gonna need and set them up with a string:

VARIABLE PASS1

PASS1 STRING

VARIABLE PASS2

PASS2 STRING

VARIABLE TEMP

TEMP STRING

In order to set your passwords you're going to need to use "PASS1 SET" or "PASS2 SET" then input the password and hit enter.

This is the program:

: LOCK

BEGIN

PAGE

." Password : " CR

TEMP SET

PASS1 @

TEMP @

STRCMP

0

= IF

PAGE

CR CR ." Access Granted."

1 IOX!

80 TICKS

0 IOX!

ELSE

PASS2 @

TEMP @

STRCMP

0

= IF

PAGE

CR CR ." Access Granted."

2 IOX!

80 TICKS

0 IOX!

ELSE

PAGE

CR CR ." Access Denied! "

80 TICKS

THEN

THEN

AGAIN

;

All you have to do is type "LOCK" into the console to activate the program. If you'd like to set up one of the passwords (or simply a third password) that can access the console and all other commands again, say, for example, to make changes to your passwords, then all you have to do is, instead of:

1 IOX!

80 TICKS

0 IOX!

Do:

EXIT

And then you will be able to use the console as normal, assuming you get the password right.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...