home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Crawly Crypt Collection 2
/
crawlyvol2.bin
/
apps
/
desktops
/
hazel_4
/
hazel_4.lst
< prev
next >
Wrap
File List
|
1994-09-04
|
23KB
|
909 lines
' ******************************************************************************
' * *
' * Greg "Paranoid Jellyfish" Knauss's *
' * *
' * H . A . Z . E . L. *
' * *
' * A Selective Loader for *
' * DESKTOP.INF, AUTO, ASSIGN.SYS, DA and GENEVA configuration files *
' * *
' * modified with much trepididation *
' * and the Retention of the Master's Original Commentary *
' * for readers of "Current Notes" and other worthies in the Atari Community *
' * by Henry K van Eyken, September 1994 *
' * *
' * (Modification 3) *
' * *
' ******************************************************************************
'
' H.A.Z.E.L. is in the public domain and may be freely distributed. She always
' was sort of a tramp...
'
' Only do the program if they're holding down the left SHIFT key...
'
IF (BIOS(11,-1) AND 2)=2 THEN
'
' Get the resolution
'
old_res%=XBIOS(4)
res%=old_res%
'
' If they're in low, move it to medium
'
IF res%=0 THEN
VOID XBIOS(5,L:-1,L:-1,1)
res%=1
'
' And set color 3 to black
'
SETCOLOR 3,0
ENDIF
'
' Define escape
'
esc$=CHR$(27)
'
' Print credits
'
IF res%=1 THEN
'
' Medium res
'
PRINT esc$;"b1 H.A.Z.E.L.";esc$;"b3 AUTO, ASSIGN.SYS, DA and DESKTOP.INF Chooser!"
ELSE
'
' High res
'
PRINT " ";esc$;"c1";esc$;"b0H.A.Z.E.L.";esc$;"c0";esc$;"b1 AUTO, ASSIGN.SYS, DA and DESKTOP.INF Chooser!"
ENDIF
PRINT " By Greg ";CHR$(34);"Maddog";CHR$(34);" Knauss"
PRINT " Copyright 1989 Magnum Opus"
PRINT
'
' Dims and defines
'
DIM filename$(80)
DIM file_len%(80)
DIM short_name$(80)
DIM ext$(4)
DIM type%(80)
DIM orig_stat!(80)
DIM stat!(80)
'
DIM jf_prg$(80)
DIM jf_prgstat!(80)
DIM jf_acc$(80)
DIM jf_accstat!(80)
'
' Some stuff
'
north$=CHR$(0)+"H"
south$=CHR$(0)+"P"
east$=CHR$(0)+"M"
west$=CHR$(0)+"K"
'
' Legal AUTO extensions
'
ext$(1)="PRG"
ext$(2)="APP"
ext$(3)="TOS"
ext$(4)="TTP"
'
' Assume that nothing's there
'
infos!=FALSE
autos!=FALSE
gdos!=FALSE
accs!=FALSE
cnfs!=FALSE
rootdir!=FALSE
jf_alert!=FALSE
'
' ****************************************************************************
' Do selects for DESKTOP.INF file
' ****************************************************************************
'
desktop_choose:
'
' Any DESKTOPs?
'
IF EXIST("\AUTO\HAZEL\*.INF") THEN
'
' Get a directory
'
GOSUB get_dir("\AUTO\HAZEL\*.INF")
'
' Do the select
'
infos!=TRUE
pass%=1
GOSUB assign_desktop("\DESKTOP.INF")
jf_inf$=jellyfish$
ELSE
'
' No DESKTOP files...
'
PRINT "No DESKTOP.INF files..."
PAUSE (50)
ENDIF
'
' Is there an AUTO folder?
'
IF EXIST("\AUTO\*.*") THEN
'
' **************************************************************************
' Do selects for AUTO programs
' **************************************************************************
'
auto_choose:
'
' Load directory into Filename$
'
GOSUB get_dir("\AUTO\*.*")
'
' Sort out all non-PR?, non-AP?, non-TO?, non-TT? files
'
j%=0
CLR prgstring$
REPEAT
temp%=INSTR(filename$(j%),".")
temp$=MID$(filename$(j%),temp%+1,2)
'
' It's not an executable file, so remove it from the list
'
IF temp$<>"PR" AND temp$<>"AP" AND temp$<>"TO" AND temp$<>"TT" THEN
FOR i%=j% TO num_of_files%
filename$(i%)=filename$(i%+1)
NEXT i%
DEC num_of_files%
ELSE
'
' We save it
'
short_name$(j%)=LEFT$(filename$(j%),temp%-1)
type%(j%)=-(temp$="PR")-2*(temp$="AP")-3*(temp$="TO")-4*(temp$="TT")
prgstring$=prgstring$+short_name$(j%)
'
' It's alive! (Or "active" if you wanna get picky.)
'
IF ext$(type%(j%))=RIGHT$(filename$(j%),3) THEN
stat!(j%)=TRUE
orig_stat!(j%)=TRUE
ELSE
'
' It's dead... He was such a good file...
'
stat!(j%)=FALSE
orig_stat!(j%)=FALSE
ENDIF
INC j%
ENDIF
'
' Done yet?
'
UNTIL j%=num_of_files%+1
'
' Get Jellyfish script
'
CLR jf_prgstring$,jf_accstring$
IF rootdir!=FALSE
IF EXIST("\AUTO\HAZEL\"+jf_inf$+".RSC")
OPEN "I",#1,"\AUTO\HAZEL\"+jf_inf$+".RSC"
INPUT #1,jf_inf$
INPUT #1,jf_sys$
INPUT #1,jf_cnf$
INPUT #1,ram$
INPUT #1,jf_noprgf$
INPUT #1,jf_noaccf$
FOR i%=0 TO num_of_files%
INPUT #1,jf_prg$(i%)
jf_prgstring$=jf_prgstring$+jf_prg$(i%)
NEXT i%
IF prgstring$=jf_prgstring$
FOR i%=0 TO num_of_files%
INPUT #1,jf_prgstat!(i%)
stat!(i%)=jf_prgstat!(i%)
NEXT i%
FOR i%=0 TO VAL(jf_noaccf$)
INPUT #1,jf_acc$(i%)
jf_accstring$=jf_accstring$+jf_acc$(i%)
NEXT i%
FOR i%=0 TO VAL(jf_noaccf$)
INPUT #1,jf_accstat!(i%)
NEXT i%
ELSE
jf_alert!=TRUE
RENAME "\AUTO\HAZEL\"+jf_inf$+".RSC" AS "\AUTO\HAZEL\"+jf_inf$+".BAK"
PRINT AT(5,10);"List of programs in autofolder has been changed and, hence,"
PRINT AT(5,11);"the ";jf_inf$;" .RSC file has been made a .BAK file."
PRINT AT(5,12);"Make manual selections for a new ";jf_inf$;".RSC file."
FOR i%=0 TO num_of_files%
jf_prg$(i%)=short_name$(i%)
NEXT i%
PRINT AT(5,13);"Press any key."
~INP(2)
ENDIF
CLOSE #1
ELSE
'
' Hello, there! How about you making a nice alert box for this stuff?
'
PRINT AT(5,10);"There is no ";jf_inf$;".RSC file on hand for this desktop!"
PRINT AT(5,11);"Make manual selections of what programs should run."
PRINT AT(5,12);"Press any key."
~INP(2)
FOR i%=0 TO num_of_files%
jf_prg$(i%)=short_name$(i%)
NEXT i%
ENDIF
ENDIF
'
' Are there any files for us to fiddle with?
'
IF num_of_files%>-1 THEN
'
' Yep! Do choosing for AUTO programs
'
autos!=TRUE
pass%=2
CLS
GOSUB select
'
' Set and record the capacity of the RAM disk. Minimum set at 50K.
'
IF ram$=""
OPEN "I",#1,"\RAMDISK.INF"
INPUT #1,ram$
CLOSE #1
ENDIF
drive$=LEFT$(ram$)
ramsize$=MID$(ram$,2)
PRINT AT(7,21);"RAM disk: ";drive$;
FORM INPUT 40 AS ramsize$
IF VAL(ramsize$)<50
ramsize$="50"
ENDIF
ram$=drive$+ramsize$
OPEN "O",#1,"\RAMDISK.INF"
PRINT #1,ram$
CLOSE #1
CLS
'
' Run through all the files for AUTO selection
'
FOR i%=0 TO num_of_files%
'
' Only change the name if it's status has been changed
'
IF stat!(i%)<>orig_stat!(i%) THEN
temp$="\AUTO\"+short_name$(i%)+"."+LEFT$(ext$(type%(i%)),2-stat!(i%))
NAME "\AUTO\"+filename$(i%) AS temp$
ENDIF
jf_prgstat!(i%)=stat!(i%)
NEXT i%
jf_noprgf%=num_of_files%
'
' Back up
'
IF pass%=-1 THEN
'
' ...to DESKTOP choose
'
IF infos!=TRUE
GOTO desktop_choose
ENDIF
ENDIF
'
ELSE
'
' No AUTO folder...
'
PRINT "No AUTO files..."
PAUSE (50)
ENDIF
'
' **********************************************************************
' Do selects for ASSIGN.SYS file
' **********************************************************************
'
assign_choose:
'
' Yep, any SYSs in HAZEL?
'
IF autos! AND EXIST("\AUTO\HAZEL\*.SYS") THEN
'
' Get the directory
'
GOSUB get_dir("\AUTO\HAZEL\*.SYS")
'
' Do the choosing for ASSIGN.SYS
'
gdos!=TRUE
pass%=3
GOSUB assign_desktop("\ASSIGN.SYS")
IF jellyfish$<>""
jf_sys$=jellyfish$
ENDIF
'
' Back up
'
IF pass%=-1
GOTO auto_choose
ENDIF
ELSE
'
' No files in ASSIGNS directory...
'
PRINT "No ASSIGN.SYS files..."
PAUSE (50)
ENDIF
ELSE
'
' No executable AUTO files...
'
PRINT "No executable AUTO files..."
PAUSE (50)
ENDIF
'
' ****************************************************************************
' Do selects for DAs
' ****************************************************************************
'
da_choose:
'
IF EXIST("\*.AC?") THEN
'
' Load in main boot drive directory *.AC? files
'
GOSUB get_dir("\*.AC?")
'
' Loop through all filenames
'
CLR accstring$
FOR i%=0 TO num_of_files%
temp%=INSTR(filename$(i%),".")
short_name$(i%)=LEFT$(filename$(i%),temp%-1)
accstring$=accstring$+short_name$(i%)
'
' It lives! It lives!
'
IF RIGHT$(filename$(i%),3)="ACC" THEN
stat!(i%)=TRUE
orig_stat!(i%)=TRUE
ELSE
'
' No, it doesn't! No, it doesn't!
'
stat!(i%)=FALSE
orig_stat!(i%)=FALSE
ENDIF
'
' Move to next one
'
NEXT i%
'
' Checking with the Jellyfish script
'
IF rootdir!=FALSE
IF accstring$=jf_accstring$
FOR i%=0 TO num_of_files%
stat!(i%)=jf_accstat!(i%)
NEXT i%
ELSE
jf_alert!=TRUE
FOR i%=0 TO num_of_files%
jf_acc$(i%)=short_name$(i%)
NEXT i%
PRINT AT(5,10);"A new ";jf_inf$;".RSC file is being created. Therefore you"
PRINT AT(5,11);"must make manual selections of what accessories should run."
PRINT AT(5,12);"Press any key."
~INP(2)
ENDIF
ENDIF
'
' Do choosing for DAs
'
accs!=TRUE
pass%=4
CLS
GOSUB select
CLS
'
' Back up!
'
IF pass%=-1 THEN
'
' ... to ASSIGN.SYS choose
'
IF gdos!
GOTO assign_choose
ELSE
'
' ...to AUTO choose
'
IF autos!=TRUE THEN
GOTO auto_choose
ELSE
'
' ...to DESKTOP choose
'
IF infos!
GOTO desktop_choose
ELSE
'
' ... to DA 'cause there ain't a previous ...
'
GOTO da_choose
ENDIF
ENDIF
ENDIF
ENDIF
'
' Make mods
'
FOR i%=0 TO num_of_files%
'
' Only change the name if it's status has been changed
'
IF stat!(i%)<>orig_stat!(i%) THEN
temp$="\"+short_name$(i%)+"."+LEFT$("ACC",2-stat!(i%))
NAME "\"+filename$(i%) AS temp$
ENDIF
jf_accstat!(i%)=stat!(i%)
NEXT i%
jf_noaccf%=num_of_files%
ELSE
'
' No desk accessories...
'
PRINT "No desk accessories..."
PAUSE (50)
ENDIF
'
' ****************************************************************************
' Do selects for Geneva GEM.CNF files
' ****************************************************************************
'
' Any Geneva GEM.CNF files?
'
IF jf_inf$="GENEVA"
' IF EXIST("\AUTO\GENEVA.PRG")
IF EXIST("\GENEVA\GEM.CNF")
'
' Get a directory
'
GOSUB get_dir("\GENEVA\GEM.CNF")
'
' Do the select
'
cnfs!=TRUE
pass%=5
GOSUB assign_desktop("\GENEVA\GEM.CNF")
IF jellyfish$<>""
jf_cnf$=jellyfish$
ENDIF
'
' back-up
'
IF pass%=-1
'
' ... to DA choose
'
IF accs!
GOTO da_choose
ELSE
'
' ... to ASSIGN.SYS choose
'
IF gdos!
GOTO assign_choose
ELSE
'
' ... to AUTO choose
'
IF autos!
GOTO auto_choose
ENDIF
ENDIF
ENDIF
ENDIF
ELSE
'
' No GEM.CNF files...
'
PRINT "No Geneva GEM.CNF files..."
PAUSE (50)
ENDIF
ENDIF
'
' ****************************************************************************
' And now for the finals...
' ****************************************************************************
'
' Making a new jellyfish file
'
IF rootdir!=FALSE
OPEN "O",#1,"\AUTO\HAZEL\"+jf_inf$+".RSC"
PRINT #1,jf_inf$
PRINT #1,jf_sys$
PRINT #1,jf_cnf$
PRINT #1,ram$
PRINT #1,STR$(jf_noprgf%)
PRINT #1,STR$(jf_noaccf%)
FOR i%=0 TO jf_noprgf%
PRINT #1,jf_prg$(i%)
NEXT i%
FOR i%=0 TO jf_noprgf%
PRINT #1,jf_prgstat!(i%)
NEXT i%
FOR i%=0 TO jf_noaccf%
PRINT #1,jf_acc$(i%) !check this
NEXT i%
FOR i%=0 TO jf_noaccf%
PRINT #1,jf_accstat!(i%)
NEXT i%
CLOSE #1
ENDIF
'
' If they started in low res...
'
IF old_res%=0 THEN
'
' Restore stuff
'
VOID XBIOS(5,L:-1,L:-1,old_res%)
'
' And other stuff
'
SETCOLOR 3,5,0,0
ENDIF
ELSE
'
' Let 'em know what they missed
'
PRINT "HAZEL bypassed. Left SHIFT on boot runs."
ENDIF
'
' We're outta here! Back to the boot-up! **************************************
'
EDIT
'
' ******************************************************************************
' Let's user select files he wants active
' ******************************************************************************
'
PROCEDURE select
'
' Show the title
'
GOSUB title
'
' Set up program selections screen
'
IF pass%=1
dy%=0
ELSE
dy%=2
IF rootdir!
PRINT AT(1,7);"The settings you make will not be saved after this session!."
ELSE IF jf_alert!
PRINT AT(1,7);"Creating a "+jf_inf$+".RSC file"
jf_alert!=FALSE
ELSE
PRINT AT(1,7);"Running "+jf_inf$+".INF, "+jf_sys$+".SYS, "+jf_cnf$+".CNF"
ENDIF
ENDIF
'
x%=-1
y%=7+dy%
'
' Go through all files
'
FOR i%=0 TO num_of_files%
'
' Position on screen
'
IF x%>6 THEN
INC y%
x%=-1
ENDIF
INC x%
'
' If they're selecting AUTO files or DAs, show them highlighted or not
'
IF pass% MOD 2=0 THEN
'
' Color monitor?
'
IF res%=1 THEN
'
' Yep! Green if activated, red if not
'
PRINT esc$;"b";CHR$(49-stat!(i%));
ELSE
'
' Nope... Highlighted if activated, not if not
'
PRINT esc$;"b";CHR$(49+stat!(i%));esc$;"c";CHR$(48-stat!(i%));
ENDIF
ENDIF
'
' Otherwise, just...
'
' Print the filename
'
PRINT AT(x%*10+2,y%);short_name$(i%);
NEXT i%
'
' Set-ups
'
cy%=7+dy%
cx%=0
PRINT AT(1,7+dy%);esc$;"b?";esc$;"c0";CHR$(175)
'
' Do cursor movement
'
REPEAT
'
' Get a key...
'
key$=INKEY$
'
' They hit a key...
'
IF key$<>"" THEN
'
' Erase old cursor
'
PRINT AT(cx%*10+1,cy%);esc$;"b?";esc$;"c0 "
'
' Move up
'
IF key$=north$ AND cy%-1>6 THEN
DEC cy%
ELSE
'
' Move down
'
IF key$=south$ AND cy%<y% THEN
INC cy%
IF cy%=y% AND cx%>x% THEN
cx%=x%
ENDIF
ELSE
'
' Move right
'
IF key$=east$ AND cx%+1<8 THEN
INC cx%
IF cy%=y% AND cx%+1>x% THEN
cx%=x%
ENDIF
ELSE
'
' Move left
'
IF key$=west$ AND cx%>0 THEN
DEC cx%
ENDIF
ENDIF
ENDIF
ENDIF
'
' Print cursor
'
PRINT AT(cx%*10+1,cy%);CHR$(175)
'
' SPACE to toggle, if it's selection of AUTOs or DAs
'
IF key$=" " AND pass% MOD 2=0 THEN
temp%=cx%+(cy%-(7+dy%))*8
stat!(temp%)=-1-stat!(temp%)
PRINT AT(cx%*10+2,cy%);
'
' Color monitor?
'
IF res%=1 THEN
'
' Yep! Green if activated, red if not
'
PRINT esc$;"b";CHR$(49-stat!(temp%));
ELSE
'
' Nope... Highlighted if activated, not if not
'
PRINT esc$;"b";CHR$(49+stat!(temp%));esc$;"c";CHR$(48-stat!(temp%));
ENDIF
PRINT short_name$(temp%)
ENDIF
'
' Backup?
'
IF key$=CHR$(8) AND pass%>1 THEN
pass%=-1
ENDIF
ENDIF
'
' Out?
'
UNTIL key$=CHR$(13) OR pass%=-1
'
' Out! Erase the cursor
'
PRINT AT(cx%*10+1,cy%);" "
RETURN
'
' ******************************************************************************
' Print the title and instructions for each res and pass
' ******************************************************************************
'
> PROCEDURE title
'
' Title for medium and high res
'
PRINT esc$;"c3";esc$;"b0";
PRINT AT(1,1);SPACE$(80)
PRINT AT(1,2);SPACE$(35);"H.A.Z.E.L.";SPACE$(35)
PRINT AT(1,3);SPACE$(80)
PRINT AT(1,4);
SELECT pass%
CASE 1
PRINT " Select which DESKTOP.INF file you want: "
CASE 2
PRINT " Select which AUTO programs you want: "
CASE 3
PRINT " Select which ASSIGN.SYS file you want: "
CASE 4
PRINT " Select which Desk Accessories you want: "
CASE 5
PRINT " Select which Geneva CNF files you want: "
ENDSELECT
PRINT AT(1,5);SPACE$(80)
'
' Print instructions for high and med res
'
IF pass% MOD 2=0 THEN
'
' For AUTO and DA select
'
PRINT AT(2,25);" Use the arrow keys to move cursor, SPACE to toggle, RETURN to exit. ";
ELSE
'
' For ASSIGN.SYS and DESKTOP.INF selection
'
PRINT AT(2,25);" Use the arrow keys to move cursor, RETURN to choose. ";
ENDIF
'
' Restore screen colors
'
PRINT esc$;"b?";esc$;"c0";
RETURN
'
' ******************************************************************************
' Choosing and copying for ASSING.SYS and DESKTOP.INF
' ******************************************************************************
'
PROCEDURE assign_desktop(file$)
'
' And put 'em into Short_name$ and add "Keep old" as default
'
short_name$(0)="Root Dir"
FOR i%=0 TO num_of_files%
temp%=INSTR(filename$(i%),".")
'
' If there's a file extension, cut it off
'
IF temp%>0 THEN
short_name$(i%+1)=LEFT$(filename$(i%),temp%-1)
ELSE
'
' If not, don't bother
'
short_name$(i%+1)=filename$(i%)
ENDIF
NEXT i%
'
' Inc number of files 'cause of "Keep old"
'
INC num_of_files%
'
' Find out which one they want
'
CLS
GOSUB select
CLS
'
' Find which one they were on when they RETURNed
'
temp%=cx%+(cy%-(7+dy%))*8-1
'
' Keeping old?
'
SELECT pass%
CASE 1
rootdir!=TRUE
' jellyfish$="Root Dir"
CASE 3
jellyfish$=jf_sys$
CASE 5
jellyfish$=jf_cnf$
ENDSELECT
' jellyfish$="Existing"
IF temp%>-1 AND pass%>-1 THEN
'
' Here we decide on making a new jellyfish file and what its name will be
'
rootdir!=FALSE
jellyfish$=short_name$(temp%+1)
'
' Nope, copy file
'
dumb$=SPACE$(file_len%(temp%))
BLOAD "\AUTO\HAZEL\"+filename$(temp%),VARPTR(dumb$)
BSAVE file$,VARPTR(dumb$),LEN(dumb$)
ENDIF
RETURN
'
' ******************************************************************************
' Gets directory from disk to where we can use it
' ******************************************************************************
'
PROCEDURE get_dir(a$)
'
' Set number of files
'
num_of_files%=-1
'
' Point to the Disk Transfer Address (Where filename comes back) and get
' File Not Found/End of Data status
'
dta%=GEMDOS(47)
temp%=GEMDOS(78,L:VARPTR(a$),-1)
'
' Loop to get filenames
'
DO
'
' Out if no more data
'
EXIT IF temp%=-49
'
' We've got another file
'
INC num_of_files%
filename$(num_of_files%)=""
'
' And get filename from memory
'
FOR i%=dta%+30 TO dta%+41
'
' Out if this is the end of filename
'
EXIT IF PEEK(i%)=0
'
' Add it in
'
filename$(num_of_files%)=filename$(num_of_files%)+CHR$(PEEK(i%))
NEXT i%
'
' And the file length
'
file_len%(num_of_files%)=DPEEK(dta%+28)
'
' Get the status for the next file
'
temp%=GEMDOS(79)
'
' 'Round again
'
LOOP
'
' Make sure they're being reasonable...
'
IF num_of_files%>135 THEN
PRINT "HAZEL can only handle 136 of each type of file!"
PAUSE (50)
num_of_files%=135
ENDIF
RETURN