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: Goll Tukasa
Country: Costa Rica
Language: English (Spanish)
Genre: Medical
Published (Last): 23 October 2010
Pages: 407
PDF File Size: 19.4 Mb
ePub File Size: 7.87 Mb
ISBN: 940-2-85939-632-3
Downloads: 56280
Price: Free* [*Free Regsitration Required]
Uploader: Kigrel

Every invocation of getc involves pushing a parameter, executing a call to the Blackk library function, getting the parameter in the C library codelooking up information about the desired stream, unbuffering the next byte from the stream, and returning to the calling code. A long-period Zen timer for use in such cases will be presented later in this chapter. Yes, it’s still worth a read, the assembly parts have become somewhat historic but it’s a nice explanation of the “way of thinking” that’s still valid today if you need to optimise in assembly of course, targeting it for the modern archs.

Feature articles, editorials, even advertisements held information for me to assimilate. Gook the ratios on the vertical axis of Table 1. Recall that every access to a memory byte takes at least 4 cycles; that limitation is built right into the As for restartable blocks: The Zen timer is not perfect. The long-period Zen timer so named by contrast with the precision Zen timer just presented shown in Listing 3.

It can multiply any register used as an index. Use it sparingly and only within the framework of a good design—but ignore it and you may find various portions of your anatomy out in the cold. Barash chapter focuses almost entirely on the first popular xfamily processor, the Does anybody have a mirror?

Understand where the time really goes when your code runs. This was referenced in a HN article that I read in the past day. In fact, the result indicates that DRAM refresh is stealing not 4, but 5.

There Ain’t No Such Thing as the Fastest Code

That signal goes to channel 0 of the DMA controller, which requests the bus from the upon receiving the signal. 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. Reduced instruction fetching lowers minimum execution time minimum execution time is 4 cycles times the number of instruction bytes and often leads to faster overall execution.

His Graphics Programming Black Book is similarly great, and covers topics so general and wide ranging that the title becomes a bit of a misnomer. It will never be outdated thanks to all the happy memories it holds for me. A bit of background: Dynamic RAM refresh and wait states—our next topics—together form the lowest level at which the hardware of the PC affects code performance. Please read our commenting policy. String instructions can suffer from the 8-bit bus cycle-eater to a greater extent than other instructions.


Write a customer review. Some people operate under a rule of thumb by which they assume that the execution time of each instruction is 4 cycles times the number of bytes in the instruction.

What have we arash Everything happened so fast, and under so much pressure, that sometimes I wonder how any of us made it through that without completely burning out. Less time is required to fetch instructions that are 1 or 2 bytes long than instructions that are 5 or 6 bytes long.

His results are as follows: For implementation reasons, the long-period Zen timer is also incapable of timing code that starts before midnight and ends after midnight; if that eventuality occurs, the long-period Zen timer reports that it blac, unable to time the code because midnight was crossed. Likewise, high-performance programming requires a clear understanding of the purpose blac the software being built, an overall program design, vlack for implementing particular tasks, an understanding of what the computer can do and of what all relevant software blacck doing— and solid programming skills, preferably using an optimizing compiler or assembly language.

In my experience, this approach works beautifully with fully compatible chips. If you like books and love to build cool products, we may be looking for you. While it is true that good assembly code is better than good compiled code, it is also true that bad assembly code is often much worse than bad compiled code; since the assembly programmer has so much control over the program, he or she has virtually unlimited opportunities to waste cycles and bytes.

To make the process of translating C code to assembly language worth the trouble, you must ignore what the compiler does and design your assembly language code from a pure assembly language perspective. As a result, you should follow the rules of thumb described here—and then time your code to see how fast it really is.

For example, consider Listing 4. Clearly, then, the prefetch queue cycle-eater is nothing more than one aspect of the 8-bit bus cycle-eater.

In order to explain why that is true and how it relates to the 8-bit bus cycle-eater, I must diverge for a moment. By the same token, however, this will be one of the most important and rewarding chapters in this book. The x86 family CPUs have a complex, irregular instruction set, and, unlike most processors, they are neither straightforward nor well-documented true code performance.


What we really want is to know how long useful working code takes to run, not how long a single instruction takes, and the Zen timer gives us the tool we need to gather that information.

Thanks for telling us about the problem. Just why is Listing 1.

Nook underestimate the importance of the flexible mind. Otherwise, ZTimerReport subtracts the reference count representing the sbrash of the Zen timer from the count measured between the calls to ZTimerOn and ZTimerOffconverts the result from timer counts to microseconds, and prints the resulting time in microseconds to the standard output.

On top of the three-times speedup over the original C code that I had already realized, we’re almost up to an order of magnitude faster. Nor is there any way to structure code to minimize the impact of DRAM refresh.

While that topic covers a lot of ground—display adapters, keyboards, serial ports, printer ports, timer and DMA channels, memory organization, and more—most of the hardware is well-documented, and articles about programming major nook components appear frequently in the literature, so this sort of knowledge can be acquired readily enough.

This book is a monster brick of over pages with 70 chapters!

Graphics Programming Black Book | Dr Dobb’s

Timer 1 is dedicated to providing dynamic RAM refresh, and should not be tampered with lest system crashes result. You’re going to click through anyway and read some of it. In fact, search time is probably a good deal less than 20 percent of the total, given that the overhead of loading the program, running through the C startup code, opening the file, executing printfand exiting the program and returning to the DOS shell are also included in my timings.

That takes a considerable amount of time, especially by contrast with simply maintaining a pointer to a buffer and whizzing through the data in the buffer inside a single loop. The gist of all this is simply that good assembly programming is done in the context of a solid overall framework unique to each program, and the flexible mind is the key to creating that framework and holding it together.