Strip comments and inline ids onto h*

This commit is contained in:
James Gregory 2013-12-30 15:11:04 +11:00
commit 0f5f617adb
362 changed files with 2519 additions and 6694 deletions

View file

@ -10,16 +10,9 @@
<meta name="vspubdate" content="07/01/97" />
<meta name="vscategory" content="Web and Software Development: Game Development,Web and Software Development: Graphics and Multimedia Development" />
<title>Michael Abrash's Graphics Programming Black Book Special Edition: Assume Nothing</title><!-- HEADER -->
<!-- Empty Reference Subhead -->
<!--ISBN=1576101746//-->
<!--TITLE=Michael Abrash's Graphics Programming Black Book Special Edition//-->
<!--AUTHOR=Michael Abrash//-->
<!--PUBLISHER=The Coriolis Group, Inc.//-->
<title>Michael Abrash's Graphics Programming Black Book Special Edition: Assume Nothing</title>
<meta name="chapter" content="03" />
<meta name="pages" content="042-045" />
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
</head>
<body>
@ -37,19 +30,19 @@
<p><br /></p>
<h4 align="left"><a id="Heading5"></a>The Zen Timer Is a Means, Not an End</h4>
<h4 align="left" id="Heading5">The Zen Timer Is a Means, Not an End</h4>
<p>We&rsquo;re going to spend the rest of this chapter seeing what the Zen timer can do, examining how it works, and learning how to use it. I&rsquo;ll be using the Zen timer again and again over the course of this book, so it&rsquo;s essential that you learn what the Zen timer can do and how to use it. On the other hand, it is by no means essential that you understand exactly how the Zen timer works. (Interesting, yes; essential, no.)</p>
<p>In other words, the Zen timer isn&rsquo;t really part of the knowledge we seek; rather, it&rsquo;s one tool with which we&rsquo;ll acquire that knowledge. Consequently, you shouldn&rsquo;t worry if you don&rsquo;t fully grasp the inner workings of the Zen timer. Instead, focus on learning how to <i>use</i> it, and you&rsquo;ll be on the right road.</p>
<h4 align="left"><a id="Heading6"></a>Starting the Zen Timer</h4>
<h4 align="left" id="Heading6">Starting the Zen Timer</h4>
<p><b>ZTimerOn</b> is called at the start of a segment of code to be timed. <b>ZTimerOn</b> saves the context of the calling code, disables interrupts, sets timer 0 of the 8253 to mode 2 (divide-by-N mode), sets the initial timer count to 0, restores the context of the calling code, and returns. (I&rsquo;d like to note that while Intel&rsquo;s documentation for the 8253 seems to indicate that a timer won&rsquo;t reset to 0 until it finishes counting down, in actual practice, timers seem to reset to 0 as soon as they&rsquo;re loaded.)</p>
<p>Two aspects of <b>ZTimerOn</b> are worth discussing further. One point of interest is that <b>ZTimerOn</b> disables interrupts. (<b>ZTimerOff</b> later restores interrupts to the state they were in when <b>ZTimerOn</b> was called.) Were interrupts not disabled by <b>ZTimerOn</b>, keyboard, mouse, timer, and other interrupts could occur during the timing interval, and the time required to service those interrupts would incorrectly and erratically appear to be part of the execution time of the code being measured. As a result, code timed with the Zen timer should not expect any hardware interrupts to occur during the interval between any call to <b>ZTimerOn</b> and the corresponding call to <b>ZTimerOff</b>, and should not enable interrupts during that time.</p>
<h3><a id="Heading7"></a>Time and the PC</h3>
<h3 id="Heading7">Time and the PC</h3>
<p>A second interesting point about <b>ZTimerOn</b> is that it may introduce some small inaccuracy into the system clock time whenever it is called. To understand why this is so, we need to examine the way in which both the 8253 and the PC&rsquo;s system clock (which keeps the current time) work.</p>
@ -59,9 +52,8 @@
<p>Timer 1 is dedicated to providing dynamic RAM refresh, and should not be tampered with lest system crashes result.</p>
<p><a id="Fig1"><!-- </A><A HREF="javascript:displayWindow('images/03-01.jpg',410,243 )"> --><img src="images/03-01.jpg" /><br />
<!-- </A>
<BR><A HREF="javascript:displayWindow('images/03-01.jpg',410,243)"> --><b>Figure 3.1</b></a>&nbsp;&nbsp;<i>The configuration of the 8253 timer chip in the PC.</i></p>
<p><a id="Fig1"><img src="images/03-01.jpg" /><br />
<b>Figure 3.1</b></a>&nbsp;&nbsp;<i>The configuration of the 8253 timer chip in the PC.</i></p>
<p>Finally, timer 0 is used to drive the system clock. As programmed by the BIOS at power-up, every 65,536 (64K) counts, or 54.925 milliseconds, timer 0 generates a rising edge on its output line. (A millisecond is one-thousandth of a second, and is abbreviated ms.) This line is connected to the hardware interrupt 0 (IRQ0) line on the system board, so every 54.925 ms, timer 0 causes hardware interrupt 0 to occur.</p>
@ -92,10 +84,6 @@
<div align="center">
Graphics Programming Black Book &copy; 2001 Michael Abrash
</div><!-- all of the reference materials (books) have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->
<!-- BEGIN SUB FOOTER -->
<!-- END FOOTER -->
</div>
</body>
</html>