If SAV=1 Then Text 77,241," OVERWRITE " : NEWFILE$=""
If SAV=-1 Then Text 77,241,"SAVE SEPERATELY"
If SAV=-1 Then Screen Hide : NEWFILE$=Fsel$("df0:","","-->CODEMASTER<--","ENTER A DESTINATION FILE") : Screen Show : If NEWFILE$="" Then SAV=1 : SAV_TYPE
End Proc
'
Procedure ACTION
Rem *** ALTER CODE KEY ***
If MZ=1 and MK=1 and CODE<900 Then CODE=CODE+100
If MZ=1 and MK=2 and CODE>99 Then CODE=CODE-100
If MZ=2 and MK=1 and CODE<990 Then CODE=CODE+10
If MZ=2 and MK=2 and CODE>9 Then CODE=CODE-10
If MZ=3 and MK=1 and CODE<999 Then CODE=CODE+1
If MZ=3 and MK=2 and CODE>0 Then CODE=CODE-1
PREP_CODE
Rem *** select a file ***
If MZ=6 Then WOT_FILE
Rem *** change scramble type ***
If MZ>6 and MZ<14 Then SCRAMBLE_TYPE=MZ-6 : CLEAR_INDICATORS
Rem *** scramble ***
If MZ=4 Then SCRAMBLE
Rem *** unscramble ***
If MZ=5 Then UNSCRAMBLE
Rem *** quit ***
If MZ=14 and MK=3 Then Close : Stop
Rem *** log menu
If MZ=15 and MK=1 Then SCRAMBLE_LOG
Rem *** exe script ***
If MZ=16 and MK=3 Then EXECUTE
Rem *** script ***
If MZ=17 and(MK=1 or MK=2) Then SCRIPT
Rem *** FILE ***
If MZ=19 and MK=1 Then FILE_OPTIONS
Rem *** save type ***
If MZ=18 Then SAV=SAV*-1 : SAV_TYPE
Rem *** information window ***
If MZ=20 Then INFORMATION
'
End Proc
'
Procedure TEST_ZONE
Repeat
MZ=Mouse Zone
MK=Mouse Key
Until MK=1 or MK=2 or MK=3 and MZ>0
Wait 5
End Proc
'
Procedure PREP_ZONE
Reserve Zone 20
Set Zone 1,215,133 To 235,151
Set Zone 2,249,133 To 268,151
Set Zone 3,286,133 To 303,151
Set Zone 4,11,56 To 121,85
Set Zone 5,180,56 To 310,85
Set Zone 6,210,90 To 310,120
Set Zone 7,30,115 To 140,130
Set Zone 8,30,130 To 140,145
Set Zone 9,30,145 To 140,159
Set Zone 10,30,159 To 140,173
Set Zone 11,30,173 To 140,187
Set Zone 12,30,187 To 140,201
Set Zone 13,30,201 To 180,215
Set Zone 14,213,203 To 306,220
Set Zone 15,8,26 To 111,50
Set Zone 16,111,26 To 206,50
Set Zone 17,208,26 To 310,50
Set Zone 18,8,225 To 205,250
Set Zone 19,210,225 To 310,250
Set Zone 20,213,170 To 306,190
End Proc
'
Procedure CLEAR_INDICATORS
Ink 1,0
If SCRAMBLE_TYPE=1 Then Text 16,127,"><" Else Text 16,127," "
If SCRAMBLE_TYPE=2 Then Text 16,140,"><" Else Text 16,140," "
If SCRAMBLE_TYPE=3 Then Text 16,155,"><" Else Text 16,155," "
If SCRAMBLE_TYPE=4 Then Text 16,168,"><" Else Text 16,168," "
If SCRAMBLE_TYPE=5 Then Text 16,182,"><" Else Text 16,182," "
If SCRAMBLE_TYPE=6 Then Text 16,196,"><" Else Text 16,196," "
If SCRAMBLE_TYPE=7 Then Text 16,210,"><" Else Text 16,210," "
End Proc
'
Procedure PREP_CODE
Ink 1,0
If CODE>99
Text 220,145,Mid$(Str$(CODE),2,1)
Text 256,145,Mid$(Str$(CODE),3,1)
Text 291,145,Mid$(Str$(CODE),4,1)
End If
If CODE<100
Text 220,145," "
Text 256,145,Mid$(Str$(CODE),2,1)
Text 291,145,Mid$(Str$(CODE),3,1)
End If
If CODE<10
Text 220,145," "
Text 256,145," "
Text 291,145,Mid$(Str$(CODE),2,1)
End If
End Proc
'
Procedure INFORMATION
INFO$=" Codemaster was written by andrew king ( in AMOS ) from the 15th of june to the 27th of june 1991. You should look out for annother disc of mine which contains various convertors and an organiser. "
INFO$=INFO$+"The convertors manipulate the following :- weights, linear measures, square measures, morse code and roman numerals. The disc is available from the AMOS pd library, i'm not sure which disc but im sure "
INFO$=INFO$+"owner ( Sandra ) will know. If you find any bugs in this program, or you are having some problems, I would appreciate a call. ( 0273 683998). "
INFO$=INFO$+"Appologies go to those fellow amos programmers who find the procedures locked "
INFO$=INFO$+"this is because of security reasons. The program wouldn't be much good if everyone could hack it. The procedures are simple, but if you really cant figure out roughly how this works I will be glad to get you started. "
SPEED=7
Repeat
Text 220,183,Mid$(INFO$,I,10)
Inc I
Wait SPEED
If I+10=Len(INFO$) Then I=1
Until Mouse Key=1 or Mouse Key=2 or Mouse Key=3
End Proc
'
Procedure WOT_FILE
WF_MARKER:
Screen Hide
FILENAME$=Fsel$("","","CODEMASTER V1.0","select a file")
If FILENAME$="" Then FILENAME$=" "
Screen Show
End Proc
'
Procedure FILE_OPTIONS
Screen Open 1,320,260,2,LOWREZ
Curs Off
Palette $0,$FFF
Cls 0
Locate 8,5 : Print "DISC OPERATIONS MENU"
Locate 8,6 : Print "--------------------"
Locate 3,10 : Print "(1)...MAKE NEW DIRECTORY...(1)"
Locate 3,12 : Print "(2).....RENAME A FILE......(2)"
Locate 3,14 : Print "(3).....DELETE A FILE......(3)"
Locate 3,16 : Print "(4)..RETURN TO CODEMASTER..(4)"
FILE_MARKER:
Locate 6,20 : Input "WHAT IS YOU CHOICE.....";CH
If CH=1 Then NEWDIR$=Fsel$("df0:","","-->CODEMASTER<--","enter new directory ") : If NEWDIR$<>"" Then Mkdir NEWDIR$ : NEWDIR$=""
If CH=2 Then OLD$=Fsel$("df0:","","-->CODEMASTER<--","select file") : NEW$=Fsel$("df0:","","-->CODEMASTER<--","enter a new name") : Rename OLD$ To NEW$
If CH=3 Then DEADUN$=Fsel$("df0:","","-->CODEMASTER<--","select file to kill") : If DEADUN$<>"" Then Kill DEADUN$ : DEADUN$=""
If CH=4 Then Screen Close 1 : Screen To Front 0 : Screen 0 Else Goto FILE_MARKER
End Proc
'
Procedure PERCENT_DONE
A#=ACCESS
B#=FILE_LENGTH
C#=100
D#=A#/(B#/C#)
E=D#
OUTPUT$=Str$(E)
Ink 1,0
Text 135,76,OUTPUT$
If OUTPUT$>Str$(98) Then Text 135,76," "
End Proc
'
Procedure SCRIPT
If SCRIPT_NUM<50 Then Inc SCRIPT_NUM : S_FILE$(SCRIPT_NUM)=FILENAME$ : S_C(SCRIPT_NUM)=CODE : S_ST(SCRIPT_NUM)=SCRAMBLE_TYPE : S_SAV(SCRIPT_NUM)=SAV : S_NF$(SCRIPT_NUM)=NEWFILE$ : Bell : Wait 30 Else Boom : Wait 30
End Proc
'
Procedure EXECUTE
If SCRIPT_NUM=0 Then Pop Proc
For S=1 To SCRIPT_NUM
FILENAME$=S_FILE$(S)
SCRAMBLE_TYPE=S_ST(S)
CODE=S_C(S)
SAV=S_SAV(S)
NEWFILE$=S_NF$(S)
SCRAMBLE
Next S
Bell
Wait 10
SCRIPT_NUM=0
End Proc
'
Procedure SCRAMBLE_LOG
CF=1
Open Random 1,"df0:log_dat_1"
Field 1,5 As QNTY$
Get 1,1
Close 1
QNTY=Val(QNTY$)
'
If QNTY>0 Then Open Random 1,"df0:log_dat_2" : Field 1,20 As FILE$,4 As C$,2 As T$ : For IND=1 To QNTY : Get 1,IND : ST(IND)=Val(T$) : C(IND)=Val(C$) : FILE$(IND)=FILE$ : Next IND : Close 1
'
Load Iff "df0:iff/log.iff"
Reserve Zone 6
Set Zone 1,14,39 To 146,72
Set Zone 2,14,79 To 146,112
Set Zone 3,14,119 To 140,152
Set Zone 4,14,159 To 50,192
Set Zone 5,203,161 To 234,191
Set Zone 6,242,160 To 273,193
AP=1
'
'
SHRED:
Ink 2,0
Text 225,125,Str$(QNTY)
Text 50,250," "
If QNTY>0 Then Text 50,220,FILE$(AP)
Repeat : Until Mouse Key=1 or FINISH=True : Wait 10
If Mouse Zone=1 and FINISH<>True and QNTY<50 Then Goto SL_ADD
If Mouse Zone=2 and FINISH<>True and QNTY>0 Then Goto SL_UNS
If Mouse Zone=3 and FINISH<>True Then FINISH=True
If Mouse Zone=4 and FINISH<>True and QNTY>0 Then Goto SL_QUES
If Mouse Zone=5 and FINISH<>True and AP>1 Then AP=AP-1 : Text 70,170," " : Text 100,185," "
If Mouse Zone=6 and FINISH<>True and AP<QNTY Then AP=AP+1 : Text 70,170," " : Text 100,185," "
If FINISH=True Then OUT=1 : FINISH=False : Pop Proc
Goto SHRED
'
'
'
SL_ADD:
If SAV=1 Then If FILENAME$="" Then Boom : Wait 10 : Goto SHRED
If SAV=-1 Then If NEWFILE$="" Then Boom : Wait 10 : Goto SHRED
QNTY=QNTY+1
If SAV=1 Then FILE$(QNTY)=FILENAME$
If SAV=-1 Then FILE$(QNTY)=NEWFILE$
ST(QNTY)=SCRAMBLE_TYPE
C(QNTY)=CODE
Open Random 1,"log_dat_2"
Field 1,20 As FILE$,4 As C$,2 As T$
FILE$=FILENAME$
C$=Str$(CODE)
T$=Str$(SCRAMBLE_TYPE)
Put 1,QNTY
Close 1
Open Random 1,"log_dat_1"
Field 1,5 As QNTY$
QNTY$=Str$(QNTY)
Put 1,1
Close 1
FINISH=True
Goto SHRED
'
'
SL_UNS:
SCRAMBLE_TYPE=ST(AP) : CODE=C(AP) : FILENAME$=FILE$(AP) : Repeat : If Mid$(FILENAME$,Len(FILENAME$),1)=" " Then FILENAME$=Mid$(FILENAME$,1,Len(FILENAME$)-1) : Until Mid$(FILENAME$,Len(FILENAME$),1)<>" "
UNSCRAMBLE
Open Random 1,"log_dat_2"
Field 1,20 As F$,4 As C$,2 As T$
Get 1,QNTY
ST(AP)=Val(T$) : FILE$(AP)=F$ : C(AP)=Val(C$)
QNTY=QNTY-1
For X=1 To QNTY
F$=FILE$(X) : C$=Str$(C(X)) : T$=Str$(ST(X))
Field 1,20 As F$,4 As C$,2 As T$
Put 1,X
Next X
Close 1
Open Random 1,"log_dat_1"
Q$=Str$(QNTY)
Field 1,5 As Q$
Put 1,1
Close 1
FINISH=True
Goto SHRED
'
'
'
SL_QUES:
If ST(AP)=1 Then Text 70,170," INCREMENT "
If ST(AP)=2 Then Text 70,170," FORMULA "
If ST(AP)=3 Then Text 70,170," SIMPLE "
If ST(AP)=4 Then Text 70,170," COMPLEX "
If ST(AP)=5 Then Text 70,170," DIABOLICAL "
If ST(AP)=6 Then Text 70,170," RIDICULOUS "
If ST(AP)=7 Then Text 70,170,"SHEER MADNESS"
Text 100,185,Mid$(Str$(C(AP)),2,3)
Goto SHRED
End Proc
'
'
Procedure SCRAMBLE
If Not Exist(FILENAME$) Then Pop Proc
If SCRAMBLE_TYPE=1 Then SCRAMBLE_INCREMENT
If SCRAMBLE_TYPE=2 Then SCRAMBLE_FORMULA
If SCRAMBLE_TYPE=3 Then SCRAMBLE_SIMPLE
If SCRAMBLE_TYPE=4 Then SCRAMBLE_COMPLEX
If SCRAMBLE_TYPE=5 Then SCRAMBLE_DIABOLICAL
If SCRAMBLE_TYPE=6 Then SCRAMBLE_RIDICULOUS
If SCRAMBLE_TYPE=7 Then SCRAMBLE_SHEERMADNESS
End Proc
Procedure SCRAMBLE_INCREMENT
Open Random 1,FILENAME$
If SAV=-1 Then Open Random 2,NEWFILE$ : Field 2,1 As CHARACTER$
FILE_LENGTH=Lof(1)
Field 1,1 As CHARACTER$
For ACCESS=1 To Lof(1)
Get 1,ACCESS
CHAR=Asc(CHARACTER$)+CODE
Repeat
If CHAR>255 Then CHAR=CHAR-255
If CHAR<1 Then CHAR=CHAR+255
Until CHAR<256 and CHAR>0
CHARACTER$=Chr$(CHAR)
If SAV=1 Then Put 1,ACCESS
If SAV=-1 Then Put 2,ACCESS
If CF=0 Then PERCENT_DONE
Next ACCESS
Close
Bell
End Proc
Procedure SCRAMBLE_FORMULA
Open Random 1,FILENAME$
If SAV=-1 Then Open Random 2,NEWFILE$ : Field 2,1 As CHARACTER$
FILE_LENGTH=Lof(1)
Field 1,1 As CHARACTER$
For ACCESS=1 To Lof(1)
Get 1,ACCESS
CHAR=Asc(CHARACTER$)+(ACCESS-CODE)
Repeat
If CHAR>255 Then CHAR=CHAR-255
If CHAR<1 Then CHAR=CHAR+255
Until CHAR<256 and CHAR>0
CHARACTER$=Chr$(CHAR)
If SAV=1 Then Put 1,ACCESS
If SAV=2 Then Put 2,ACCESS
If CF=0 Then PERCENT_DONE
Next ACCESS
Close
Bell
End Proc
Procedure SCRAMBLE_SIMPLE
OLD=0
Open Random 1,FILENAME$
If SAV=-1 Then Open Random 2,NEWFILE$ : Field 2,1 As CHARACTER$
FILE_LENGTH=Lof(1)
Field 1,1 As CHARACTER$
For ACCESS=1 To Lof(1)
Get 1,ACCESS
CHAR=Asc(CHARACTER$)+(OLD-CODE)
OLD=Asc(CHARACTER$)
Repeat
If CHAR>255 Then CHAR=CHAR-255
If CHAR<1 Then CHAR=CHAR+255
Until CHAR<256 and CHAR>0
CHARACTER$=Chr$(CHAR)
If SAV=1 Then Put 1,ACCESS
If SVA=-1 Then Put 2,ACCESS
If CF=0 Then PERCENT_DONE
Next ACCESS
Close
Bell
End Proc
Procedure SCRAMBLE_COMPLEX
OLD=0 : VERYOLD=0
Open Random 1,FILENAME$
If SAV=-1 Then Open Random 1,NEWFILE$ : Field 2,1 As CHARACTER$
FILE_LENGTH=Lof(1)
Field 1,1 As CHARACTER$
For ACCESS=1 To Lof(1)
Get 1,ACCESS
CHAR=Asc(CHARACTER$)+((OLD-CODE)-(VERYOLD-CODE))
VERYOLD=OLD
OLD=Asc(CHARACTER$)
Repeat
If CHAR>255 Then CHAR=CHAR-255
If CHAR<1 Then CHAR=CHAR+255
Until CHAR<256 and CHAR>0
CHARACTER$=Chr$(CHAR)
If SAV=1 Then Put 1,ACCESS
If SAV=-1 Then Put 2,ACCESS
If CF=0 Then PERCENT_DONE
Next ACCESS
Close
Bell
End Proc
Procedure SCRAMBLE_DIABOLICAL
OLD=0 : VERYOLD=0
Open Random 1,FILENAME$
If SAV=-1 Then Open Random 2,NEWFILE$ : Field 2,1 As CHARACTER$