RAMCOPY - A NICE LITTLE UTILITY by Stefan Posthuma Whenever I start my programming sessions, I first get some beer and crisps. Then I dig up some really nice hip-hop from my record collection. (For those of you who do not know what hip-hop is, it is a noise created by screaming kids with golden chains around their necks, accompanied by brainless computer generated drum- beats and frantic scratching. Enough to drive every parent wild, especially when Grandma pays a visit. Hip-hop is created by guys like the Beasty Boys, L.L. cool J, Public Enemy etc.) Then I take my Programming Disk, which contains everything I need: Assembler, Linker, GfA Interpreter, GfA Compiler, Floyd, Tempelmon, Raid, a Ramdisk and.... Ramcopy. When the computer boots up and checks out the disk for an auto- folder, it will find a ramdisk. After selecting the proper size, the ramdisk will be installed and then ramcopy will do its job. It looks for a file called RAMDISK.INF and starts copying all files in that file to the ramdisk. This is really neat, because I don't have to select and copy all those things myself. After all this, I put the needle on the record, pump up the volume and start Brainbusting. In the folder 'PROGRAMS' on this very disk, you will find two files concerning 'Ramcopy': RAMCOPY.BAS and RAMCOPY.PRG. RAMCOPY.BAS is the GfA source of the program and RAMCOPY.PRG is the compiled version. If you install Ramcopy in your auto-folder, make sure that you copy your ramdisk program first, else ramcopy will be started before the ramdisk is installed. How the program works. First, it will search the auto folder for a file called 'RAMDISK.INF'. If it can't find it, it will look in the root directory. If it can't find the file there either, it will print an error message and aborts. You can create this file with any regular editor like Tempus, Ed or even 1st Word (Plus)(WP mode disabled). Or with the following GfA Basic program: OPEN "O",#1,"\ramdisk.inf" DO INPUT A$ EXIT IF A$="*" PRINT #1,A$ LOOP CLOSE #1 If it has indeed found the file, it will ask if you want to copy the programs. This is handy if you are using a reset-proof ramdisk and you just resetted the computer, so you don't have to wait again because the files are already in the ramdisk. (or maybe you just want an empty ramdisk.) After that, it will read the file and copy all filenames it finds. If you want to copy folders, you have to include a special entry in RAMDISK.INF, starting with a '@'-sign, followed by the name of the folder (not seperated by a space). The folder will be created in the ramdisk, and you can copy the contents of the folder, simply by giving the correct pathnames. Also before a file is copied, the program checks if the file exists and if there is enough room left in the ramdisk. After everything is copied, the program waits for you to press any key and the normal booting-process is resumed. By the way, the ramdisk should be drive D. Example of a ramdisk.inf file: gfabasic.prg gfabcom.prg gfabcom.rsc @programs programs\artist.bas programs\menu.bas programs\hack.bas tempus.prg When ramcopy has handled this file, the files will be in the ramdisk, and the folder 'programs' also has been created. Make sure to create folders first before attempting to copy any files to it. After the programming session, I save my work (Sometimes, I just turn off the computer, not copying the files from the ramdisk back to the disk. This will result in a very loud cry, followed by the pounding of my head to the wall.) and turn off the computer. After that, I collect empty beer bottles and remove the crisp-remaiders from my keyboard while my parents are trying their best to keep Grandma from destroying my stereo with a very mean looking umbrella. Greetings, Stefan Posthuma Originally published in ST NEWS Volume 2 Issue 7. ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo '***************************** '***** Gfa Basic Listing ***** '***************************** ' ramcopy ' Cls Print Print " Ramcopy v1.0 By Stefan Posthuma" Print " Created by Digital Insanity" Print If Fre(0)<40000 ! need about 40000 bytes Print " Sorry, not enough free memory...." Print Print " Press a key...." Void Inp(2) Cls System Endif Einde!=False @Bestaat ! check for ramdisk.inf Buf$=Space$(32000) ! 32000 bytes buffer for copy Void Fre(0) While Einde!=False ! while not EOF @Lezen ! read next filename from ramdisk.inf If Bestaat!=True ! file exists? @Copy ! yes, copy it Endif Wend Close #1 Print Print " Press a key...." Void Inp(2) Clr Buf$ Clear Cls System ! back to the desktop ' Procedure Bestaat N$="a:\auto\ramdisk.inf" If Not Exist(N$) N$="a:\ramdisk.inf" If Not Exist(N$) Einde!=True Print " ramdisk.inf does not exist. No copy..." Endif Endif If Einde!=False Print " Found ramdisk.inf....copy files (Y/N)" Print Repeat K%=Inp(2) Until K%=121 Or K%=110 If K%=110 ! user pressed N, exit program Cls System Endif Open "i",#1,N$ ! open ramdisk.inf Endif Return ' Procedure Lezen Bestaat!=True If Eof(#1) ! End-Of-File Einde!=True Bestaat!=False Else Line Input #1,A$ ! get filename If Left$(A$)="@" ! create folder A$=Right$(A$,Len(A$)-1) Print " Creating folder ";A$;"..."; Chdrive (4) @Dir_exist(A$,*E%) ! check if folder already exists If E%=-33 ! no Mkdir A$ ! create it Else Print "it already exists!" Bestaat!=False Endif Chdrive (1) If Bestaat!=True Print "done!" Bestaat!=False Endif Else A$="A:\"+A$ ! add pathname Print " Checking ";A$; If Not Exist(A$) ! check if file exists Bestaat!=False Print At(50,Crslin);"it does not exist!" Endif Endif Endif Return ' Procedure Copy Open "i",#2,A$ L%=Lof(#2) ! determine length of the file to be copied If L%>=Dfree(4) ! not enough memory in ramdisk? Print At(50,Crslin);"no way, file too large!" Else Print At(50,Crslin);"copying...."; Open "o",#3,"d:"+Right$(A$,Len(A$)-3) While L%>32000 Bget #2,Varptr(Buf$),32000 ! read 32000 bytes from original file Bput #3,Varptr(Buf$),32000 ! write them to ramdisk Sub L%,32000 Wend Bget #2,Varptr(Buf$),L% ! read remainder Bput #3,Varptr(Buf$),L% ! write it Close #3 Print "done!" Endif Close #2 Return ' Procedure Dir_exist(Name$,E.%) Local A$ A$=Space$(44) Void Gemdos(&H1A,L:Varptr(A$)) ! create disk transfer buffer *E.%=Gemdos(&H4E,L:Varptr(Name$),&H10) ! search for filename Return