doc/classes/D64.src/M000182.html in ripxplore-0.17.0 vs doc/classes/D64.src/M000182.html in ripxplore-0.17.1
- old
+ new
@@ -3,19 +3,20 @@
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
- <title>get_sector (D64)</title>
+ <title>set_sector (D64)</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/image_formats/D64.rb, line 66</span>
-<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_sector</span>(<span class="ruby-identifier">track_no</span>,<span class="ruby-identifier">sector_no</span>)
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@sectors_in_track</span>[<span class="ruby-identifier">track_no</span>].<span class="ruby-identifier">nil?</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">sector_no</span>.<span class="ruby-identifier">between?</span>(<span class="ruby-value">0</span>,<span class="ruby-ivar">@@sectors_in_track</span>[<span class="ruby-identifier">track_no</span>]<span class="ruby-operator">-</span><span class="ruby-value">1</span>)
+ <pre><span class="ruby-comment cmt"># File lib/image_formats/D64.rb, line 73</span>
+<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_sector</span>(<span class="ruby-identifier">track_no</span>,<span class="ruby-identifier">sector_no</span>,<span class="ruby-identifier">sector_contents</span>)
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">"invalid track number #{track_no}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@sectors_in_track</span>[<span class="ruby-identifier">track_no</span>].<span class="ruby-identifier">nil?</span>
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">"invalid sector number #{sector_no}"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">sector_no</span>.<span class="ruby-identifier">between?</span>(<span class="ruby-value">0</span>,<span class="ruby-ivar">@@sectors_in_track</span>[<span class="ruby-identifier">track_no</span>]<span class="ruby-operator">-</span><span class="ruby-value">1</span>)
+ <span class="ruby-identifier">padded_sector_contents</span>=(<span class="ruby-identifier">sector_contents</span><span class="ruby-operator">+</span>(<span class="ruby-value str">"\000"</span><span class="ruby-operator">*</span><span class="ruby-constant">D64_BYTES_PER_SECTOR</span>))[<span class="ruby-value">0</span>,<span class="ruby-constant">D64_BYTES_PER_SECTOR</span>]
<span class="ruby-identifier">start_byte</span>=<span class="ruby-ivar">@@offset_of_track</span>[<span class="ruby-identifier">track_no</span>]<span class="ruby-operator">+</span>(<span class="ruby-constant">D64_BYTES_PER_SECTOR</span><span class="ruby-operator">*</span>(<span class="ruby-identifier">sector_no</span>))
- <span class="ruby-identifier">file_bytes</span>[<span class="ruby-identifier">start_byte</span>,<span class="ruby-constant">D64_BYTES_PER_SECTOR</span>]
+ <span class="ruby-identifier">file_bytes</span>[<span class="ruby-identifier">start_byte</span>,<span class="ruby-constant">D64_BYTES_PER_SECTOR</span>]=<span class="ruby-identifier">padded_sector_contents</span>
<span class="ruby-keyword kw">end</span></pre>
</body>
</html>
\ No newline at end of file