[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Auto-format RAMdisk on boot?



gachenb@eis.calstate.edu (Greg R. Achenbach) writes:
>> david@wraith.cs.uow.edu.au (David E A Wilson) writes:
>> With the slinky-type memory card all that is necessary is to write the boot
>> code to block zero - this can be done with a little assembly.

>How do I do this? I need more details.

>> Indeed, prosel lets you set up a file containing the stuff you want to
>> restore to the RAM disk and lets you configure prosel to do it on startup.

>I already know that and do it all the time.  But in order for the RAMdisk
>to be _bootable_ you need to format it first.  How do I automagically
>format the RAMdisk _before_ Prosel automatically loads it?

When you format a disk up to 3 steps take place.

1)	Prepare the magnetic media by writing the sector headers on each track.
	This is not done for RAM disks (no need) and is usually a special
	function for hard disks (low level formatting).

2)	Create the directory and bit map. These vary slightly with the size
	of the disk being formatted (if you have more than 512*8 blocks then
	you need a second block for the bit map). The directory also contains
	the size of the disk. The slinky style RAM card does this when it
	is first accessed after power is turned on. It checks location $BF00
	for either a $00 (indicates Pascal 1.3 is running) or a $4C (indicates
	ProDOS 8 is running). It builds a Pascal or a ProDOS directory and this
	remains until you format it.

3)	Install the appropriate boot blocks. Pascal 1.3 uses different boot
	blocks on 5.25" disks to 3.5" (and presumably RAMdisks). ProDOS 8 has
	a smarter boot program which can check to see what type of disk was
	booted and react appropriately.

So when you boot ProDOS 8 + ProSel from your 3.5" or 5.25" drive the RAMdisk
is accessed as part of ProDOS's slot scan and it formats itself up to step 2
above. All that remains to be done to make it a bootable volume is to copy
blocks 0 and 1 from the boot floppy into blocks 0 and 1 of the RAMdisk.

This can be done in about 1 page of assembly code (probably < 100 bytes of
object) and if step up as a system program with a quit call at the end it
could be chosen as ProSel's startup program thus automating the process.

I will write this code over the weekend and post it when I get it to work.
I have ProSel and a Apple slinky card so I can duplicate the original poster's
configuration to a reasonable degree (I have a //e while he has a //c+).

N.B. As was pointed out to me by mail, the 64k /RAM is special and does step
2 above all by itself when the format command is given to the driver.
-- 
David Wilson				+61 42 213802 voice, +61 42 213262 fax
Dept Comp Sci, Uni of Wollongong	david@cs.uow.edu.au