doc/classes/TrsDos.src/M000558.html in ripxplore-0.17.0 vs doc/classes/TrsDos.src/M000558.html in ripxplore-0.17.1

- old
+ new

@@ -3,16 +3,62 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> - <title>sectors_per_granule (TrsDos)</title> + <title>files (TrsDos)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> - <pre><span class="ruby-comment cmt"># File lib/file_systems/TrsDos.rb, line 66</span> -<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sectors_per_granule</span>(<span class="ruby-identifier">file_system_image</span>) - <span class="ruby-value">5</span> + <pre><span class="ruby-comment cmt"># File lib/file_systems/TrsDos.rb, line 76</span> +<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">files</span>(<span class="ruby-identifier">file_system_image</span>) + <span class="ruby-identifier">files</span>=<span class="ruby-constant">FileContainer</span>.<span class="ruby-identifier">new</span> + <span class="ruby-identifier">granule_allocation_table</span>=<span class="ruby-identifier">file_system_image</span>.<span class="ruby-identifier">get_sector</span>(<span class="ruby-identifier">directory_track</span>,<span class="ruby-value">0</span>) + <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">files</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">granule_allocation_table</span>.<span class="ruby-identifier">nil?</span> + <span class="ruby-identifier">file_system_image</span>.<span class="ruby-identifier">volume_name</span>=<span class="ruby-identifier">granule_allocation_table</span>[<span class="ruby-value">0xd0</span>,<span class="ruby-value">8</span>].<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">&quot;A*&quot;</span>) + (<span class="ruby-identifier">file_system_image</span>.<span class="ruby-identifier">sectors_in_track</span>(<span class="ruby-identifier">directory_track</span>)<span class="ruby-operator">-</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sector_no</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">fde_sector</span>=<span class="ruby-identifier">file_system_image</span>.<span class="ruby-identifier">get_sector</span>(<span class="ruby-identifier">directory_track</span>,<span class="ruby-identifier">sector_no</span>) + (<span class="ruby-identifier">fde_sector</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">/</span><span class="ruby-constant">FDE_SIZE</span>).<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">fde_number</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">fde</span>=<span class="ruby-identifier">fde_sector</span>[<span class="ruby-identifier">fde_number</span><span class="ruby-operator">*</span><span class="ruby-constant">FDE_SIZE</span>,<span class="ruby-constant">FDE_SIZE</span>] + <span class="ruby-identifier">attributes</span>=<span class="ruby-identifier">fde</span>[<span class="ruby-value">0x00</span>] + + <span class="ruby-comment cmt">#for a valid FPDE, bit 7 is 0 and bite 4 is 1 </span> + <span class="ruby-identifier">is_fpde</span> = ((<span class="ruby-identifier">attributes</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0</span><span class="ruby-identifier">b10010000</span>)<span class="ruby-operator">==</span>(<span class="ruby-value">0</span><span class="ruby-identifier">b00010000</span>)) + <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">is_fpde</span> + <span class="ruby-identifier">eof_low</span>=<span class="ruby-identifier">fde</span>[<span class="ruby-value">0x03</span>] + <span class="ruby-identifier">filename_base</span>=<span class="ruby-identifier">fde</span>[<span class="ruby-value">0x05</span>,<span class="ruby-value">8</span>].<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">&quot;A8&quot;</span>) + <span class="ruby-identifier">filename_extension</span>=<span class="ruby-identifier">fde</span>[<span class="ruby-value">0x0</span><span class="ruby-constant">D</span>,<span class="ruby-value">3</span>].<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">&quot;A3&quot;</span>) + <span class="ruby-identifier">filename</span>=<span class="ruby-node">&quot;#{filename_base}/#{filename_extension}&quot;</span> + <span class="ruby-identifier">contents</span>=<span class="ruby-value str">&quot;&quot;</span> + <span class="ruby-identifier">eof_mid</span>=<span class="ruby-identifier">fde</span>[<span class="ruby-value">0x14</span>] + <span class="ruby-identifier">eof_high</span>=<span class="ruby-identifier">fde</span>[<span class="ruby-value">0x15</span>] + <span class="ruby-identifier">file_length</span>=(<span class="ruby-identifier">eof_high</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-value">16</span>)<span class="ruby-operator">+</span>(<span class="ruby-identifier">eof_mid</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-value">8</span>)<span class="ruby-operator">+</span><span class="ruby-identifier">eof_low</span> + <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">eof_low</span><span class="ruby-operator">&gt;</span><span class="ruby-value">0</span>) <span class="ruby-keyword kw">then</span> + <span class="ruby-identifier">file_length</span><span class="ruby-operator">-=</span><span class="ruby-value">0x100</span> + <span class="ruby-keyword kw">end</span> +<span class="ruby-comment cmt"># byte $16 - $1F : 5 pairs of extent elements, each pair made up of: </span> +<span class="ruby-comment cmt"># byte $00 : if $FF, then end of extent elements for this file. if $FE, then next byte contains the DEC for the first (or next) FXDE assigned to this file. </span> +<span class="ruby-comment cmt"># any other value ($00-$FD) equals the number of the diskette's lump in which the area starts. </span> +<span class="ruby-comment cmt"># byte $01 : bits 7-5 = number of granules (0-7) from the start of the lump to the start of the area </span> +<span class="ruby-comment cmt"># : bits 4- 0 = number less one of contiguous granules assigned to this area. </span> + + <span class="ruby-value">5</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">extent_no</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">extent</span>=<span class="ruby-identifier">fde</span>[(<span class="ruby-identifier">extent_no</span><span class="ruby-operator">*</span><span class="ruby-value">2</span>)<span class="ruby-operator">+</span><span class="ruby-value">0x16</span>,<span class="ruby-value">2</span>] + <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">extent</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">==</span><span class="ruby-value">0x</span><span class="ruby-constant">FF</span> + <span class="ruby-comment cmt">#raise &quot;FXDE's not implemented yet&quot; if extent[0]==0xFE </span> + <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">extent</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">==</span><span class="ruby-value">0x</span><span class="ruby-constant">FE</span> <span class="ruby-comment cmt"># &quot;FXDE's not implemented yet&quot; </span> + <span class="ruby-identifier">track_no</span>=<span class="ruby-identifier">extent</span>[<span class="ruby-value">0</span>] + <span class="ruby-identifier">granule_offset</span>=<span class="ruby-identifier">extent</span>[<span class="ruby-value">1</span>]<span class="ruby-operator">&gt;&gt;</span><span class="ruby-value">5</span> + <span class="ruby-identifier">number_of_granules</span>=<span class="ruby-value">1</span><span class="ruby-operator">+</span>(<span class="ruby-identifier">extent</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">&amp;</span> <span class="ruby-value">0</span><span class="ruby-identifier">b00011111</span>) + <span class="ruby-identifier">start_sector</span>=<span class="ruby-identifier">granule_offset</span><span class="ruby-operator">*</span><span class="ruby-identifier">sectors_per_granule</span>(<span class="ruby-identifier">file_system_image</span>) + <span class="ruby-identifier">number_of_sectors</span>=<span class="ruby-identifier">number_of_granules</span><span class="ruby-operator">*</span><span class="ruby-identifier">sectors_per_granule</span>(<span class="ruby-identifier">file_system_image</span>) + <span class="ruby-identifier">number_of_sectors</span>.<span class="ruby-identifier">times</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">contents</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-identifier">file_system_image</span>.<span class="ruby-identifier">get_sector</span>(<span class="ruby-identifier">track_no</span>,<span class="ruby-identifier">start_sector</span><span class="ruby-operator">+</span><span class="ruby-identifier">i</span>)} + <span class="ruby-keyword kw">end</span> + <span class="ruby-identifier">contents</span>=<span class="ruby-identifier">contents</span>[<span class="ruby-value">0</span>,<span class="ruby-identifier">file_length</span>] + <span class="ruby-identifier">files</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-constant">NativeFileType</span>.<span class="ruby-identifier">best_fit</span>(<span class="ruby-identifier">file_system_image</span>,<span class="ruby-identifier">filename</span>,<span class="ruby-identifier">contents</span>,<span class="ruby-identifier">filename_extension</span>) + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-identifier">files</span> <span class="ruby-keyword kw">end</span></pre> </body> </html> \ No newline at end of file