home *** CD-ROM | disk | FTP | other *** search
- Program example;
- {-demonstrate the CLONE process}
- Const
- installed : Boolean = False;
-
- Procedure install;
- {-set installation parameters for the program}
-
- Procedure clone;
- {-write the memory resident image of the program to the disk}
- Type
- pathname = String[64];
- Var
- f : File;
- fname : pathname;
-
- Function CodeSize : Integer;
- {-return the exact size of this program's code in memory}
- Var
- i : Byte;
- Begin
- i := 11;
- While Not((Mem[DSeg-2:i+3] <> $00E9) And (MemW[DSeg-2:i+4] = $0000)) And
- Not((MemW[DSeg-2:i+0] = $00E9) And (MemW[DSeg-2:i+2] = $E800)) Do
- i := i+1;
- CodeSize := ((((DSeg-2)-CSeg) Shl 4)+i+6)-$100
- End {CodeSize} ;
-
- Begin
- Write('Enter filename where installed copy will be stored: ');
- ReadLn(fname);
- Assign(f, fname);
- {should check for overwrite here}
- Rewrite(f, 1);
- BlockWrite(f, Mem[CSeg:$100], codesize);
- {should check for errors here}
- Close(f);
- End {clone} ;
-
- Begin
- {prompt for installation options}
- {modify TYPED CONSTANTs to store the customized info in the code segment}
- installed := True;
- clone;
- Halt;
- End {install} ;
-
- Begin
- {call the installation procedure if not previously installed}
- If Not(installed) Then install;
- {normal statements}
- End.
-