home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 42 / af042b.adf / Extras.lha / RAMOS1_3_Install.AMOS / RAMOS1_3_Install.amosSourceCode < prev    next >
AMOS Source Code  |  1992-02-21  |  12KB  |  414 lines

  1. '----------------------------------------- 
  2. ' RAMOS 1.3 Installer, By Francois Lionet
  3. ' (c) 1992 Europress Software Ltd. 
  4. '----------------------------------------- 
  5. Set Buffer 40
  6. '
  7. Global CPTFILE,QUIT,VER$,VACT$
  8. Global HD$,ND$,DT$
  9. Global PAR,PAR$,HD$,USER$,DISKET
  10. Global MXSIZE,UBANK,AKEY
  11. Global XDI,XDIV,YDI,C1,C2,C3,DITOT,OXDI
  12. Global C0,C1,C2,C3,C4,C5
  13. Global S_NAME$,D_NAME$,S_DISK$,D_DISK$,SDRV,DDRV
  14. '
  15. C0=0 : C1=5 : C2=1 : C3=10 : C4=11 : C5=12
  16. UBANK=7 : MXSIZE=125000 : Reserve As Work UBANK,MXSIZE
  17. VER$="1.33a"
  18. Set Dir ,""
  19. '
  20. _GET_DRIVES
  21. '
  22. Set Sprite Buffer 40
  23. Screen Open 0,640,200,4,Hires
  24. Curs Off : Flash Off : Palette 0,0,0,0
  25. '
  26. Do 
  27.    '
  28.    E=0
  29.    _SETUP_MENU[1]
  30.    Exit If QUIT
  31.    '
  32.    _SETUP_MENU[2]
  33.    Exit If QUIT
  34.    Exit If PAR=1
  35.    '
  36.    '_SETUP_MENU[3]
  37.    _MAKE_SETUP_SCREEN
  38.    _GET_DISC[D_DISK$,"AMOS:","the copy of your AMOS Programs Disc"]
  39.    Exit If QUIT
  40.    '
  41.    _SETUP_MENU[4]
  42.    Exit If QUIT
  43.    '
  44.    _SETUP_MENU[5]
  45.    _DELETE_OLD_FILES[D_DISK$]
  46.    '
  47.    _FILE_COPY["RAMOS1.3","RAMOS1.3"]
  48.    E=Param : Exit If E
  49.    _FILE_COPY["AMOS_System/RAMOS1_3.Env","AMOS_System/RAMOS1_3.Env"]
  50.    E=Param : Exit If E
  51.    '
  52.    Open Out 1,D_DISK$+"s/startup-sequence"
  53.    Print #1,"Run >NIL: RAMOS1.3";Chr$(10);
  54.    Print #1,"EndCli";Chr$(10);
  55.    Close 1
  56.    '
  57.    _SETUP_MENU[7]
  58.    _SETUP_MENU[8]
  59.    '
  60.    E=0 : Exit 
  61.    '
  62. Loop 
  63. '
  64. If E
  65.    _SETUP_MENU[6]
  66. End If 
  67. '
  68. Screen Close 0
  69. Edit 
  70. '
  71. Procedure _SETUP_MENU[PAGE]
  72.    Shared XX,YY
  73.    Dim JMP$(64),ZIT(64),ITZ(64),ZBASE(64)
  74.    QUIT=0
  75.    _MAKE_SETUP_SCREEN
  76.    ' Handle menu
  77.    MK_MENU:
  78.    Curs Off : Gosub DR_MENU
  79.    If EX : Pop Proc : End If 
  80.    NOZ=1
  81.    Do 
  82.       Repeat 
  83.          Multi Wait 
  84.          Z=Mouse Zone : K=Mouse Key
  85.          If Z<>OLDZ
  86.             If OLDZ>0 : ACT=-1 : IT=ZIT(OLDZ) : OLDZ=-1 : Gosub DR_ITEM : End If 
  87.             If Z>0 : OLDZ=Z : ACT=Z : IT=ZIT(Z) : ZNE=ZBASE(IT) : Gosub DR_ITEM : End If 
  88.          End If 
  89.       Until Z<>0 and K<>0
  90.       If JMP$(Z)<>"" : Gosub JMP$(Z) : End If 
  91.       ACT=Z : ZNE=ZBASE(IT) : Gosub DR_ITEM
  92.       If K=1 : Repeat : Multi Wait : Until Mouse Key=0 : End If 
  93.    Loop 
  94.    '  
  95.    '
  96.    ST_FLAG: V=1-V : Gosub "POK"+VTYPE$ : Return 
  97.    ' Draw menu page 
  98.    DR_MENU:
  99.    Reserve Zone 64
  100.    IT=0 : ZNE=1 : NOZ=0 : ACT=-1 : OLDPAR=-1
  101.    Repeat 
  102.       Inc IT : ZBASE(IT)=ZNE : Gosub DR_ITEM
  103.    Until FLAG=False
  104.    Return 
  105.    ' Draw one menu item 
  106.    DR_ITEM:
  107.    LAB$="L"+(Str$(PAGE)-" ")+"_"+(Str$(IT)-" ")
  108.    On Error Goto NO_IT
  109.    Restore LAB$ : Read IT$
  110.    M=0 : XX=-1
  111.    Repeat 
  112.       NEND=Instr(IT$,"|",M+1)
  113.       ENC=0 : LBL$="" : FL=0 : ZZ=0 : NB=0
  114.       Repeat 
  115.          N=M+1
  116.          M=Instr(IT$,",",N) : M2=Instr(IT$,":",N) : If M>M2 : M=0 : End If 
  117.          If M=0 or(NEND<>0 and M1>NEND) : M=M2 : FL=1 : End If 
  118.          A$=Upper$(Mid$(IT$,N,1)) : Inc N
  119.          If A$="E" : ENC=1 : End If 
  120.          If A$="L" : Gosub GT_STR : LBL$=A$ : Inc ZZ : End If 
  121.          If A$="C" : CNT=1 : End If 
  122.          If A$="X" : Gosub GT_STR : XX=Val(A$) : End If 
  123.          If A$="Y" : Gosub GT_STR : YY=Val(A$) : End If 
  124.          If A$="V" : Gosub GT_STR : PAR=Val(A$) : End If 
  125.          If A$="W" : Gosub GT_STR : PAR$=A$ : End If 
  126.          If A$="Q" : EX=1 : Error 32 : End If 
  127.       Until FL
  128.       If NEND
  129.          A$=Mid$(IT$,M+1,NEND-M-1)
  130.       Else 
  131.          A$=Mid$(IT$,M+1)
  132.       End If 
  133.       Gosub DR_WORD
  134.       M=NEND
  135.    Until NEND=0
  136.    On Error 
  137.    FLAG=True
  138.    Return 
  139.    '
  140.    DR_WORD:
  141.    If XX<0 : XX=40-Len(A$)/2 : End If 
  142.    Locate XX,YY
  143.    '
  144.    FST=0
  145.    '
  146.    If Left$(A$,1)="&"
  147.       A$=Mid$(A$,2,1)
  148.       If A$="R"
  149.          A$=Upper$(Left$(NAMES$,3)) : A$=A$+Space$(3-Len(A$))
  150.          A$=A$+REG$
  151.       End If 
  152.    End If 
  153.    '
  154.    X1=X Graphic(XX)-3 : Y1=Y Graphic(YY)-2 : X2=X Graphic(XX+Len(A$))+2 : Y2=Y1+11
  155.    '
  156.    If ZZ<>0 or NOZ=0 or FST<>0
  157.       Inverse Off : If ZZ<>0 and ACT=ZNE : Inverse On : End If 
  158.       Print A$;
  159.       If ENC<>0 and NOZ=0 : Box X1,Y1 To X2,Y2 : End If 
  160.    End If 
  161.    If ZZ<>0
  162.       If NOZ=0
  163.          Set Zone ZNE,X1,Y1 To X2,Y2
  164.          ZIT(ZNE)=IT : ITZ(IT)=ZNE
  165.          If LBL$<>""
  166.             JMP$(ZNE)=LBL$
  167.          End If 
  168.       End If 
  169.       Inc ZNE
  170.    End If 
  171.    XX=XX+(X2-X1)/8+1
  172.    Return 
  173.    '
  174.    NO_IT: Resume NO_IT2
  175.    NO_IT2: FLAG=False
  176.    Return 
  177.    '
  178.    GT_STR:
  179.    A$=Mid$(IT$,N,M-N)
  180.    Return 
  181.    '
  182.    MN_QUIT:
  183.    QUIT=-1 : PAR=0
  184.    MN_OUT:
  185.    Pop : Flash Off : Fade 1 : Wait 16 : Goto _END
  186.    MN_QUIT2:
  187.    QUIT=-1 : PAR=0
  188.    MN_OUT2:
  189.    Pop : Goto _END
  190.    '
  191.    ' Data page 1  
  192.    L1_1: Data "C,Y2,E:         RAMOS Bootable Disc Creator        "
  193.    L1_2: Data "C,Y05:by Fran�ois Lionet"
  194.    L1_3: Data "C,Y07:(c) 1992 Europress Software Ltd."
  195.    L1_4: Data "C,Y12:Welcome to this program. To successfully create a bootable"
  196.    L1_5: Data "C,Y13:version of the Run-Only version of AMOS follow carefully"
  197.    L1_6: Data "C,Y14:all the prompts."
  198.    L1_7: Data "C,Y18:The whole process will take about 15 minutes."
  199.    L1_8: Data "E,X71,Y23,LMn_Quit: Abort "
  200.    L1_9: Data "E,X61,Y23,LMn_Out2: Go On "
  201.    '
  202.    ' Data page 2  
  203.    L2_1: Data "C,Y2,E:         RAMOS Bootable Disc Creator        "
  204.    L2_2: Data "C,Y05:The first thing to do, is a disk-copy of your AMOS Programs Disc."
  205.    L2_3: Data "C,Y07:This copy will be modified by the RAMOS Bootable Disc creator. Doing this"
  206.    L2_4: Data "C,Y08:ensures that all the system files are properly installed."
  207.    L2_5: Data "C,Y10:You *MUST NOT* use your original AMOS Programs Disc, because the"
  208.    L2_6: Data "C,Y11:RAMOS Creator removes the majority of the files from it!"
  209.    L2_7: Data "C,Y13:To do the copy, either use a third party disc-copy program,"
  210.    L2_8: Data "C,Y14:or boot with your original Workbench Disc, and use the 'Disk-Copy'"
  211.    L2_9: Data "C,Y15:option from the Workbench menu, and copy the disc according"
  212.    L2_10: Data "C,Y16:to the Workbench prompts."
  213.    L2_11: Data "C,Y18,E,V1,LMn_Out2:     Click here to quit AMOS and do a disc-copy of the AMOS Programs disc   "
  214.    L2_12: Data "C,Y20,E,V2,LMn_Out2:       Your copy is ready, click here to create the RAMOS Bootable disc     "
  215.    L2_13: Data "E,X71,Y23,LMn_Quit: Abort "
  216.    '
  217.    ' Data page 4  
  218.    L4_1: Data "C,Y2,E:         RAMOS Bootable Disc Creator        "
  219.    L4_2: Data "C,Y07,E:"+Pen$(3)+"                    This is your last WARNING!              "+Pen$(1)
  220.    L4_3: Data "C,Y12:Are you sure that the disc in drive "+D_DISK$
  221.    L4_4: Data "C,Y13:is a copy of your AMOS Program Disc,"
  222.    L4_5: Data "C,Y14:and NOT the original master?"
  223.    L4_6: Data "C,Y20,E,V1,LMn_Out2:       Click here if you are absolutly sure!      "
  224.    L4_7: Data "C,Y22,E,V2,LMn_Quit:        Click here to abort RAMOS Creation.       "
  225.    '
  226.    ' Data page 5  
  227.    L5_1: Data "C,Y2,E:         RAMOS Bootable Disc Creator        "
  228.    L5_2: Data "C,Y07,E:"+Pen$(3)+"                    Creating your RAMOS disc              "+Pen$(1)
  229.    L5_3: Data "Q"
  230.    '
  231.    ' Data page 6  
  232.    L6_1: Data "C,Y2,E:         RAMOS Bootable Disc Creator        "
  233.    L6_2: Data "C,Y10,E:"+Pen$(3)+"                    Error during creation process!              "+Pen$(1)
  234.    L6_3: Data "C,Y13:Please check your drives and discs."
  235.    L6_4: Data "E,X71,Y23,LMn_Quit: Abort "
  236.    '
  237.    ' Data page 7  
  238.    L7_1: Data "C,Y2,E:         RAMOS Bootable Disc Creator        "
  239.    L7_2: Data "C,Y10,E:"+Pen$(3)+"                    Your RAMOS Disc is ready!              "+Pen$(1)
  240.    L7_3: Data "C,Y13:All you have to do now, is save your AMOS program on this"
  241.    L7_4: Data "C,Y14:floppy, and call it :"
  242.    L7_5: Data "C,Y16,E: AUTOEXEC.AMOS "
  243.    L7_6: Data "C,Y18:RAMOS will automaticaly load and run it upon booting."
  244.    L7_7: Data "E,X71,Y23,LMn_Out2: Go On "
  245.    '
  246.    ' Data page 8  
  247.    L8_1: Data "C,Y2,E:         RAMOS Bootable Disc Creator        "
  248.    L8_2: Data "C,Y04:Read this carefully:"
  249.    L8_3: Data "C,Y06:If your program uses instructions from any extension other than the"
  250.    L8_4: Data "C,Y07:Screen Compactor or the Music Extension, you *must* do the following :"
  251.    L8_5: Data "Y09,X00:(1) Under AMOS, run CONFIG1_3.AMOS, the configuration program."
  252.    L8_6: Data "Y11,X00:(2) Load the RAMOS1_3.Env environment file from your RAMOS Bootable disc,"
  253.    L8_7: Data "Y12,X00:    this file can be found in the AMOS_System folder."
  254.    L8_8: Data "Y14,X00:(3) From the menu, select the option 'Loaded Extensions'."
  255.    L8_9: Data "Y16,X00:(4) Add the extra extension name in the list, at the correct location"
  256.    L8_10: Data "Y17,X00:    as you did when you installed them to the interpretor."
  257.    L8_11: Data "Y19,X00:(5) Save the new RAMOS1_3.Env configuration to its original place."
  258.    L8_12: Data "C,Y21,E:  RAMOS will fail if your program calls an extension that is not loaded!  "
  259.    L8_13: Data "E,X71,Y23,LMn_Out2: Go On "
  260.    _END:
  261. End Proc[PAR]
  262. Procedure _DELETE_OLD_FILES[PATH$]
  263.    '
  264.    CPTFILE=0
  265.    INFO["Making room on the disc."]
  266.    '
  267.    _DELETE_FILES[PATH$,"*.AMOS"]
  268.    _DELETE_FILES[PATH$,"*.ACC"]
  269.    _DELETE_FILES[PATH$,"AM**"]
  270.    _DELETE_FILES[PATH$,"*.info"]
  271.    _DELETE_FILES[PATH$+"AMOS_System/","De*.info"]
  272.    _DELETE_ALL[PATH$+"Manual"]
  273.    _DELETE_ALL[PATH$+"Help"]
  274.    _DELETE_ALL[PATH$+"Keyboards"]
  275.    '
  276. End Proc
  277. Procedure _DELETE_FILES[P$,F$]
  278.    Dim FILE$(64)
  279.    X=Free
  280.    '
  281.    On Error Proc _SKIP
  282.    Resume Label _NOFIL
  283.    A$=Dir First$(P$+F$)
  284.    While A$<>""
  285.       If Left$(A$,1)<>"*"
  286.          FILE$(N)=Left$(A$,30)-" " : Inc N
  287.       End If 
  288.       A$=Dir Next$
  289.    Wend 
  290.    '
  291.    _NOFIL:
  292.    On Error Proc _SKIP
  293.    Resume Label _NOKIL0
  294.    If N
  295.       For NN=0 To N-1
  296.          _INFO_DELETE
  297.          Kill P$+FILE$(NN)
  298.          _NOKIL0:
  299.       Next 
  300.    End If 
  301.    '
  302. End Proc
  303. Procedure _INFO_DELETE
  304.    Inc CPTFILE : INFO["Deleting file number"+Str$(CPTFILE)+"."]
  305. End Proc
  306. Procedure _DELETE_ALL[S$]
  307.    Dim FILE$(64)
  308.    X=Free
  309.    '
  310.    C$="/" : If Right$(S$,1)=":" : C$="" : End If 
  311.    '
  312.    On Error Proc _SKIP
  313.    Resume Label _NOFILE
  314.    A$=Dir First$(S$+C$+"**")
  315.    While A$<>""
  316.       FILE$(N)=Left$(A$,30)-" " : Inc N
  317.       A$=Dir Next$
  318.    Wend 
  319.    _NOFILE:
  320.    '
  321.    On Error Proc _SKIP
  322.    If N
  323.       For NN=0 To N-1
  324.          If Left$(FILE$(NN),1)="*"
  325.             FILE$(NN)=Mid$(FILE$(NN),2)
  326.             A$=S$+C$+FILE$(NN)
  327.             _DELETE_ALL[A$]
  328.          Else 
  329.             Resume Label _NOKIL1
  330.             _INFO_DELETE
  331.             Kill S$+C$+FILE$(NN)
  332.             _NOKIL1:
  333.          End If 
  334.       Next 
  335.    End If 
  336.    '
  337.    Resume Label _NOKIL2
  338.    Kill S$
  339.    _INFO_DELETE
  340.    _NOKIL2:
  341.    '
  342. End Proc
  343. Procedure _SKIP
  344.    Resume Label 
  345. End Proc
  346. Procedure _MAKE_SETUP_SCREEN
  347.    Flash Off 
  348.    Fade 1,0,0,0,0 : Wait 16
  349.    Paper 0 : Pen 1 : Clw : Curs Off 
  350.    Flash 3,"(000,5)(0FF,5)"
  351.    Fade 1,$0,$EEE,$FF0,
  352. End Proc
  353. Procedure _GET_DRIVES
  354.    For DDRV=4 To 0 Step -1
  355.       D_DISK$="Df"+Chr$(48+DDRV)+":"
  356.       Exit If Drive(D_DISK$)
  357.    Next 
  358.    SDRV=0 : S_DISK$="Df0:"
  359. End Proc
  360. Procedure INFO[A$]
  361.    Centre At(,20)+Space$(75)
  362.    Centre At(,20)+A$
  363. End Proc
  364. Procedure NOINFO
  365.    INFO[""]
  366. End Proc
  367. Procedure _GET_DISC[D$,N$,AL$]
  368.    Request Off 
  369.    _FIND_DISC[D$,N$]
  370.    If Param=0
  371.       Bell 61
  372.       INFO[">>> Please insert "+AL$+" into drive "+Pen$(3)+D$+Pen$(1)+" <<<"]
  373.       Repeat 
  374.          _FIND_DISC[D$,N$]
  375.          If Inkey$=Chr$(27) : QUIT=-1 : Exit : End If 
  376.       Until Param
  377.       INFO[""]
  378.       Wait 50
  379.    End If 
  380.    Request On 
  381. End Proc
  382. Procedure _FIND_DISC[D$,N$]
  383.    N$=Upper$(N$) : L=Len(N$)
  384.    On Error Goto _NO
  385.    For T=0 To 4 : Multi Wait : Next 
  386.    A$=Upper$(Disc Info$(D$))
  387.    If Left$(A$,L)=N$ Then F=-1
  388.    Goto _QUIT
  389.    '
  390.    _NO: F=0 : Resume _QUIT
  391.    _QUIT:
  392. End Proc[F]
  393. Procedure _FILE_COPY[S$,D$]
  394.    '
  395.    On Error Goto _ERR
  396.    '
  397.    _GET_DISC[S_DISK$,"Extras:","your AMOS Extras Disc"]
  398.    INFO["Loading "+S_DISK$+S$]
  399.    Open In 1,S_DISK$+S$ : S=Lof(1) : Close 
  400.    If S>MXSIZE : Stop : End If 
  401.    '
  402.    Bload S_DISK$+S$,Start(UBANK)
  403.    '
  404.    _GET_DISC[D_DISK$,"AMOS:","the copy of your AMOS Programs Disc"]
  405.    INFO["Saving "+D_DISK$+D$]
  406.    Bsave D_DISK$+D$,Start(UBANK) To Start(UBANK)+S
  407.    '
  408.    INFO[""]
  409.    '
  410.    Goto _END
  411.    '
  412.    _ERR: E=-1 : Resume _END
  413.    _END:
  414. End Proc[E]