The problem with
many ramdisk file transfer programs is that they are in machine code
which makes them very inflexible and difficult to modify, especially
if you haven't got a clue about machine code programming. The
accompanying program is written for the most part in Basic and will
move selected files and programs to ramdisk at power-up. Being
written in Basic means you will be able to alter it to suit your own
needs.
The
program should be of use to everyone with a 130XE and if you own an
800, the program will still work, but you will have to fit extra
memory to hold the files. If you own an 800XL I strongly recommend
you read the October 1986 edition of COMPUTE! magazine, which shows
you how to create a small ramdisk in the hidden memory.
To use this program, all you need to do is type it in
and save it to disk. If you wish you can run it automatically by
using DOS 2.5's SETUP.COM file, to create an AUTORUN.SYS file. My
advice is to call this program RAMOVE.COM, but you can call it what
you wish, just so long as you use the same name in your AUTORUN.SYS
file.
Here's a breakdown of the program, with a few ideas on how you can
modify it for your own use.
1010 - This line sets up the strings we are going to
use for the machine code, and various other bits and pieces
required. You can change FILE$ if you wish here to a smaller number
if you want to move files of specific size. Say your maximum file
size was 4k you could dimension it accordingly. If you want to move
lots of files you can increase the number in NAME$. Simply multiply
the number of files you want to move by 8. Remember, 8 is the length
of a filename less the extender. FILE$ will be reduced in size
automatically, so remember the more files you want to move the
smaller they will have to be. As it stands FILE$ will move files up
to 240 sectors long, which is the largest I have. Also remember the RAMDISK is only so big, so make sure you don't try to move too many
files, as the program will stop with an error.
1020 - 1040 - These three lines copy the small
machine code program into CIO$, which is the most important part of
this program. I got this routine from 'COMPUTE!' many years ago, but
I'm afraid I can't remember who is responsible for it - probably
Bill Wilkinson.
2020 - 2030 - To move these files, we must
know which ones they are, so using IN$ we take this information
directly from the directory. If IN$ returns 'FREE' we know we have
read all the filenames, so we can go on and load any files we have
identified.
2040 - Here we check that the filename we have taken from the
directory is in fact a file to be moved.
2050 - 2060 If the test is positive we trim
the edges and
2070 - store
the result in NAME$.
2080 - Here we make sure that we are not going
to try and pack in too many files. If you want to increase the
number of files you are going to load, remember to increase the
value of X accordingly. If we have all the filenames we can fit, the
program will continue below.
3020 - Here we close the directory and make
sure we have got some files to move.
3030 - 3050 - This is where we decide how many
times we have to perform the load/save routines. X is going to be
equal to the number of files in NAME$. After performing the first
load/save we increase POS by eight, which indicates the position in
NAME$ of the next filename.
3060 - When all the files have been saved the
program has completed its job. Here I load a menu program, but you
can just stop the program if you wish, or else add some other
functions. Remember if you increase the size of the program, you are
going to interfere with the size of files you can move, running a
menu program keeps your Atari smart. If you are going to develop
some kind of data processing program, then MENU could easily refer
to the master control program, with all its sub programs and/or data
on Ramdisk.
4020 - 4040 - Having finished with IN$ earlier, we can now
use it to represent the filename of the program we want to load in
to FILE$. These two lines simply take the filename from NAME$, and
trim it into a useable filename. We must now empty FILE$ if we have
used it before, otherwise we could end up with one massive file of
all the other files we are moving. Having done all that, we must
tell the machine code whether we are going to perform a read or a
write operation.
4050 - Now we can open the disk file for
reading, and show what we are moving.
4060 - Because we are going to use a buffer to
store parts of the file, we must fill it up with inverse comma's. We
can then call up the machine code and load in the first part of the
file. The figure 1 in the arguments refer to the channel we are
using, so if you want to use this machine code for some other
purpose - say loading and saving data from a database - remember to
set this argument accordingly.
4070 - Now we must find out how much data we
have read, and this information is stored in locations 40 and 41.
Having done this we can trim the length of the buffer accordingly
and tag it on to the end of the file.
4080 - 4090 - If MIS equals 136 then we have
read all the files, so we can go off and store it on the ramdisk. If
it returns 1 then we still have some of the files to pull off the
disk, so we go back to line 4060 and get a little more.
4100 - If there are any problems, then MIS
will return an error number - so we can POKE that into the error
number location, 195, and trap to the error routines.
5020 - 5030 - Here we have the error trap
routine, which is fairly self explanatory.
6020 - Before saving the file to ramdisk we
must inform the machine code we are going to perform a write
operation. Then we change IN$ from drive 1 to drive 8. If you have
changed the ramdisk drive number by altering your DOS, remember to
change this number accordingly.
6030 - Now
open the ramdisk file for a write operation.
6040 - Using the machine code we now write the
file to Ramdisk.
6050 - Now
we can close the file, and go and look for some more.
6070 - Phew!
|
|
|
top