diskmanipulator.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  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. <body>
  14. <h1>Using Diskmanipulator</h1>
  15. <p>The <code>diskmanipulator</code> command is probably the most exuberant console command available
  16. in openMSX. It implements the basic stuff needed to handle files
  17. and subdirectories on MSX media. It also helps one creating new disk
  18. image files, both simple 360 kB and 720 kB disks as well as
  19. hard disk images containing up to 30 partitions of 32 MB each (only for Sunrise IDE!).
  20. Creating disk images and manipulating the files on them can be
  21. done without the need of a running emulated MSX (<code>set power
  22. off</code>).</p>
  23. <p>First we will see the generic syntax of the command, then
  24. the individual commands are explained in more depth. At the end
  25. of this document you will find some <a class="internal" href="#examples">examples of typical use</a>.</p>
  26. <div class="note">
  27. Note: For now, this command does not work with SCSI/SD disks and drives!
  28. So, you cannot create valid formatted SCSI hard disk images, SD card images
  29. or manipulate files on hard disks formatted for use with a SCSI interface
  30. or SD cards for an SD interface.
  31. </div>
  32. <h2>General Syntax</h2>
  33. <p>The general command syntax is always of the form:</p>
  34. <p><code>diskmanipulator &lt;command&gt; &lt;disk name&gt;
  35. &lt;command arguments&gt;</code></p>
  36. <p><code>&lt;command&gt;</code> specifies the action to be performed. The next section lists the commands available and explains them.</p>
  37. <p><code>&lt;disk name&gt;</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&lt;x&gt;</code> and <code>hd&lt;x&gt;</code> are the drives available to the running emulated MSX machine. This allows interaction with the currently used disk images.<br />
  38. In case the disk contains a Sunrise IDE (or Beer IDE 1.9RC1) compatible partition table (FAT12 only!) 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>
  39. <p><code>&lt;command arguments&gt;</code> depend upon the command involved, see the detailed descriptions of the commands below.</p>
  40. <p>The diskmanipulator and all its commands (including most parameters) can be tab completed in the console.</p>
  41. <h2>Commands</h2>
  42. <p>These are the commands understood by the diskmanipulator:</p>
  43. <ol class="inlinetoc">
  44. <li><a class="internal" href="#chdir">chdir</a></li>
  45. <li><a class="internal" href="#create">create</a></li>
  46. <li><a class="internal" href="#dir">dir</a></li>
  47. <li><a class="internal" href="#export">export</a></li>
  48. <li><a class="internal" href="#format">format</a></li>
  49. <li><a class="internal" href="#import">import</a></li>
  50. <li><a class="internal" href="#mkdir">mkdir</a></li>
  51. <li><a class="internal" href="#savedsk">savedsk</a></li>
  52. </ol>
  53. <h3><a id="chdir">chdir</a></h3>
  54. <div class="subsectiontitle">
  55. syntax:
  56. </div>
  57. <p><code>diskmanipulator chdir &lt;disk name&gt; &lt;MSX
  58. directory&gt;</code></p>
  59. <div class="subsectiontitle">
  60. explanation:
  61. </div>
  62. <p>This command selects the directory on the MSX disk image
  63. 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>
  64. <div class="note">
  65. Note: The directory structure on the MSX disk image cannot be tab
  66. completed.
  67. </div>
  68. <h3><a id="create">create</a></h3>
  69. <div class="subsectiontitle">
  70. syntax:
  71. </div>
  72. <p><code>diskmanipulator create &lt;dskfilename&gt;
  73. &lt;size|option&gt; &lt;size|option&gt; ...</code></p>
  74. <div class="subsectiontitle">
  75. explanation:
  76. </div>
  77. <p>You can create new disk images using this command.</p>
  78. <p>This new disk will be formatted using an MSX-DOS2 boot
  79. sector, unless you specify the option <code>-dos1</code>.</p>
  80. <p>You can specify multiple sizes in which case a Sunrise IDE compatible
  81. partitioned image will be created (FAT12 only!), each partition will be
  82. formatted as required. If a size of 360 kB or 720 kB is given, a normal
  83. floppy disk image is created single or double sided, respectively. Any larger
  84. value will result in a Sunrise IDE hard disk image.</p>
  85. <p>You can specify the disk/partition sizes by using the
  86. following postfixes:</p>
  87. <ul>
  88. <li>S or s -&gt; size in sectors</li>
  89. <li>B or b -&gt; size in bytes</li>
  90. <li>K or k -&gt; size in kilobytes (default)</li>
  91. <li>M or m -&gt; size in megabytes</li>
  92. </ul>
  93. <h3><a id="dir">dir</a></h3>
  94. <div class="subsectiontitle">
  95. syntax:
  96. </div>
  97. <p><code>diskmanipulator dir &lt;disk name&gt;</code></p>
  98. <div class="subsectiontitle">
  99. explanation:
  100. </div>
  101. <p>This will show the directory content of the current working
  102. directory. The output is formatted similarly to the MSX Disk BASIC 2.x command <code>files,l</code>.</p>
  103. <h3><a id="export">export</a></h3>
  104. <div class="subsectiontitle">
  105. syntax:
  106. </div>
  107. <p><code>diskmanipulator export &lt;disk name&gt; &lt;host
  108. directory&gt;</code></p>
  109. <div class="subsectiontitle">
  110. explanation:
  111. </div>
  112. <p>This will export the files and subdirectories from the disk
  113. inserted in <code>&lt;disk name&gt;</code> to the <code>&lt;host directory&gt;</code> on
  114. your host OS. The subdirectory that will be exported from the MSX
  115. disk image is selected by the <code><a class="internal" href="#chdir">chdir</a></code> command.</p>
  116. <h3><a id="format">format</a></h3>
  117. <div class="subsectiontitle">
  118. syntax:
  119. </div>
  120. <p><code>diskmanipulator format &lt;disk name&gt;</code></p>
  121. <div class="subsectiontitle">
  122. explanation:
  123. </div>
  124. <p>The currently selected partition from <code>&lt;disk name&gt;</code> will
  125. be cleanly formatted with a MSX-DOS2 boot sector, unless the option
  126. <code>-dos1</code> is specified.
  127. FAT and directory sectors will be correctly initialised.
  128. Any data on the disk image / partition is lost!</p>
  129. <h3><a id="import">import</a></h3>
  130. <div class="subsectiontitle">
  131. syntax:
  132. </div>
  133. <p><code>diskmanipulator import &lt;disk name&gt; &lt;host
  134. directory|host file&gt; ...</code></p>
  135. <div class="subsectiontitle">
  136. explanation:
  137. </div>
  138. <p>This will import the single <code>&lt;host file&gt;</code> into the disk
  139. inserted in <code>&lt;disk name&gt;</code>. In case of a <code>&lt;host
  140. directory&gt;</code> it will import the files and subdirectories in
  141. <code>&lt;host directory&gt;</code> into the inserted disk. Multiple files and
  142. directories can be specified at the same time. The place were the
  143. files will be added in the MSX directory structure is selected
  144. by the <code><a class="internal" href="#chdir">chdir</a></code> command.</p>
  145. <p>If you want to use wildcards when importing files, you will have to use
  146. the Tcl <a class="external" href="http://www.tcl.tk/man/tcl8.5/TclCmd/glob.htm">
  147. <code>glob</code></a> command. This command will perform the wildcard
  148. expansion and return a Tcl list. Enclose the <code>glob</code> command in
  149. between '[' and ']':</p>
  150. <p><code>diskmanipulator import hda1 [glob *.txt] [glob
  151. *.asc]</code></p>
  152. <p>This command will copy all files matching <code>*.txt</code> and <code>*.asc</code> in
  153. the current directory on the host OS to the first partition of
  154. the master IDE drive on the emulated MSX.</p>
  155. <p>The <code>glob</code> command can also take extra options. For instance, if
  156. you only want to expand regular files and not the names of
  157. directories you can do this:</p>
  158. <p><code>diskmanipulator import hda1 [glob -type f
  159. info*]</code></p>
  160. <p>Consult your local Tcl guru or documentation for more info
  161. about the <code>glob</code> command and Tcl lists.</p>
  162. <h3><a id="mkdir">mkdir</a></h3>
  163. <div class="subsectiontitle">
  164. syntax:
  165. </div>
  166. <p><code>diskmanipulator mkdir &lt;disk name&gt; &lt;MSX
  167. directory&gt;</code></p>
  168. <div class="subsectiontitle">
  169. explanation:
  170. </div>
  171. <p>This command will create the specified directory on the MSX disk image.
  172. All the needed parent directories will be created if they do not
  173. yet exist.</p>
  174. <h3><a id="savedsk">savedsk</a></h3>
  175. <div class="subsectiontitle">
  176. syntax:
  177. </div>
  178. <p><code>diskmanipulator savedsk &lt;disk name&gt;
  179. &lt;dskfilename&gt;</code></p>
  180. <div class="subsectiontitle">
  181. explanation:
  182. </div>
  183. <p>This simply reads all the sectors of the <code>&lt;disk name&gt;</code> and
  184. saves them again in the file specified by <code>&lt;dskfilename&gt;</code>.
  185. This command is mostly equivalent to copying a disk image file on your host OS, but it has the additional possibilities:</p>
  186. <ul>
  187. <li>saving a ramdsk (see <code><a class="external" href="commands.html#disk">diska</a> ramdsk</code>) into a real disk image file</li>
  188. <li>saving your current DirAsDisk image into a real disk image file</li>
  189. <li>saving your disk image which has undergone IPS patches as a patched disk image</li>
  190. <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>
  191. <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>
  192. </ul>
  193. <h2><a id="examples">Examples</a></h2>
  194. <p>In these examples we will run the diskmanipulator while the
  195. emulated MSX is powered off.
  196. It is possible to run these commands while the machine is
  197. turned on of course, but be warned that this might have some
  198. strange, unexpected behaviour depending on the emulated MSX model
  199. and the running software on this MSX.</p>
  200. <p>For instance, the turboR models contain a physical switch
  201. inside their diskdrives to detect disk changes. If no disk change
  202. is detected their internal MSX-DOS2 kernel will cache certain
  203. sectors, so that files imported using the <code>diskmanipulator import</code>
  204. command will not show up if you perform a <code>files</code> or
  205. <code>dir</code>. Even worse, if you would write from the
  206. emulated MSX to the disk you will overwrite the result of the import.
  207. The same would happen if you were running a disk cache
  208. program in your emulated MSX machine.</p>
  209. <h3>creating a new disk with content</h3>
  210. <p>
  211. Here we create a regular 720 kB (double sided, double density)
  212. disk. Then we place the files and subdirectories from the directory
  213. <code>/tmp/todisk/</code> on this new disk:
  214. </p>
  215. <div class="commandline">
  216. set <a class="external" href="commands.html#power">power</a> off
  217. <br />
  218. diskmanipulator <a class="internal" href="#create">create</a> /tmp/new-disk.dsk 720
  219. <br />
  220. <a class="external" href="commands.html#disk">virtual_drive</a> /tmp/new-disk.dsk
  221. <br />
  222. diskmanipulator <a class="internal" href="#import">import</a> virtual_drive /tmp/todisk/
  223. </div>
  224. <h3>creating a new harddisk image with content</h3>
  225. <p>
  226. Here we create a new HD image with 3 partitions the first
  227. partition is 32 MB, then 16 MB and finally a small
  228. one of 720 kB.
  229. Then we place the files and subdirs of the directory
  230. <code>/tmp/topart1/</code> on the first partition and <code>/tmp/topart3/</code> on the third partition:
  231. </p>
  232. <div class="commandline">
  233. set <a class="external" href="commands.html#power">power</a> off
  234. <br />
  235. <a class="external" href="commands.html#ext">ext</a> ide
  236. <br />
  237. diskmanipulator <a class="internal" href="#create">create</a> /tmp/new-hd.dsk 32M 16M 720
  238. <br />
  239. <a class="external" href="commands.html#hd">hda</a> /tmp/new-hd.dsk
  240. <br />
  241. diskmanipulator <a class="internal" href="#import">import</a> hda1 /tmp/topart1
  242. <br />
  243. diskmanipulator <a class="internal" href="#import">import</a> hda3 /tmp/topart3
  244. </div>
  245. <h3>importing data in a new subdirectory</h3>
  246. <p>
  247. On the diskimage <code>/tmp/disk.dsk</code> we will create a new
  248. subdirectory called <code>newsub</code> and then we fill this subdirectory with the
  249. <code>.txt</code> files from <code>/home/david/sources</code>:
  250. </p>
  251. <div class="commandline">
  252. set <a class="external" href="commands.html#power">power</a> off
  253. <br />
  254. <a class="external" href="commands.html#disk">diska</a> /tmp/disk.dsk
  255. <br />
  256. diskmanipulator <a class="internal" href="#mkdir">mkdir</a> diska newsub
  257. <br />
  258. diskmanipulator <a class="internal" href="#chdir">chdir</a> diska newsub
  259. <br />
  260. diskmanipulator <a class="internal" href="#import">import</a> diska [glob -type f /home/david/sources/*.txt]
  261. </div>
  262. <h3>extracting files from an MSX harddisk image to the host OS</h3>
  263. <p>
  264. We will extract files from the currently used harddisk image on
  265. partition1 in the MSX subdir <code>\demos\calculus</code> to <code>/tmp/</code>:
  266. </p>
  267. <div class="commandline">
  268. set <a class="external" href="commands.html#power">power</a> off
  269. <br />
  270. <a class="external" href="commands.html#ext">ext</a> ide
  271. <br />
  272. diskmanipulator <a class="internal" href="#chdir">chdir</a> hda1 /demos/calculus
  273. <br />
  274. diskmanipulator <a class="internal" href="#export">export</a> hda1 /tmp
  275. </div>
  276. </body>
  277. </html>