| 1 |
<!DOCTYPE html> |
| 2 |
<html lang="en"> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<link title="Purple" rel="stylesheet" href="manual-purple.css" |
| 6 |
type="text/css"> |
| 7 |
<link title="Minty" rel="alternate stylesheet" href= |
| 8 |
"manual-minty.css" type="text/css"> |
| 9 |
<link title="Plain" rel="alternate stylesheet" href="manual.css" |
| 10 |
type="text/css"> |
| 11 |
<title>Using Diskmanipulator</title> |
| 12 |
</head> |
| 13 |
|
| 14 |
<body> |
| 15 |
<h1>Using Diskmanipulator</h1> |
| 16 |
|
| 17 |
<p>The <code>diskmanipulator</code> command is probably the most exuberant console command available |
| 18 |
in openMSX. It implements the basic stuff needed to handle files |
| 19 |
and subdirectories on MSX media. It also helps one creating new disk |
| 20 |
image files, both simple 360 kB and 720 kB disks as well as |
| 21 |
hard disk images containing partitions of 32 MB each for Sunrise IDE, |
| 22 |
or up to 4 GB for Nextor. |
| 23 |
Creating disk images and manipulating the files on them can be |
| 24 |
done without the need of a running emulated MSX (<code>set power |
| 25 |
off</code>).</p> |
| 26 |
|
| 27 |
<p>First we will see the generic syntax of the command, then |
| 28 |
the individual commands are explained in more depth. At the end |
| 29 |
of this document you will find some <a class="internal" href="#examples">examples of typical use</a>.</p> |
| 30 |
|
| 31 |
<div class="note"> |
| 32 |
Note: hard disk like media (IDE and SCSI hard disks, SD cards) are only |
| 33 |
understood when they have a Sunrise IDE, Beer IDE 1.9RC1 or Nextor |
| 34 |
partition table, or no partition table at all (in which case the whole |
| 35 |
image is treated as a single volume). Only FAT12 and FAT16 partitions can |
| 36 |
be manipulated; FAT32 partitions are not supported. Images formatted by a |
| 37 |
SCSI BIOS that uses yet another partition table layout will report |
| 38 |
<code>No (or invalid) partition table.</code> |
| 39 |
</div> |
| 40 |
|
| 41 |
<div class="note"> |
| 42 |
Note: manipulating a hard disk, SD card or CompactFlash image while the |
| 43 |
emulated MSX has it mounted can corrupt the image, because the MSX side |
| 44 |
does not notice the change and keeps using its cached FAT information. Use |
| 45 |
<code>set power off</code> first, or do the manipulation in a separate |
| 46 |
openMSX instance. |
| 47 |
</div> |
| 48 |
|
| 49 |
<h2>General Syntax</h2> |
| 50 |
|
| 51 |
<p>The general command syntax is always of the form:</p> |
| 52 |
|
| 53 |
<p><code>diskmanipulator <command> <disk name> |
| 54 |
<command arguments></code></p> |
| 55 |
|
| 56 |
<p><code><command></code> specifies the action to be performed. The next section lists the commands available and explains them.</p> |
| 57 |
|
| 58 |
<p><code><disk name></code> specifies the disk to operate on. Typical values are: <code><a class="external" href="commands.html#disk">diska</a></code>, <code>diskb</code>, <code><a class="external" href="commands.html#hd">hda</a></code> or the special <code><a class="external" href="commands.html#disk">virtual_drive</a></code> device. <code>disk<x></code> and <code>hd<x></code> are the drives available to the running emulated MSX machine; <code>hd<x></code> covers all hard disk like media, so IDE and SCSI hard disks as well as the SD cards of e.g. the MegaFlashROM SCC+ SD. This allows interaction with the currently used disk images.<br /> |
| 59 |
In case the disk contains a Sunrise IDE, Beer IDE 1.9RC1 or Nextor compatible partition table you can add a partition number (starting at 1) 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> |
| 60 |
|
| 61 |
<p><code><command arguments></code> depend upon the command involved, see the detailed descriptions of the commands below.</p> |
| 62 |
|
| 63 |
<p>The diskmanipulator and all its commands (including most parameters) can be tab completed in the console.</p> |
| 64 |
|
| 65 |
<h2>Commands</h2> |
| 66 |
|
| 67 |
<p>These are the commands understood by the diskmanipulator:</p> |
| 68 |
|
| 69 |
<ol class="inlinetoc"> |
| 70 |
<li><a class="internal" href="#chdir">chdir</a></li> |
| 71 |
|
| 72 |
<li><a class="internal" href="#create">create</a></li> |
| 73 |
|
| 74 |
<li><a class="internal" href="#dir">dir</a></li> |
| 75 |
|
| 76 |
<li><a class="internal" href="#export">export</a></li> |
| 77 |
|
| 78 |
<li><a class="internal" href="#format">format</a></li> |
| 79 |
|
| 80 |
<li><a class="internal" href="#import">import</a></li> |
| 81 |
|
| 82 |
<li><a class="internal" href="#mkdir">mkdir</a></li> |
| 83 |
|
| 84 |
<li><a class="internal" href="#partition">partition</a></li> |
| 85 |
|
| 86 |
<li><a class="internal" href="#savedsk">savedsk</a></li> |
| 87 |
</ol> |
| 88 |
|
| 89 |
<h3><a id="chdir">chdir</a></h3> |
| 90 |
|
| 91 |
<div class="subsectiontitle"> |
| 92 |
syntax: |
| 93 |
</div> |
| 94 |
|
| 95 |
<p><code>diskmanipulator chdir <disk name> <MSX |
| 96 |
directory></code></p> |
| 97 |
|
| 98 |
<div class="subsectiontitle"> |
| 99 |
explanation: |
| 100 |
</div> |
| 101 |
|
| 102 |
<p>This command selects the directory on the MSX disk image |
| 103 |
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> |
| 104 |
|
| 105 |
<div class="note"> |
| 106 |
Note: The directory structure on the MSX disk image cannot be tab |
| 107 |
completed. |
| 108 |
</div> |
| 109 |
|
| 110 |
<h3><a id="create">create</a></h3> |
| 111 |
|
| 112 |
<div class="subsectiontitle"> |
| 113 |
syntax: |
| 114 |
</div> |
| 115 |
|
| 116 |
<p><code>diskmanipulator create <dskfilename> |
| 117 |
<size|option> [<size|option> ...]</code></p> |
| 118 |
|
| 119 |
<div class="subsectiontitle"> |
| 120 |
explanation: |
| 121 |
</div> |
| 122 |
|
| 123 |
<p>You can create new disk images using this command.</p> |
| 124 |
|
| 125 |
<p>This new disk will be formatted using an MSX-DOS2 boot sector by default, |
| 126 |
an MSX-DOS boot sector if you specify the option <code>-dos1</code>, |
| 127 |
or a Nextor boot sector if you specify the option <code>-nextor</code>.</p> |
| 128 |
|
| 129 |
<p>If a size of 360 kB or 720 kB is given, a normal floppy disk image is |
| 130 |
created, single or double sided respectively. Any larger value will result |
| 131 |
in a Sunrise IDE hard disk image, or a Nextor one if the <code>-nextor</code> |
| 132 |
option is specified.</p> |
| 133 |
|
| 134 |
<p>You can specify multiple sizes in which case a Beer IDE 1.9, Sunrise IDE |
| 135 |
or Nextor compatible partitioned image will be created, see |
| 136 |
<code><a class="internal" href="#partition">partition</a></code> for more |
| 137 |
information. Each partition will be formatted as required.</p> |
| 138 |
|
| 139 |
<p>You can specify the disk/partition sizes by using the |
| 140 |
following postfixes:</p> |
| 141 |
|
| 142 |
<ul> |
| 143 |
<li>S or s -> size in sectors</li> |
| 144 |
|
| 145 |
<li>B or b -> size in bytes</li> |
| 146 |
|
| 147 |
<li>K or k -> size in kilobytes (default)</li> |
| 148 |
|
| 149 |
<li>M or m -> size in megabytes</li> |
| 150 |
</ul> |
| 151 |
|
| 152 |
<h3><a id="dir">dir</a></h3> |
| 153 |
|
| 154 |
<div class="subsectiontitle"> |
| 155 |
syntax: |
| 156 |
</div> |
| 157 |
|
| 158 |
<p><code>diskmanipulator dir <disk name></code></p> |
| 159 |
|
| 160 |
<div class="subsectiontitle"> |
| 161 |
explanation: |
| 162 |
</div> |
| 163 |
|
| 164 |
<p>This will show the directory content of the current working |
| 165 |
directory. The output is formatted similarly to the MSX Disk BASIC 2.x command <code>files,l</code>.</p> |
| 166 |
|
| 167 |
<h3><a id="export">export</a></h3> |
| 168 |
|
| 169 |
<div class="subsectiontitle"> |
| 170 |
syntax: |
| 171 |
</div> |
| 172 |
|
| 173 |
<p><code>diskmanipulator export <disk name> <host |
| 174 |
directory> [<file|subdir>...]</code></p> |
| 175 |
|
| 176 |
<div class="subsectiontitle"> |
| 177 |
explanation: |
| 178 |
</div> |
| 179 |
|
| 180 |
<p>This will export the <code><file></code> or <code><subdir></code> from the disk |
| 181 |
inserted in <code><disk name></code> to the <code><host directory></code> on |
| 182 |
your host OS from the subdirectory selected by the <code><a class="internal" href="#chdir">chdir</a></code> |
| 183 |
command. If no <code><file></code> or <code><subdir></code> is specified, the whole |
| 184 |
contents of the subdirectory are exported.</p> |
| 185 |
|
| 186 |
<h3><a id="format">format</a></h3> |
| 187 |
|
| 188 |
<div class="subsectiontitle"> |
| 189 |
syntax: |
| 190 |
</div> |
| 191 |
|
| 192 |
<p><code>diskmanipulator format <disk name> [<size|option>]</code></p> |
| 193 |
|
| 194 |
<div class="subsectiontitle"> |
| 195 |
explanation: |
| 196 |
</div> |
| 197 |
|
| 198 |
<p>The currently selected partition from <code><disk name></code> will |
| 199 |
be cleanly formatted with a MSX-DOS2 boot sector, unless the option |
| 200 |
<code>-dos1</code> is specified. If the <code>-nextor</code> option is |
| 201 |
specified it will use the Nextor boot sector, and use FAT16 if the size is |
| 202 |
larger than 32 MB. |
| 203 |
FAT and directory sectors will be correctly initialised. |
| 204 |
Any data on the disk image / partition is lost!</p> |
| 205 |
|
| 206 |
<h3><a id="import">import</a></h3> |
| 207 |
|
| 208 |
<div class="subsectiontitle"> |
| 209 |
syntax: |
| 210 |
</div> |
| 211 |
|
| 212 |
<p><code>diskmanipulator import <disk name> <host |
| 213 |
directory|host file> ...</code></p> |
| 214 |
|
| 215 |
<div class="subsectiontitle"> |
| 216 |
explanation: |
| 217 |
</div> |
| 218 |
|
| 219 |
<p>This will import the single <code><host file></code> into the disk |
| 220 |
inserted in <code><disk name></code>. In case of a <code><host |
| 221 |
directory></code> it will import the files and subdirectories in |
| 222 |
<code><host directory></code> into the inserted disk. Multiple files and |
| 223 |
directories can be specified at the same time. The place were the |
| 224 |
files will be added in the MSX directory structure is selected |
| 225 |
by the <code><a class="internal" href="#chdir">chdir</a></code> command.</p> |
| 226 |
|
| 227 |
<p>If you want to use wildcards when importing files, you will have to use |
| 228 |
the Tcl <a class="external" href="http://www.tcl.tk/man/tcl8.5/TclCmd/glob.htm"> |
| 229 |
<code>glob</code></a> command. This command will perform the wildcard |
| 230 |
expansion and return a Tcl list. Enclose the <code>glob</code> command in |
| 231 |
between '[' and ']':</p> |
| 232 |
|
| 233 |
<p><code>diskmanipulator import hda1 [glob *.txt] [glob |
| 234 |
*.asc]</code></p> |
| 235 |
|
| 236 |
<p>This command will copy all files matching <code>*.txt</code> and <code>*.asc</code> in |
| 237 |
the current directory on the host OS to the first partition of |
| 238 |
the master IDE drive on the emulated MSX.</p> |
| 239 |
|
| 240 |
<p>The <code>glob</code> command can also take extra options. For instance, if |
| 241 |
you only want to expand regular files and not the names of |
| 242 |
directories you can do this:</p> |
| 243 |
|
| 244 |
<p><code>diskmanipulator import hda1 [glob -type f |
| 245 |
info*]</code></p> |
| 246 |
|
| 247 |
<p>Consult your local Tcl guru or documentation for more info |
| 248 |
about the <code>glob</code> command and Tcl lists.</p> |
| 249 |
|
| 250 |
<h3><a id="mkdir">mkdir</a></h3> |
| 251 |
|
| 252 |
<div class="subsectiontitle"> |
| 253 |
syntax: |
| 254 |
</div> |
| 255 |
|
| 256 |
<p><code>diskmanipulator mkdir <disk name> <MSX |
| 257 |
directory></code></p> |
| 258 |
|
| 259 |
<div class="subsectiontitle"> |
| 260 |
explanation: |
| 261 |
</div> |
| 262 |
|
| 263 |
<p>This command will create the specified directory on the MSX disk image. |
| 264 |
All the needed parent directories will be created if they do not |
| 265 |
yet exist.</p> |
| 266 |
|
| 267 |
<h3><a id="savedsk">savedsk</a></h3> |
| 268 |
|
| 269 |
<div class="subsectiontitle"> |
| 270 |
syntax: |
| 271 |
</div> |
| 272 |
|
| 273 |
<p><code>diskmanipulator partition <disk name> |
| 274 |
[<size|option> ...]</code></p> |
| 275 |
|
| 276 |
<div class="subsectiontitle"> |
| 277 |
explanation: |
| 278 |
</div> |
| 279 |
|
| 280 |
<p>You can (re)partition existing disk images using this command.</p> |
| 281 |
|
| 282 |
<p>As many partitions as specified will be created, using one of the |
| 283 |
following partition table formats according to the option given:</p> |
| 284 |
|
| 285 |
<ul> |
| 286 |
<li><code>-dos1</code>: Standard MBR, Beer IDE 1.9 and Nextor compatible. |
| 287 |
Max 4 partitions.</li> |
| 288 |
<li><code>-dos2</code> (default): Sunrise IDE MBR, Sunrise IDE compatible. |
| 289 |
Max 31 partitions.</li> |
| 290 |
<li><code>-nextor</code>: Standard MBR / EBR, Nextor compatible. |
| 291 |
Max 256 partitions.</li> |
| 292 |
</ul> |
| 293 |
|
| 294 |
<p>After partitioning each partition will also be formatted appropriately, |
| 295 |
see <a href="#format">format</a> for more details on that.</p> |
| 296 |
|
| 297 |
<p>You can specify the disk/partition sizes by using the following |
| 298 |
postfixes:</p> |
| 299 |
|
| 300 |
<ul> |
| 301 |
<li>S or s -> size in sectors</li> |
| 302 |
<li>B or b -> size in bytes</li> |
| 303 |
<li>K or k -> size in kilobytes (default)</li> |
| 304 |
<li>M or m -> size in megabytes</li> |
| 305 |
</ul> |
| 306 |
|
| 307 |
<p><code>diskmanipulator savedsk <disk name> |
| 308 |
<dskfilename></code></p> |
| 309 |
|
| 310 |
<div class="subsectiontitle"> |
| 311 |
explanation: |
| 312 |
</div> |
| 313 |
|
| 314 |
<p>This simply reads all the sectors of the <code><disk name></code> and |
| 315 |
saves them again in the file specified by <code><dskfilename></code>. |
| 316 |
This command is mostly equivalent to copying a disk image file on your host OS, but it has the additional possibilities:</p> |
| 317 |
|
| 318 |
<ul> |
| 319 |
<li>saving a ramdsk (see <code><a class="external" href="commands.html#disk">diska</a> ramdsk</code>) into a real disk image file</li> |
| 320 |
|
| 321 |
<li>saving your current DirAsDisk image into a real disk image file</li> |
| 322 |
|
| 323 |
<li>saving your disk image which has undergone IPS patches as a patched disk image</li> |
| 324 |
|
| 325 |
<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> |
| 326 |
|
| 327 |
<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> |
| 328 |
</ul> |
| 329 |
|
| 330 |
<h2><a id="examples">Examples</a></h2> |
| 331 |
|
| 332 |
<p>In these examples we will run the diskmanipulator while the |
| 333 |
emulated MSX is powered off. |
| 334 |
It is possible to run these commands while the machine is |
| 335 |
turned on of course, but be warned that this might have some |
| 336 |
strange, unexpected behaviour depending on the emulated MSX model |
| 337 |
and the running software on this MSX.</p> |
| 338 |
|
| 339 |
<p>For instance, the turboR models contain a physical switch |
| 340 |
inside their diskdrives to detect disk changes. If no disk change |
| 341 |
is detected their internal MSX-DOS2 kernel will cache certain |
| 342 |
sectors, so that files imported using the <code>diskmanipulator import</code> |
| 343 |
command will not show up if you perform a <code>files</code> or |
| 344 |
<code>dir</code>. Even worse, if you would write from the |
| 345 |
emulated MSX to the disk you will overwrite the result of the import. |
| 346 |
The same would happen if you were running a disk cache |
| 347 |
program in your emulated MSX machine.</p> |
| 348 |
|
| 349 |
<h3>creating a new disk with content</h3> |
| 350 |
|
| 351 |
<p> |
| 352 |
Here we create a regular 720 kB (double sided, double density) |
| 353 |
disk. Then we place the files and subdirectories from the directory |
| 354 |
<code>/tmp/todisk/</code> on this new disk: |
| 355 |
</p> |
| 356 |
|
| 357 |
<div class="commandline"> |
| 358 |
set <a class="external" href="commands.html#power">power</a> off |
| 359 |
<br /> |
| 360 |
diskmanipulator <a class="internal" href="#create">create</a> /tmp/new-disk.dsk 720 |
| 361 |
<br /> |
| 362 |
<a class="external" href="commands.html#disk">virtual_drive</a> /tmp/new-disk.dsk |
| 363 |
<br /> |
| 364 |
diskmanipulator <a class="internal" href="#import">import</a> virtual_drive /tmp/todisk/ |
| 365 |
</div> |
| 366 |
|
| 367 |
<h3>creating a new harddisk image with content</h3> |
| 368 |
|
| 369 |
<p> |
| 370 |
Here we create a new HD image with 3 partitions the first |
| 371 |
partition is 32 MB, then 16 MB and finally a small |
| 372 |
one of 720 kB. |
| 373 |
Then we place the files and subdirs of the directory |
| 374 |
<code>/tmp/topart1/</code> on the first partition and <code>/tmp/topart3/</code> on the third partition: |
| 375 |
</p> |
| 376 |
|
| 377 |
<div class="commandline"> |
| 378 |
set <a class="external" href="commands.html#power">power</a> off |
| 379 |
<br /> |
| 380 |
<a class="external" href="commands.html#ext">ext</a> ide |
| 381 |
<br /> |
| 382 |
diskmanipulator <a class="internal" href="#create">create</a> /tmp/new-hd.dsk 32M 16M 720 |
| 383 |
<br /> |
| 384 |
<a class="external" href="commands.html#hd">hda</a> /tmp/new-hd.dsk |
| 385 |
<br /> |
| 386 |
diskmanipulator <a class="internal" href="#import">import</a> hda1 /tmp/topart1 |
| 387 |
<br /> |
| 388 |
diskmanipulator <a class="internal" href="#import">import</a> hda3 /tmp/topart3 |
| 389 |
</div> |
| 390 |
|
| 391 |
<h3>importing data in a new subdirectory</h3> |
| 392 |
|
| 393 |
<p> |
| 394 |
On the diskimage <code>/tmp/disk.dsk</code> we will create a new |
| 395 |
subdirectory called <code>newsub</code> and then we fill this subdirectory with the |
| 396 |
<code>.txt</code> files from <code>/home/david/sources</code>: |
| 397 |
</p> |
| 398 |
|
| 399 |
<div class="commandline"> |
| 400 |
set <a class="external" href="commands.html#power">power</a> off |
| 401 |
<br /> |
| 402 |
<a class="external" href="commands.html#disk">diska</a> /tmp/disk.dsk |
| 403 |
<br /> |
| 404 |
diskmanipulator <a class="internal" href="#mkdir">mkdir</a> diska newsub |
| 405 |
<br /> |
| 406 |
diskmanipulator <a class="internal" href="#chdir">chdir</a> diska newsub |
| 407 |
<br /> |
| 408 |
diskmanipulator <a class="internal" href="#import">import</a> diska [glob -type f /home/david/sources/*.txt] |
| 409 |
</div> |
| 410 |
|
| 411 |
<h3>extracting files from an MSX harddisk image to the host OS</h3> |
| 412 |
|
| 413 |
<p> |
| 414 |
We will extract files from the currently used harddisk image on |
| 415 |
partition1 in the MSX subdir <code>\demos\calculus</code> to <code>/tmp/</code>: |
| 416 |
</p> |
| 417 |
|
| 418 |
<div class="commandline"> |
| 419 |
set <a class="external" href="commands.html#power">power</a> off |
| 420 |
<br /> |
| 421 |
<a class="external" href="commands.html#ext">ext</a> ide |
| 422 |
<br /> |
| 423 |
diskmanipulator <a class="internal" href="#chdir">chdir</a> hda1 /demos/calculus |
| 424 |
<br /> |
| 425 |
diskmanipulator <a class="internal" href="#export">export</a> hda1 /tmp |
| 426 |
</div> |
| 427 |
|
| 428 |
</body> |
| 429 |
</html> |