<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <link title="Purple" rel="stylesheet" href="manual-purple.css" type="text/css" /> <link title="Minty" rel="alternate stylesheet" href= "manual-minty.css" type="text/css" /> <link title="Plain" rel="alternate stylesheet" href="manual.css" type="text/css" /> <title>Using Diskmanipulator</title> </head> <body> <h1>Using Diskmanipulator</h1> <p>The <code>diskmanipulator</code> command is probably the most exuberant console command available in openMSX. It implements the basic stuff needed to handle files and subdirectories on MSX media. It also helps one creating new disk image files, both simple 360 kB and 720 kB disks as well as hard disk images containing up to 30 partitions of 32 MB each. Creating disk images and manipulating the files on them can be done without the need of a running emulated MSX (<code>set power off</code>).</p> <p>First we will see the generic syntax of the command, then the individual commands are explained in more depth. At the end of this document you will find some <a class="internal" href="#examples">examples of typical use</a>.</p> <div class="note"> Note: For now, this command does not work with SCSI disks and drives! So, you cannot create valid formatted SCSI hard disk images or manipulate files on hard disks formatted for use with a SCSI interface. </div> <h2>General Syntax</h2> <p>The general command syntax is always of the form:</p> <p><code>diskmanipulator <command> <disk name> <command arguments></code></p> <p><code><command></code> specifies the action to be performed. The next section lists the commands available and explains them.</p> <p><code><disk name></code> specifies the disk to operate on. Typical values are: <code>diska</code>, <code>diskb</code>, <code>hda</code> or the special <code>virtual_drive</code> device. <code>disk<x></code> and <code>hd<x></code> are the drives available to the running emulated MSX machine. This allows interaction with the currently used disk images.<br /> In case the disk contains an MSX-IDE compatible partition table you can add a partition number (from 1 till 31) to the disk name to specify on which partition the command will act. For example <code>hda2</code> is the second partition on the master IDE disk, <code>hdb3</code> is the third partition on the slave IDE disk.</p> <p><code><command arguments></code> depend upon the command involved, see the detailed descriptions of the commands below.</p> <p>The diskmanipulator and all its commands (including most parameters) can be tab completed in the console.</p> <h2>Commands</h2> <p>These are the commands understood by the diskmanipulator:</p> <ol class="inlinetoc"> <li><a class="internal" href="#chdir">chdir</a></li> <li><a class="internal" href="#create">create</a></li> <li><a class="internal" href="#dir">dir</a></li> <li><a class="internal" href="#export">export</a></li> <li><a class="internal" href="#format">format</a></li> <li><a class="internal" href="#import">import</a></li> <li><a class="internal" href="#mkdir">mkdir</a></li> <li><a class="internal" href="#savedsk">savedsk</a></li> </ol> <h3><a id="chdir">chdir</a></h3> <div class="subsectiontitle"> syntax: </div> <p><code>diskmanipulator chdir <disk name> <MSX directory></code></p> <div class="subsectiontitle"> explanation: </div> <p>This command selects the directory on the MSX disk image that will be used for the <code><a class="internal" href="#export">export</a></code> and <code><a class="internal" href="#import">import</a></code> commands.</p> <div class="note"> Note: The directory structure on the MSX disk image cannot be tab completed. </div> <h3><a id="create">create</a></h3> <div class="subsectiontitle"> syntax: </div> <p><code>diskmanipulator create <dskfilename> <size|option> <size|option> ...</code></p> <div class="subsectiontitle"> explanation: </div> <p>You can create new disk images using this command.</p> <p>This new disk will be formated using an MSX-DOS2 boot sector.</p> <p>You can specify multiple sizes in which case an MSX IDE compatible partitioned image will be created, each partition will be formatted as required. If a size of 360 kB or 720 kB is given, a normal floppy disk image is created single or double sided, respectively. Any larger value will result in an MSX IDE hard disk image.</p> <p>You can specify the disk/partition sizes be using the following postfixes:</p> <ul> <li>S or s -> size in sectors</li> <li>B or b -> size in bytes</li> <li>K or k -> size in kilobytes (default)</li> <li>M or m -> size in megabytes</li> </ul> <h3><a id="dir">dir</a></h3> <div class="subsectiontitle"> syntax: </div> <p><code>diskmanipulator dir <disk name></code></p> <div class="subsectiontitle"> explanation: </div> <p>This will show the directory content of the curring working directory. The output is formatted in similar to the MSX Disk BASIC 2.x command <code>files,l</code>.</p> <h3><a id="export">export</a></h3> <div class="subsectiontitle"> syntax: </div> <p><code>diskmanipulator export <disk name> <host directory></code></p> <div class="subsectiontitle"> explanation: </div> <p>This will export the files and subdirectories from the disk inserted in <code><disk name></code> to the <code><host directory></code> on your host OS. The subdirectory that will be exported from the MSX disk image is selected by the <code><a class="internal" href="#chdir">chdir</a></code> command.</p> <h3><a id="format">format</a></h3> <div class="subsectiontitle"> syntax: </div> <p><code>diskmanipulator format <disk name></code></p> <div class="subsectiontitle"> explanation: </div> <p>The currently selected partition from <code><disk name></code> will be cleanly formated with a MSX-DOS2 boot sector. FAT and directory sectors will be correctly initialised. Any data on the disk image / partition is lost!</p> <div class="note"> Note: Currently <code>diskmanipulator</code> cannot format a disk with a MSX-DOS1 bootsector. A few old non-standard programs require an MSX-DOS1 boot sector; to format a disk for these programs, format the disk from within the emulated MSX in an MSX-DOS1 environment. Most MSX2 machines without the <code>msxdos2</code> extension will do this for you if in MSX-BASIC you use the command <code>CALL FORMAT</code>. </div> <h3><a id="import">import</a></h3> <div class="subsectiontitle"> syntax: </div> <p><code>diskmanipulator import <disk name> <host directory|host file> ...</code></p> <div class="subsectiontitle"> explanation: </div> <p>This will import the single <code><host file></code> into the disk inserted in <code><disk name></code>. In case of a <code><host directory></code> it will import the files and subdirectories in <code><host directory></code> into the inserted disk. Multiple files and directories can be specified at the same time. The place were the files will be added in the MSX directory structure is selected by the <code><a class="internal" href="#chdir">chdir</a></code> command.</p> <p>If you want to use wildcards when importing files, you will have to use the Tcl <code>glob</code> command. This command will perform the wildcard expansion and return a Tcl list. Enclose the <code>glob</code> command in between '[' and ']':</p> <p><code>diskmanipulator import hda1 [glob *.txt] [glob *.asc]</code></p> <p>This command will copy all files matching <code>*.txt</code> and <code>*.asc</code> in the current directory on the host OS to the first partition of the master IDE drive on the emulated MSX.</p> <p>The <code>glob</code> command can also take extra options. For instance, if you only want to expand regular files and not the names of directories you can do this:</p> <p><code>diskmanipulator import hda1 [glob -type f info*]</code></p> <p>Consult your local Tcl guru or documentation for more info about the <code>glob</code> command and Tcl lists.</p> <h3><a id="mkdir">mkdir</a></h3> <div class="subsectiontitle"> syntax: </div> <p><code>diskmanipulator mkdir <disk name> <MSX directory></code></p> <div class="subsectiontitle"> explanation: </div> <p>This command will create the specified directory on the MSX disk image. All the needed parent directories will be created if they do not yet exist.</p> <h3><a id="savedsk">savedsk</a></h3> <div class="subsectiontitle"> syntax: </div> <p><code>diskmanipulator savedsk <disk name> <dskfilename></code></p> <div class="subsectiontitle"> explanation: </div> <p>This simply reads all the sectors of the <code><disk name></code> and saves them again in the file specified by <code><dskfilename></code>. This command is mostly equivalent to copying a disk image file on your host OS, but it has the additional possibilities:</p> <ul> <li>saving a ramdsk (see <code><a class="external" href="commands.html#disk">diska</a> ramdsk</code>) into a real disk image file</li> <li>saving your current DirAsDisk image into a real disk image file</li> <li>copying the currently active image file in case your host OS would give sharing violations while the file is being used by openMSX (Windows)</li> <li>saving a disk image if you removed the directory entry by accident, but openMSX still has an open file handle for the file (UNIX-like systems)</li> </ul> <h2><a id="examples">Examples</a></h2> <p>In these examples we will run the diskmanipulator while the emulated MSX is powered off. It is possible to run these commands while the machine is turned on of course, but be warned that this might have some strange, unexpected behaviour depending on the emulated MSX model and the running software on this MSX.</p> <p>For instance, the turboR models contain a physical switch inside their diskdrives to detect disk changes. If no disk change is detected their internal MSX-DOS2 kernel will cache certain sectors, so that files imported using the <code>diskmanipulator import</code> command will not show up if you perform a <code>files</code> or <code>dir</code>. Even worse, if you would write from the emulated MSX to the disk you will overwrite the result of the import. The same would happen if you were running a disk cache program in your emulated MSX machine.</p> <h3>creating a new disk with content</h3> <p> Here we create a regular 720 kB (double sided, double density) disk. Then we place the files and subdirectories from the directory <code>/tmp/todisk/</code> on this new disk: </p> <div class="commandline"> set <a class="external" href="commands.html#power">power</a> off <br /> diskmanipulator <a class="internal" href="#create">create</a> /tmp/new-disk.dsk 720 <br /> <a class="external" href="commands.html#disk">virtual_drive</a> /tmp/new-disk.dsk <br /> diskmanipulator <a class="internal" href="#import">import</a> virtual_drive /tmp/todisk/ </div> <h3>creating a new harddisk image with content</h3> <p> Here we create a new HD image with 3 partitions the first partition is 32 MB, then 16 MB and finally a small one of 720 kB. Then we place the files and subdirs of the directory <code>/tmp/topart1/</code> on the first partition and <code>/tmp/topart3/</code> on the third partition: </p> <div class="commandline"> set <a class="external" href="commands.html#power">power</a> off <br /> <a class="external" href="commands.html#ext">ext</a> ide <br /> diskmanipulator <a class="internal" href="#create">create</a> /tmp/new-hd.dsk 32M 16M 720 <br /> <a class="external" href="commands.html#hd">hda</a> /tmp/new-hd.dsk <br /> diskmanipulator <a class="internal" href="#import">import</a> hda1 /tmp/topart1 <br /> diskmanipulator <a class="internal" href="#import">import</a> hda3 /tmp/topart3 </div> <h3>importing data in a new subdirectory</h3> <p> On the diskimage <code>/tmp/disk.dsk</code> we will create a new subdirectory called <code>newsub</code> and then we fill this subdirectory with the <code>.txt</code> files from <code>/home/david/sources</code>: </p> <div class="commandline"> set <a class="external" href="commands.html#power">power</a> off <br /> <a class="external" href="commands.html#disk">diska</a> /tmp/disk.dsk <br /> diskmanipulator <a class="internal" href="#mkdir">mkdir</a> diska newsub <br /> diskmanipulator <a class="internal" href="#chdir">chdir</a> diska newsub <br /> diskmanipulator <a class="internal" href="#import">import</a> diska [glob -type f /home/david/sources/*.txt] </div> <h3>extracting files from an MSX harddisk image to the host OS</h3> <p> We will extract files from the currently used harddisk image on partition1 in the MSX subdir <code>\demos\calculus</code> to <code>/tmp/</code>: </p> <div class="commandline"> set <a class="external" href="commands.html#power">power</a> off <br /> <a class="external" href="commands.html#ext">ext</a> ide <br /> diskmanipulator <a class="internal" href="#chdir">chdir</a> hda1 /demos/calculus <br /> diskmanipulator <a class="internal" href="#export">export</a> hda1 /tmp </div> <p class="version">$Id: diskmanipulator.html 9686 2009-05-01 12:27:02Z m9710797 $</p> </body> </html>