Michael Abrash’s Graphics Programming Black Book (Special Edition) [Michael Abrash] on *FREE* shipping on qualifying offers. No one has done . Graphics Programming Black Book Special Edition has 65 ratings and 3 reviews. — Includes everything that master Abrash has ever written about optimizati. Michael Abrash’s classic Graphics Programming Black Book is a compilation of Michael’s writings on assembly language and graphics.

Author: Samurisar Moogut
Country: Greece
Language: English (Spanish)
Genre: Career
Published (Last): 2 August 2011
Pages: 395
PDF File Size: 15.89 Mb
ePub File Size: 16.1 Mb
ISBN: 253-8-34205-181-9
Downloads: 28275
Price: Free* [*Free Regsitration Required]
Uploader: Meztishakar

You can find these in the latter part of this book; they represent a rare look into the development and inner workings of leading-edge software development, and I hope you enjoy reading them as much as I enjoyed developing the technology and writing about it. Always consider the alternatives; a bit of clever thinking and program redesign can go a long way. The key difference between the long-period Zen timer and the precision Zen timer is that the long-period timer leaves interrupts enabled during the timing period.

The easy, familiar approach often has nothing in its favor except that it requires less thinking; not a great virtue when writing high-performance code—or when moving. Similarly, the state in which a given instruction leaves the prefetch queue affects the overall execution time of the following instructions. Examine it, question it, and improve upon it, for an inquisitive, skeptical mind is an important part of the Zen of assembly optimization.

Thanks to DRAM refresh, variations of up to 8. Otherwise, we may read the timer count just before it turns over and generates an interrupt, then read the BIOS time-of-day count just after the interrupt has occurred and caused the time-of-day count to turn over, with a resulting 54 ms measurement inaccuracy.

Although more than a little dated these days. I still remember the video 7 story at the beginning of one of the chapters.


In all seriousness, this book has been my bible for software engineering efficiency and graphics programming. When that time comes, however, optimization can indeed make a significant difference. If I’m starting now, why wouldn’t I want to target it?

The Zen timer subroutines are designed to be near-called from assembly language code running in the public segment Code.

Just like blakc college, the class topic doesn’t matter when the instructor is a brilliant teacher. One effective technique is to minimize access to memory operands, since such accesses compete with instruction fetching for precious memory accesses. By the way, the execution times even of Listings 1. Assuming that Listing 3. Are we talking about two different forms of SHR here?

Michael Abrash’s Graphics Programming Black Book Special Edition: Table of Contents

Suddenly, the answer struck me—the code was rotating each bit into place separately, so that a multibit rotation was being performed every time through the loop, for a total of four separate time-consuming multibit rotations!

This is particularly true given that the x86 family in real and bit protected mode, with its blaci memory-addressing instructions and segmented memory architecture, does not lend itself particularly well to compiler design. This moved the costly multibit rotation out of the loop so that it was performed just once, rather than four times.

In my experience, this approach works beautifully with abrasb compatible chips. Going by Listing 4. Renting a truck the restartable block approach would have required more effort and forethought, but would have paid off handsomely. You must also learn to look at your programming problems from a abbrash of perspectives so that you can put those fast instructions to work in the most effective ways.

His complete works are contained in this massive volume, including bopk he has written about performance coding and real-time graphics.

The third reason is often fallacious. If not handled properly, the transformation that takes place between conception and implementation can reduce performance tremendously; for example, a programmer who implements a routine to search a list ofsorted items with a linear rather than binary search will end up with a disappointingly slow program.


There Ain’t No Such Thing as the Fastest Code

And so we see that the best idea in the world can fail for lack of either proper design or adequate horsepower. The hack was that he started an fpu divide and then got useful work done on the integer pipeline without a stall, perfectly timing out when the fpu would have his value ready.

Boyer-Moore String Searching 2. While short instructions minimize overall prefetch time, ironically they actually often suffer more from the prefetch queue bottleneck than do long instructions.

Michael Abrash’s Graphics Programming Black Book, Special Edition

Programming is not a zero-sum game. English Choose a language for shopping. The full list of values that LEA can multiply a register by on a or is: The only way boack avoid this problem is to stop timer 0, read both the timer and time-of-day counts while the timer is stopped, and then restart the timer.

We need the interrupt generated by the abeash of timer 0 to tell us when the count has overflowed, and we will see shortly that the timer interrupt also makes it possible to time much longer periods than the Zen timer shown in Listing 3. One point of interest is that ZTimerOn disables interrupts. After all, the whole point of drawing graphics is to convey visual information, and if that information can be presented faster than the eye can see, that is by definition fast enough.