From a9626d4001dfb0afa998b6c566abc443eb0751a1 Mon Sep 17 00:00:00 2001 From: James Gregory Date: Mon, 30 Dec 2013 20:43:14 +1100 Subject: [PATCH] Add metadata to each page --- 01-01.md | 12 ++++++++++++ 01-02.md | 12 ++++++++++++ 01-03.md | 12 ++++++++++++ 01-04.md | 12 ++++++++++++ 01-05.md | 12 ++++++++++++ 01-06.md | 12 ++++++++++++ 02-01.md | 12 ++++++++++++ 02-02.md | 12 ++++++++++++ 02-03.md | 12 ++++++++++++ 03-01.md | 12 ++++++++++++ 03-02.md | 12 ++++++++++++ 03-03.md | 12 ++++++++++++ 03-04.md | 12 ++++++++++++ 03-05.md | 12 ++++++++++++ 03-06.md | 12 ++++++++++++ 03-07.md | 12 ++++++++++++ 03-08.md | 12 ++++++++++++ 03-09.md | 12 ++++++++++++ 03-10.md | 12 ++++++++++++ 04-01.md | 12 ++++++++++++ 04-02.md | 12 ++++++++++++ 04-03.md | 12 ++++++++++++ 04-04.md | 12 ++++++++++++ 04-05.md | 12 ++++++++++++ 04-06.md | 12 ++++++++++++ 04-07.md | 12 ++++++++++++ 04-08.md | 12 ++++++++++++ 04-09.md | 12 ++++++++++++ 04-10.md | 12 ++++++++++++ 05-01.md | 12 ++++++++++++ 05-02.md | 12 ++++++++++++ 05-03.md | 12 ++++++++++++ 05-04.md | 12 ++++++++++++ 05-05.md | 12 ++++++++++++ 06-01.md | 12 ++++++++++++ 06-02.md | 12 ++++++++++++ 07-01.md | 12 ++++++++++++ 07-02.md | 12 ++++++++++++ 07-03.md | 12 ++++++++++++ 07-04.md | 12 ++++++++++++ 07-05.md | 12 ++++++++++++ 08-01.md | 12 ++++++++++++ 08-02.md | 12 ++++++++++++ 08-03.md | 12 ++++++++++++ 08-04.md | 12 ++++++++++++ 08-05.md | 12 ++++++++++++ 09-01.md | 12 ++++++++++++ 09-02.md | 12 ++++++++++++ 09-03.md | 12 ++++++++++++ 09-04.md | 12 ++++++++++++ 09-05.md | 12 ++++++++++++ 09-06.md | 12 ++++++++++++ 09-07.md | 12 ++++++++++++ 10-01.md | 12 ++++++++++++ 10-02.md | 12 ++++++++++++ 10-03.md | 12 ++++++++++++ 10-04.md | 12 ++++++++++++ 11-01.md | 12 ++++++++++++ 11-02.md | 12 ++++++++++++ 11-03.md | 12 ++++++++++++ 11-04.md | 12 ++++++++++++ 11-05.md | 12 ++++++++++++ 11-06.md | 12 ++++++++++++ 11-07.md | 12 ++++++++++++ 11-08.md | 12 ++++++++++++ 12-01.md | 12 ++++++++++++ 12-02.md | 12 ++++++++++++ 12-03.md | 12 ++++++++++++ 12-04.md | 12 ++++++++++++ 13-01.md | 12 ++++++++++++ 13-02.md | 12 ++++++++++++ 13-03.md | 12 ++++++++++++ 13-04.md | 12 ++++++++++++ 14-01.md | 12 ++++++++++++ 14-02.md | 12 ++++++++++++ 14-03.md | 12 ++++++++++++ 14-04.md | 12 ++++++++++++ 14-05.md | 12 ++++++++++++ 14-06.md | 12 ++++++++++++ 15-01.md | 12 ++++++++++++ 15-02.md | 12 ++++++++++++ 15-03.md | 12 ++++++++++++ 15-04.md | 12 ++++++++++++ 16-01.md | 12 ++++++++++++ 16-02.md | 12 ++++++++++++ 16-03.md | 12 ++++++++++++ 16-04.md | 12 ++++++++++++ 16-05.md | 12 ++++++++++++ 16-06.md | 12 ++++++++++++ 16-07.md | 12 ++++++++++++ 16-08.md | 12 ++++++++++++ 17-01.md | 12 ++++++++++++ 17-02.md | 12 ++++++++++++ 17-03.md | 12 ++++++++++++ 17-04.md | 12 ++++++++++++ 17-05.md | 12 ++++++++++++ 17-06.md | 12 ++++++++++++ 17-07.md | 12 ++++++++++++ 17-08.md | 12 ++++++++++++ 18-01.md | 12 ++++++++++++ 18-02.md | 12 ++++++++++++ 18-03.md | 12 ++++++++++++ 18-04.md | 12 ++++++++++++ 18-05.md | 12 ++++++++++++ 19-01.md | 12 ++++++++++++ 19-02.md | 12 ++++++++++++ 19-03.md | 12 ++++++++++++ 19-04.md | 12 ++++++++++++ 20-01.md | 12 ++++++++++++ 20-02.md | 12 ++++++++++++ 20-03.md | 12 ++++++++++++ 20-04.md | 12 ++++++++++++ 21-01.md | 12 ++++++++++++ 21-02.md | 12 ++++++++++++ 21-03.md | 12 ++++++++++++ 21-04.md | 12 ++++++++++++ 21-05.md | 12 ++++++++++++ 22-01.md | 12 ++++++++++++ 22-02.md | 12 ++++++++++++ 22-03.md | 12 ++++++++++++ 23-01.md | 12 ++++++++++++ 23-02.md | 12 ++++++++++++ 23-03.md | 12 ++++++++++++ 23-04.md | 12 ++++++++++++ 23-05.md | 12 ++++++++++++ 23-06.md | 12 ++++++++++++ 24-01.md | 12 ++++++++++++ 24-02.md | 12 ++++++++++++ 24-03.md | 12 ++++++++++++ 25-01.md | 12 ++++++++++++ 25-02.md | 12 ++++++++++++ 25-03.md | 12 ++++++++++++ 25-04.md | 12 ++++++++++++ 25-05.md | 12 ++++++++++++ 25-06.md | 12 ++++++++++++ 26-01.md | 12 ++++++++++++ 26-02.md | 12 ++++++++++++ 26-03.md | 12 ++++++++++++ 27-01.md | 12 ++++++++++++ 27-02.md | 12 ++++++++++++ 27-03.md | 12 ++++++++++++ 27-04.md | 12 ++++++++++++ 27-05.md | 12 ++++++++++++ 28-01.md | 12 ++++++++++++ 28-02.md | 12 ++++++++++++ 28-03.md | 12 ++++++++++++ 28-04.md | 12 ++++++++++++ 28-05.md | 12 ++++++++++++ 29-01.md | 12 ++++++++++++ 29-02.md | 12 ++++++++++++ 29-03.md | 12 ++++++++++++ 29-04.md | 12 ++++++++++++ 29-05.md | 12 ++++++++++++ 29-06.md | 12 ++++++++++++ 30-01.md | 12 ++++++++++++ 30-02.md | 12 ++++++++++++ 30-03.md | 12 ++++++++++++ 30-04.md | 12 ++++++++++++ 30-05.md | 12 ++++++++++++ 30-06.md | 12 ++++++++++++ 30-07.md | 12 ++++++++++++ 31-01.md | 12 ++++++++++++ 31-02.md | 12 ++++++++++++ 31-03.md | 12 ++++++++++++ 31-04.md | 12 ++++++++++++ 31-05.md | 12 ++++++++++++ 32-01.md | 12 ++++++++++++ 32-02.md | 12 ++++++++++++ 32-03.md | 12 ++++++++++++ 32-04.md | 12 ++++++++++++ 32-05.md | 12 ++++++++++++ 33-01.md | 12 ++++++++++++ 33-02.md | 12 ++++++++++++ 33-03.md | 12 ++++++++++++ 33-04.md | 12 ++++++++++++ 34-01.md | 12 ++++++++++++ 34-02.md | 12 ++++++++++++ 34-03.md | 12 ++++++++++++ 34-04.md | 12 ++++++++++++ 34-05.md | 12 ++++++++++++ 35-01.md | 12 ++++++++++++ 35-02.md | 12 ++++++++++++ 35-03.md | 12 ++++++++++++ 35-04.md | 12 ++++++++++++ 35-05.md | 12 ++++++++++++ 35-06.md | 12 ++++++++++++ 35-07.md | 12 ++++++++++++ 36-01.md | 12 ++++++++++++ 36-02.md | 12 ++++++++++++ 36-03.md | 12 ++++++++++++ 36-04.md | 12 ++++++++++++ 37-01.md | 12 ++++++++++++ 37-02.md | 12 ++++++++++++ 38-01.md | 12 ++++++++++++ 38-02.md | 12 ++++++++++++ 38-03.md | 12 ++++++++++++ 38-04.md | 12 ++++++++++++ 39-01.md | 12 ++++++++++++ 39-02.md | 12 ++++++++++++ 39-03.md | 12 ++++++++++++ 39-04.md | 12 ++++++++++++ 39-05.md | 12 ++++++++++++ 40-01.md | 12 ++++++++++++ 40-02.md | 12 ++++++++++++ 40-03.md | 12 ++++++++++++ 40-04.md | 12 ++++++++++++ 40-05.md | 12 ++++++++++++ 41-01.md | 12 ++++++++++++ 41-02.md | 12 ++++++++++++ 41-03.md | 12 ++++++++++++ 41-04.md | 12 ++++++++++++ 42-01.md | 12 ++++++++++++ 42-02.md | 12 ++++++++++++ 42-03.md | 12 ++++++++++++ 42-04.md | 12 ++++++++++++ 42-05.md | 12 ++++++++++++ 43-01.md | 12 ++++++++++++ 43-02.md | 12 ++++++++++++ 43-03.md | 12 ++++++++++++ 43-04.md | 12 ++++++++++++ 43-05.md | 12 ++++++++++++ 43-06.md | 12 ++++++++++++ 44-01.md | 12 ++++++++++++ 44-02.md | 12 ++++++++++++ 44-03.md | 12 ++++++++++++ 44-04.md | 12 ++++++++++++ 44-05.md | 12 ++++++++++++ 44-06.md | 12 ++++++++++++ 45-01.md | 12 ++++++++++++ 45-02.md | 12 ++++++++++++ 45-03.md | 12 ++++++++++++ 45-04.md | 12 ++++++++++++ 45-05.md | 12 ++++++++++++ 45-06.md | 12 ++++++++++++ 46-01.md | 12 ++++++++++++ 46-02.md | 12 ++++++++++++ 46-03.md | 12 ++++++++++++ 47-01.md | 12 ++++++++++++ 47-02.md | 12 ++++++++++++ 47-03.md | 12 ++++++++++++ 47-04.md | 12 ++++++++++++ 47-05.md | 12 ++++++++++++ 47-06.md | 12 ++++++++++++ 47-07.md | 12 ++++++++++++ 48-01.md | 12 ++++++++++++ 48-02.md | 12 ++++++++++++ 48-03.md | 12 ++++++++++++ 48-04.md | 12 ++++++++++++ 48-05.md | 12 ++++++++++++ 49-01.md | 12 ++++++++++++ 49-02.md | 12 ++++++++++++ 49-03.md | 12 ++++++++++++ 49-04.md | 12 ++++++++++++ 49-05.md | 12 ++++++++++++ 50-01.md | 12 ++++++++++++ 50-02.md | 12 ++++++++++++ 50-03.md | 12 ++++++++++++ 50-04.md | 12 ++++++++++++ 50-05.md | 12 ++++++++++++ 50-06.md | 12 ++++++++++++ 50-07.md | 12 ++++++++++++ 51-01.md | 12 ++++++++++++ 51-02.md | 12 ++++++++++++ 51-03.md | 12 ++++++++++++ 51-04.md | 12 ++++++++++++ 51-05.md | 12 ++++++++++++ 51-06.md | 12 ++++++++++++ 52-01.md | 12 ++++++++++++ 52-02.md | 12 ++++++++++++ 52-03.md | 12 ++++++++++++ 52-04.md | 12 ++++++++++++ 52-05.md | 12 ++++++++++++ 52-06.md | 12 ++++++++++++ 52-07.md | 12 ++++++++++++ 52-08.md | 12 ++++++++++++ 53-01.md | 12 ++++++++++++ 53-02.md | 12 ++++++++++++ 53-03.md | 12 ++++++++++++ 53-04.md | 12 ++++++++++++ 54-01.md | 12 ++++++++++++ 54-02.md | 12 ++++++++++++ 54-03.md | 12 ++++++++++++ 54-04.md | 12 ++++++++++++ 54-05.md | 12 ++++++++++++ 55-01.md | 12 ++++++++++++ 55-02.md | 12 ++++++++++++ 55-03.md | 12 ++++++++++++ 55-04.md | 12 ++++++++++++ 56-01.md | 12 ++++++++++++ 56-02.md | 12 ++++++++++++ 56-03.md | 12 ++++++++++++ 57-01.md | 12 ++++++++++++ 57-02.md | 12 ++++++++++++ 57-03.md | 12 ++++++++++++ 57-04.md | 12 ++++++++++++ 58-01.md | 12 ++++++++++++ 58-02.md | 12 ++++++++++++ 58-03.md | 12 ++++++++++++ 58-04.md | 12 ++++++++++++ 58-05.md | 12 ++++++++++++ 59-01.md | 12 ++++++++++++ 59-02.md | 12 ++++++++++++ 59-03.md | 12 ++++++++++++ 59-04.md | 12 ++++++++++++ 59-05.md | 12 ++++++++++++ 59-06.md | 12 ++++++++++++ 60-01.md | 12 ++++++++++++ 60-02.md | 12 ++++++++++++ 60-03.md | 12 ++++++++++++ 60-04.md | 12 ++++++++++++ 61-01.md | 12 ++++++++++++ 61-02.md | 12 ++++++++++++ 61-03.md | 12 ++++++++++++ 61-04.md | 12 ++++++++++++ 62-01.md | 12 ++++++++++++ 62-02.md | 12 ++++++++++++ 62-03.md | 12 ++++++++++++ 62-04.md | 12 ++++++++++++ 63-01.md | 12 ++++++++++++ 63-02.md | 12 ++++++++++++ 63-03.md | 12 ++++++++++++ 63-04.md | 12 ++++++++++++ 64-01.md | 12 ++++++++++++ 64-02.md | 12 ++++++++++++ 64-03.md | 12 ++++++++++++ 64-04.md | 12 ++++++++++++ 65-01.md | 12 ++++++++++++ 65-02.md | 12 ++++++++++++ 65-03.md | 12 ++++++++++++ 65-04.md | 12 ++++++++++++ 66-01.md | 12 ++++++++++++ 66-02.md | 12 ++++++++++++ 66-03.md | 12 ++++++++++++ 66-04.md | 12 ++++++++++++ 67-01.md | 12 ++++++++++++ 67-02.md | 12 ++++++++++++ 67-03.md | 12 ++++++++++++ 67-04.md | 12 ++++++++++++ 67-05.md | 12 ++++++++++++ 68-01.md | 12 ++++++++++++ 68-02.md | 12 ++++++++++++ 68-03.md | 12 ++++++++++++ 68-04.md | 12 ++++++++++++ 69-01.md | 12 ++++++++++++ 69-02.md | 12 ++++++++++++ 69-03.md | 12 ++++++++++++ 69-04.md | 12 ++++++++++++ 70-01.md | 12 ++++++++++++ 70-02.md | 12 ++++++++++++ 70-03.md | 12 ++++++++++++ 70-04.md | 12 ++++++++++++ 70-05.md | 12 ++++++++++++ 70-06.md | 12 ++++++++++++ 70-07.md | 12 ++++++++++++ 70-08.md | 12 ++++++++++++ 70-09.md | 12 ++++++++++++ about.md | 10 ++++++++++ about_author.md | 10 ++++++++++ appendix-a.md | 10 ++++++++++ book-index.md | 10 ++++++++++ index.md | 12 ++++++++++++ intro.md | 10 ++++++++++ 362 files changed, 4334 insertions(+) diff --git a/01-01.md b/01-01.md index 9a3b828..7a6f2b1 100644 --- a/01-01.md +++ b/01-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '01' +pages: 004-007 +--- + *Part I* {align="center"} -------- diff --git a/01-02.md b/01-02.md index b8e997f..2e58a67 100644 --- a/01-02.md +++ b/01-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '01' +pages: 007-009 +--- + ### Rules for Building High-Performance Code {#Heading5} We've got the following rules for creating high-performance software: diff --git a/01-03.md b/01-03.md index db0be1f..cf094e5 100644 --- a/01-03.md +++ b/01-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '01' +pages: 010-013 +--- + * * * * * Listing diff --git a/01-04.md b/01-04.md index c0ebe65..21d789d 100644 --- a/01-04.md +++ b/01-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '01' +pages: 013-015 +--- + ------------------- -------------------------------------------------------------------------------------------------------------------------------------------------- ![](images/i.jpg) *Make sure you understand what really goes on when you insert a seemingly-innocuous function call into the time-critical portions of your code.* ------------------- -------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/01-05.md b/01-05.md index f8a3400..ff96d3d 100644 --- a/01-05.md +++ b/01-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '01' +pages: 015-017 +--- + The third reason is often fallacious. C library functions are not always written in assembly, nor are they always particularly well-optimized. (In fact, they're often written for *portability*, which has nothing to diff --git a/01-06.md b/01-06.md index 3caa72c..28c7c6b 100644 --- a/01-06.md +++ b/01-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '01' +pages: 018-019 +--- + **LISTING 1.7 L1-7.ASM** ; Assembler subroutine to perform a 16-bit checksum on a block of diff --git a/02-01.md b/02-01.md index e3c3999..4061918 100644 --- a/02-01.md +++ b/02-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '02' +pages: 021-025 +--- + Chapter 2\ A World Apart {#Heading1} -------------- diff --git a/02-02.md b/02-02.md index d9b1d50..41cf197 100644 --- a/02-02.md +++ b/02-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '02' +pages: 025-028 +--- + #### Transformation Inefficiencies {#Heading5} No matter how well an implementation is derived from the corresponding diff --git a/02-03.md b/02-03.md index 61fa243..a9165e7 100644 --- a/02-03.md +++ b/02-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '02' +pages: 028-030 +--- + ### The Flexible Mind {#Heading8} Is the never-ending collection of information all there is to the diff --git a/03-01.md b/03-01.md index 5fc76d1..841334c 100644 --- a/03-01.md +++ b/03-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '03' +pages: 031-035 +--- + Chapter 3\ Assume Nothing {#Heading1} --------------- diff --git a/03-02.md b/03-02.md index c066f87..7083243 100644 --- a/03-02.md +++ b/03-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '03' +pages: 035-042 +--- + **LISTING 3.1 PZTIMER.ASM** ; The precision Zen timer (PZTIMER.ASM) diff --git a/03-03.md b/03-03.md index 255e90f..b74e127 100644 --- a/03-03.md +++ b/03-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '03' +pages: 042-045 +--- + #### The Zen Timer Is a Means, Not an End {#Heading5} We're going to spend the rest of this chapter seeing what the Zen timer diff --git a/03-04.md b/03-04.md index d3f3085..f77fca3 100644 --- a/03-04.md +++ b/03-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '03' +pages: 045-048 +--- + In fact, the Zen timer shown in Listing 3.1 can only time intervals of up to about 54 ms in length, since that is the period of time that can be measured by timer 0 before its count turns over and repeats. diff --git a/03-05.md b/03-05.md index 05bc2e7..f6085b5 100644 --- a/03-05.md +++ b/03-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '03' +pages: 048-050 +--- + ### Notes on the Zen Timer {#Heading10} The Zen timer subroutines are designed to be near-called from assembly diff --git a/03-06.md b/03-06.md index 84f71ea..db70d86 100644 --- a/03-06.md +++ b/03-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '03' +pages: 051-053 +--- + Listing 3.3 is used by naming it TESTCODE, assembling both Listing 3.2 (which includes TESTCODE) and Listing 3.1 with TASM or MASM, and linking the two resulting OBJ files together by way of the Borland orMicrosoft diff --git a/03-07.md b/03-07.md index b8c05e0..a9682f7 100644 --- a/03-07.md +++ b/03-07.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '03' +pages: 053-065 +--- + While permitting the timer interrupt to occur allows long intervals to be timed, that same interrupt makes the long-period Zen timer less accurate than the precision Zen timer, since the time the BIOS spends diff --git a/03-08.md b/03-08.md index c1c6dfd..52912cf 100644 --- a/03-08.md +++ b/03-08.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '03' +pages: 065-067 +--- + Moreover, because it uses an undocumented feature, the timer-stop approach could conceivably cause erratic 8253 operation, which could in turn seriously affect your computer's operation until the next reboot. diff --git a/03-09.md b/03-09.md index d625905..7d9f889 100644 --- a/03-09.md +++ b/03-09.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '03' +pages: 067-070 +--- + **LISTING 3.7 LZTIME.BAT** echo off diff --git a/03-10.md b/03-10.md index d8e9239..c71b192 100644 --- a/03-10.md +++ b/03-10.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '03' +pages: 070-073 +--- + when declaring the timer routines **extern**, so that name-mangling doesn't occur, and the linker can find the routines' C-style names.) diff --git a/04-01.md b/04-01.md index c89dd5d..0ce7db1 100644 --- a/04-01.md +++ b/04-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '04' +pages: 075-080 +--- + Chapter 4\ In the Lair of the Cycle-Eaters {#Heading1} -------------------------------- diff --git a/04-02.md b/04-02.md index c9e7f71..e46f783 100644 --- a/04-02.md +++ b/04-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '04' +pages: 080-084 +--- + ![](images/04-01.jpg)\ **Figure 4.1**  *The location of the major cycle-eaters in the IBM PC.* diff --git a/04-03.md b/04-03.md index ce481d7..b038832 100644 --- a/04-03.md +++ b/04-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '04' +pages: 084-087 +--- + Back to the 8-bit bus cycle-eater. As I've said, in 8088 work you should strive to use byte-sized memory variables whenever possible. That does *not* mean that you should use 2 byte-sized memory accesses to diff --git a/04-04.md b/04-04.md index bafb029..7044560 100644 --- a/04-04.md +++ b/04-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '04' +pages: 087-090 +--- + #### Official Execution Times Are Only Part of the Story {#Heading10} The sequence of 5 **SHR** instructions in the last example is 10 bytes diff --git a/04-05.md b/04-05.md index 7e5c0db..e5787b8 100644 --- a/04-05.md +++ b/04-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '04' +pages: 090-093 +--- + Clearly, either instruction fetch time *or* Execution Unit execution time—or even a mix of the two, if an instruction is partially prefetched—can determine code performance. Some people operate under a diff --git a/04-06.md b/04-06.md index 9330ed9..9f84aac 100644 --- a/04-06.md +++ b/04-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '04' +pages: 094-097 +--- + More than anything, the above rules mean using the registers as heavily as possible, both because register-only instructions are short and because they don't perform memory accesses to read or write operands. diff --git a/04-07.md b/04-07.md index 7c42d95..cc6b28b 100644 --- a/04-07.md +++ b/04-07.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '04' +pages: 097-099 +--- + #### The Impact of DRAM Refresh {#Heading17} Let's look at examples from opposite ends of the spectrum in terms of diff --git a/04-08.md b/04-08.md index 1516a70..8989d29 100644 --- a/04-08.md +++ b/04-08.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '04' +pages: 099-104 +--- + Wait states exist because the CPU must to be able to coexist with any adapter, no matter how slow (within reason). The 8088 expects to be able to complete each bus access—a memory or I/O read or write—in 4 cycles, diff --git a/04-09.md b/04-09.md index 980dd88..6127b88 100644 --- a/04-09.md +++ b/04-09.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '4' +pages: 104-106 +--- + The answer varies considerably depending on what display adapter and what display mode we're talking about. The display adapter cycle-eater is worst with the Enhanced Graphics Adapter (EGA) and the original Video diff --git a/04-10.md b/04-10.md index 7eb35ef..3128d55 100644 --- a/04-10.md +++ b/04-10.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '04' +pages: 106-109 +--- + ------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ![](images/i.jpg) *A line-drawing subroutine, which executes perhaps a dozen instructions for each display memory access, generally loses less performance to the display adapter cycle-eater than does a block-copy or scrolling subroutine that uses **REP MOVS** instructions. Scaled and three-dimensional graphics, which spend a great deal of time performing calculations (often using very slow floating-point arithmetic), tend to suffer less.* ------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/05-01.md b/05-01.md index c688d13..40ec73c 100644 --- a/05-01.md +++ b/05-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '05' +pages: 111-115 +--- + Chapter 5\ Crossing the Border {#Heading1} -------------------- diff --git a/05-02.md b/05-02.md index 32cb5ab..da23f08 100644 --- a/05-02.md +++ b/05-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '05' +pages: 115-118 +--- + We could put a zero byte at the end of our buffer to allow **strstr()** to work, but why bother? The **strstr()** function must spend time either checking for the end of the string being searched or determining diff --git a/05-03.md b/05-03.md index 3c82564..45f46d8 100644 --- a/05-03.md +++ b/05-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '05' +pages: 118-121 +--- + **LISTING 5.1 SEARCH.C** /* Program to search the file specified by the first command-line diff --git a/05-04.md b/05-04.md index 61eb852..201d248 100644 --- a/05-04.md +++ b/05-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '05' +pages: 121-122 +--- + ### Interpreting Where the Cycles Go {#Heading8} To boost the overall performance of Listing 5.1, I would normally diff --git a/05-05.md b/05-05.md index 43d188c..cfda90b 100644 --- a/05-05.md +++ b/05-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '05' +pages: 122-123 +--- + It might also be worth converting the search engine to assembly for searches performed entirely in memory; with the overhead of file access eliminated, improvements in search-engine performance would translate diff --git a/06-01.md b/06-01.md index 7ae487b..f75abf1 100644 --- a/06-01.md +++ b/06-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '06' +pages: 125-129 +--- + Chapter 6\ Looking Past Face Value {#Heading1} ------------------------ diff --git a/06-02.md b/06-02.md index 4698551..e92a6fb 100644 --- a/06-02.md +++ b/06-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '06' +pages: 129-133 +--- + The two approaches are functionally interchangeable but *not* equivalent from a performance standpoint, and which is better depends on the particular context. If it's a one-shot memory access, it's best to let diff --git a/07-01.md b/07-01.md index fe9cb76..436e02d 100644 --- a/07-01.md +++ b/07-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '07' +pages: 136-139 +--- + Chapter 7\ Local Optimization {#Heading1} ------------------- diff --git a/07-02.md b/07-02.md index 8fc57a6..05d8736 100644 --- a/07-02.md +++ b/07-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '07' +pages: 139-141 +--- + By the way, don't fall victim to the lures of **JCXZ** and do something like this: diff --git a/07-03.md b/07-03.md index 1e0ee93..6115146 100644 --- a/07-03.md +++ b/07-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '07' +pages: 141-143 +--- + **LISTING 7.1 L7-1.ASM** ; Program to illustrate searching through a buffer of a specified diff --git a/07-04.md b/07-04.md index 90c9ad5..7d399a6 100644 --- a/07-04.md +++ b/07-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '07' +pages: 143-145 +--- + **LISTING 7.2 L7-2.ASM** ; Program to illustrate searching through a buffer of a specified diff --git a/07-05.md b/07-05.md index 725e0b7..df828f3 100644 --- a/07-05.md +++ b/07-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '07' +pages: 145-148 +--- + #### Rotating and Shifting with Tables {#Heading8} As another example of local optimization, consider the matter of diff --git a/08-01.md b/08-01.md index 0b7edeb..3f26c8e 100644 --- a/08-01.md +++ b/08-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: 08 +pages: 149-153 +--- + Chapter 8\ Speeding Up C with Assembly Language {#Heading1} ------------------------------------- diff --git a/08-02.md b/08-02.md index c2eddcb..a6b5275 100644 --- a/08-02.md +++ b/08-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: 08 +pages: 153-156 +--- + ### Stack Frames Slow So Much {#Heading5} C compilers work within the stack frame model, whereby variables reside diff --git a/08-03.md b/08-03.md index ae1e1d9..67782b7 100644 --- a/08-03.md +++ b/08-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: 08 +pages: 156-160 +--- + **LISTING 8.1 L8-1.C** /* Program to search an array spanning a linked list of variable- diff --git a/08-04.md b/08-04.md index e11ffd3..3415d25 100644 --- a/08-04.md +++ b/08-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: 08 +pages: 160-163 +--- + It's hard to squeeze much more performance from this code by tweaking it, as exemplified by Listing 8.3, a fine-tuned assembly version of **FindIDAverage** that was produced by looking at the assembly output of diff --git a/08-05.md b/08-05.md index 70f0592..0a13c6e 100644 --- a/08-05.md +++ b/08-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: 08 +pages: 163-166 +--- + Listings 8.5 and 8.6 together go the final step and change the rules in favor of assembly language. Listing 8.5 creates the same list of linked blocks as Listing 8.1. However, instead of storing an array of diff --git a/09-01.md b/09-01.md index 761a0c7..d10928d 100644 --- a/09-01.md +++ b/09-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: 09 +pages: 167-172 +--- + Chapter 9\ Hints My Readers Gave Me {#Heading1} ------------------------- diff --git a/09-02.md b/09-02.md index 5926fe4..7f03935 100644 --- a/09-02.md +++ b/09-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: 09 +pages: 172-175 +--- + However, it generally is. Sure, if the length is odd, John's approach incurs a penalty approximately equal to the **REP** startup time for **MOVSB**. However, if the length is even, John's approach doesn't diff --git a/09-03.md b/09-03.md index 8da9504..16406f5 100644 --- a/09-03.md +++ b/09-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: 09 +pages: 175-178 +--- + Listing 9.1 implements the scan-on-first-character approach. Listing 9.2 scans for whatever character the caller specifies. Listing 9.3 is a test program used to compare the two approaches. How much difference does diff --git a/09-04.md b/09-04.md index 28d6c23..b340e47 100644 --- a/09-04.md +++ b/09-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: 09 +pages: 178-180 +--- + **LISTING 9.2 L9-2.ASM** ; Searches a text buffer for a text string. Uses REPNZ SCASB to scan diff --git a/09-05.md b/09-05.md index 0d263e4..956595c 100644 --- a/09-05.md +++ b/09-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: 09 +pages: 180-182 +--- + You'll notice that in Listing 9.2 I didn't use a table of character frequencies in English text to determine the character for which to scan, but rather let the caller make that choice. Each buffer of bytes diff --git a/09-06.md b/09-06.md index 23fbb6c..a415b1f 100644 --- a/09-06.md +++ b/09-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: 09 +pages: 182-185 +--- + **LISTING 9.5 L9-5.ASM** ; Divides an arbitrarily long unsigned dividend by a 16-bit unsigned diff --git a/09-07.md b/09-07.md index b25637c..5e6c487 100644 --- a/09-07.md +++ b/09-07.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: 09 +pages: 185-188 +--- + #### Hard-Core Cycle Counting {#Heading10} Next, we come to an item that cycle counters will love, especially since diff --git a/10-01.md b/10-01.md index 42363ec..bf8c4af 100644 --- a/10-01.md +++ b/10-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '10' +pages: 190-193 +--- + Chapter 10\ Patient Coding, Faster Code {#Heading1} ---------------------------- diff --git a/10-02.md b/10-02.md index b34879c..b006dd8 100644 --- a/10-02.md +++ b/10-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '10' +pages: 193-196 +--- + Not so nowadays, though. Computers love boring work; they're very patient and disciplined, and, besides, one human year = seven dog years = two zillion computer years. So when we're faced with a problem that diff --git a/10-03.md b/10-03.md index bb4265f..e6acdd2 100644 --- a/10-03.md +++ b/10-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '10' +pages: 196-200 +--- + Listing 10.2 repeatedly subtracts iS from iL until iL becomes less than or equal to iS. If iL becomes equal to iS, then that's the GCD; alternatively, if iL becomes *less* than iS, iL and iS switch values, diff --git a/10-04.md b/10-04.md index 624b0b3..f4bf54c 100644 --- a/10-04.md +++ b/10-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '10' +pages: 200-203 +--- + **LISTING 10.5 L10-5.ASM** ; Finds and returns the greatest common divisor of two integers. diff --git a/11-01.md b/11-01.md index ef1c8c4..3e99973 100644 --- a/11-01.md +++ b/11-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '11' +pages: 205-210 +--- + Chapter 11\ Pushing the 286 and 386 {#Heading1} ------------------------ diff --git a/11-02.md b/11-02.md index ab7015a..9fc4ff2 100644 --- a/11-02.md +++ b/11-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '11' +pages: 210-212 +--- + You might think that the elimination of the 8-bit bus cycle-eater would mean that the prefetch queue cycle-eater would also vanish, since on the 8088 the prefetch queue cycle-eater is a side effect of the 8-bit bus. diff --git a/11-03.md b/11-03.md index 34fde18..fb6ce40 100644 --- a/11-03.md +++ b/11-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '11' +pages: 212-216 +--- + In short, a close relative of our old friend the 8-bit bus cycle-eater—the system memory wait state cycle-eater—haunts us still on all but zero-wait-state 286 and 386 computers, and that means that the diff --git a/11-04.md b/11-04.md index 9edeae8..97f71fe 100644 --- a/11-04.md +++ b/11-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '11' +pages: 216-220 +--- + When I was developing the Zen timer, I used my trusty 10 MHz 286-based AT clone to verify the basic functionality of the timer by measuring the performance of simple instruction sequences. I was cruising along with diff --git a/11-05.md b/11-05.md index 9785862..c0ca2d5 100644 --- a/11-05.md +++ b/11-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '11' +pages: 220-222 +--- + Under ideal conditions, a 286 can access memory much, much faster than an 8088. A 10 MHz 286 is capable of accessing a word of system memory every 0.20 ms with **REP MOVSW**, dwarfing the 1 byte every 1.31 µs that diff --git a/11-06.md b/11-06.md index e7aa966..9585df6 100644 --- a/11-06.md +++ b/11-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '11' +pages: 222-224 +--- + Finally, it's possible in real mode to use the 386's new addressing modes, in which *any* 32-bit general-purpose register or pair of registers can be used to address memory. What's more, multiplication of diff --git a/11-07.md b/11-07.md index 61bfc47..4c0f993 100644 --- a/11-07.md +++ b/11-07.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '11' +pages: 224-226 +--- + **LISTING 11.5 L11-5.ASM** ; diff --git a/11-08.md b/11-08.md index 23075d5..f858d08 100644 --- a/11-08.md +++ b/11-08.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '11' +pages: 226-231 +--- + Well, there's only one instruction other than **POPF** that loads the FLAGS register directly from the stack, and that's **IRET**, which loads the FLAGS register from the stack as it branches, as shown in Figure diff --git a/12-01.md b/12-01.md index 7d076fa..0a1f6d9 100644 --- a/12-01.md +++ b/12-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '12' +pages: 233-237 +--- + Chapter 12\ Pushing the 486 {#Heading1} ---------------- diff --git a/12-02.md b/12-02.md index c075642..29a0eef 100644 --- a/12-02.md +++ b/12-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '12' +pages: 237-241 +--- + which calculates the same sum and leaves the registers in the same state as the first example, but avoids indexed addressing. diff --git a/12-03.md b/12-03.md index 7c77874..d81c632 100644 --- a/12-03.md +++ b/12-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '12' +pages: 241-243 +--- + There is, of course, no guarantee that I'm entirely correct about the optimizations discussed in this chapter. Without knowing the internals of the 486, all I can do is time code and make inferences from the diff --git a/12-04.md b/12-04.md index ad34b8a..0ec3de4 100644 --- a/12-04.md +++ b/12-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '12' +pages: 243-246 +--- + You don't need to understand every corner of the 486 universe unless you're a diehard ASMhead who does this stuff for fun. Just learn enough to be able to speed up the key portions of your programs, and spend the diff --git a/13-01.md b/13-01.md index df051d1..17301fb 100644 --- a/13-01.md +++ b/13-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '13' +pages: 248-251 +--- + Chapter 13\ Aiming the 486 {#Heading1} --------------- diff --git a/13-02.md b/13-02.md index ce0420f..672815b 100644 --- a/13-02.md +++ b/13-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '13' +pages: 252-254 +--- + "When I looked closely as this, I realized that the two cycles for the final **ADD** is just the sum of 1 cycle to load the data from memory, and 1 cycle to add it to DX, so the code could just as well have been diff --git a/13-03.md b/13-03.md index e97f484..101a77c 100644 --- a/13-03.md +++ b/13-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '13' +pages: 254-256 +--- + On the 386, **ROR** was the only way to split a 32-bit register into two 16-bit registers. On the 486, however, **BSWAP** can not only do the job, but can do it better, because **BSWAP** executes in just one cycle. diff --git a/13-04.md b/13-04.md index e17980f..5fa90d9 100644 --- a/13-04.md +++ b/13-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '13' +pages: 256-258 +--- + ### 32-Bit Addressing Modes {#Heading7} The 386 and 486 both support 32-bit addressing modes, in which any diff --git a/14-01.md b/14-01.md index aff6030..c3d1003 100644 --- a/14-01.md +++ b/14-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '14' +pages: 260-263 +--- + Chapter 14\ Boyer-Moore String Searching {#Heading1} ----------------------------- diff --git a/14-02.md b/14-02.md index c918379..91b923f 100644 --- a/14-02.md +++ b/14-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '14' +pages: 263-267 +--- + ### The Boyer-Moore Algorithm {#Heading4} All our *a priori* knowledge of string searching is stated above, but diff --git a/14-03.md b/14-03.md index c7d2efe..e6b2ed4 100644 --- a/14-03.md +++ b/14-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '14' +pages: 267-268 +--- + How fast *is* Boyer-Moore? Listing 14.1 is a C implementation of Boyer-Moore searching; Listing 14.2 is a test-bed program that searches up to the first 32K of a file for a pattern. Table 14.1 (all times diff --git a/14-04.md b/14-04.md index f0ed3ec..93a54fa 100644 --- a/14-04.md +++ b/14-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '14' +pages: 268-271 +--- + **LISTING 14.1 L14-1.C** /* Searches a buffer for a specified pattern. In case of a mismatch, diff --git a/14-05.md b/14-05.md index e984b42..c07bc4f 100644 --- a/14-05.md +++ b/14-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '14' +pages: 271-274 +--- + **LISTING 14.3 L14-3.ASM** ; Searches a buffer for a specified pattern. In case of a mismatch, diff --git a/14-06.md b/14-06.md index a18decb..0cc5491 100644 --- a/14-06.md +++ b/14-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '14' +pages: 274-277 +--- + Table 14.1 represents a limited and decidedly unscientific comparison of searching techniques. Nonetheless, the overall trend is clear: For all but the shortest patterns, well-implemented Boyer-Moore is generally as diff --git a/15-01.md b/15-01.md index 6cb723b..ffa71d3 100644 --- a/15-01.md +++ b/15-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '15' +pages: 279-284 +--- + Chapter 15\ Linked Lists and plain Unintended Challenges {#Heading1} --------------------------------------------- diff --git a/15-02.md b/15-02.md index bbe469d..83d3c22 100644 --- a/15-02.md +++ b/15-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '15' +pages: 284-287 +--- + **LISTING 15.1 L15-1.C** /* Deletes the node in a linked list that follows the indicated node. diff --git a/15-03.md b/15-03.md index 724d447..41cf7bf 100644 --- a/15-03.md +++ b/15-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '15' +pages: 287-290 +--- + **LISTING 15.5 L15-5.C** /* Finds the first node in a value-sorted linked list that diff --git a/15-04.md b/15-04.md index 54f8b48..05b4164 100644 --- a/15-04.md +++ b/15-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '15' +pages: 290-293 +--- + **LISTING 15.7 L15-7.ASM** ; C near-callable assembly function for inserting a new node in a diff --git a/16-01.md b/16-01.md index d1de0c5..5da2594 100644 --- a/16-01.md +++ b/16-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '16' +pages: 295-300 +--- + Chapter 16\ There Ain't No Such Thing as the Fastest Code {#Heading1} ---------------------------------------------- diff --git a/16-02.md b/16-02.md index 97fbde9..9e4d5ca 100644 --- a/16-02.md +++ b/16-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '16' +pages: 300-303 +--- + Listing 16.2 is Listing 16.1 modified to call a function that scans each block for words, and Listing 16.3 contains an assembly function that counts words. Used together, Listings 16.2 and 16.3 are just about twice diff --git a/16-03.md b/16-03.md index c8e3b21..9431d64 100644 --- a/16-03.md +++ b/16-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '16' +pages: 303-305 +--- + **LISTING 16.4 L16-4.ASM** ; Assembly subroutine for Listing 16.2. Scans through Buffer, of diff --git a/16-04.md b/16-04.md index 0b064c7..094c435 100644 --- a/16-04.md +++ b/16-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '16' +pages: 305-308 +--- + Truth to tell, I didn't expect a three-times speedup; around two times was what I had in mind. Which just goes to show that any code can be made faster than you'd expect, if you think about it long enough and diff --git a/16-05.md b/16-05.md index 369b6d7..e0540fa 100644 --- a/16-05.md +++ b/16-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '16' +pages: 308-311 +--- + Table 16.2 has two times for each entry listed: the first value is the overall counting time, including time spent in the main program, disk I/O, and everything else; the second value is the time actually spent diff --git a/16-06.md b/16-06.md index c159224..b430b39 100644 --- a/16-06.md +++ b/16-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '16' +pages: 311-313 +--- + ### Levels of Optimization {#Heading9} Three levels of optimization were evident in the word-counting entries I diff --git a/16-07.md b/16-07.md index 324026f..e57e0fd 100644 --- a/16-07.md +++ b/16-07.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '16' +pages: 313-316 +--- + **Listing 16.6 OPT2.ASM** ; diff --git a/16-08.md b/16-08.md index 8915202..6703298 100644 --- a/16-08.md +++ b/16-08.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '16' +pages: 316-319 +--- + **Listing 16.7 L16-7.ASM** ScanLoop: diff --git a/17-01.md b/17-01.md index 910a389..591e98e 100644 --- a/17-01.md +++ b/17-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '17' +pages: 322-325 +--- + Chapter 17\ The Game of Life {#Heading1} ----------------- diff --git a/17-02.md b/17-02.md index 89d5578..5bf0b9a 100644 --- a/17-02.md +++ b/17-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '17' +pages: 325-329 +--- + **LISTING 17.1 L17-1.CPP** /* C++ Game of Life implementation for any mode for which mode set diff --git a/17-03.md b/17-03.md index cb7a5fe..f7b9106 100644 --- a/17-03.md +++ b/17-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '17' +pages: 329-331 +--- + ### Where Does the Time Go? {#Heading5} How slow is Listing 17.1? Table 17.1 shows that even on a 486, Listing diff --git a/17-04.md b/17-04.md index 60b787a..4d6f49e 100644 --- a/17-04.md +++ b/17-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '17' +pages: 331-334 +--- + There's a kicker here, though, and that's the counting of neighbors for cells at the edge of the cellmap. When cellmap wrapping is enabled (so that the cellmap becomes essentially a toroid, with each edge joined diff --git a/17-05.md b/17-05.md index 47f7ebb..d06ce44 100644 --- a/17-05.md +++ b/17-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '17' +pages: 335-338 +--- + In Listing 17.3, note the padded cellmap edges, and the alteration of the member functions to compensate for the padding. Also note that the width now has to be a multiple of eight, to facilitate the process of diff --git a/17-06.md b/17-06.md index 4f100bb..4d304ee 100644 --- a/17-06.md +++ b/17-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '17' +pages: 338-340 +--- + We're still not ready for assembly, though; what we need is a new perspective that lends itself to vastly better performance in C++. The Life program in the next section is *three to seven times* faster than diff --git a/17-07.md b/17-07.md index 23bb229..2b06bb1 100644 --- a/17-07.md +++ b/17-07.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '17' +pages: 340-345 +--- + **LISTING 17.5 L17-5.CPP** /* C++ Game of Life implementation for any mode for which mode set diff --git a/17-08.md b/17-08.md index 00d6d75..2601af2 100644 --- a/17-08.md +++ b/17-08.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '17' +pages: 345-346 +--- + The large model is actually not necessary for the 96x96 cellmap in Listing 17.5. However, I was actually more interested in seeing a fast 200x200 cellmap, and two 200x200 cellmaps can't fit in a single segment. diff --git a/18-01.md b/18-01.md index f721069..b925aa4 100644 --- a/18-01.md +++ b/18-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '18' +pages: 347-351 +--- + Chapter 18\ It's a plain Wonderful Life {#Heading1} ---------------------------- diff --git a/18-02.md b/18-02.md index cdbd35a..5fcde4e 100644 --- a/18-02.md +++ b/18-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '18' +pages: 351-352 +--- + ### Table-Driven Magic {#Heading4} David Stafford won my first Optimization Challenge by means of a huge diff --git a/18-03.md b/18-03.md index 1c55f63..01e0e10 100644 --- a/18-03.md +++ b/18-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '18' +pages: 352-361 +--- + **LISTING 18.1 BUILD.BAT** bcc -v -D%1=%2;%2=%3;%3=%4;%4=%5;%5=%6;%6=%7;%7=%8;%8 lcomp.c diff --git a/18-04.md b/18-04.md index 5754801..c967740 100644 --- a/18-04.md +++ b/18-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '18' +pages: 361-365 +--- + **LISTING 18.3 MAIN.C** // MAIN.C diff --git a/18-05.md b/18-05.md index baff8e2..369f055 100644 --- a/18-05.md +++ b/18-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '18' +pages: 365-367 +--- + "The basic idea is to maintain a ‘change list.' This is an array of pointers into the cell array. Each change list element points to a word which changes in the next generation. This way we don't have to waste diff --git a/19-01.md b/19-01.md index fee48fb..3949581 100644 --- a/19-01.md +++ b/19-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '19' +pages: 369-373 +--- + Chapter 19\ Pentium: Not the Same Old Song {#Heading1} ------------------------------- diff --git a/19-02.md b/19-02.md index 2a860bc..56c2a6c 100644 --- a/19-02.md +++ b/19-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '19' +pages: 373-375 +--- + ------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ![](images/i.jpg) *The Pentium, on the other hand, has two separate 8K caches, one for code and one for data, so code prefetches can never collide with data fetches; the prefetch queue can stall only when the code being fetched isn't in the internal code cache.* ------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/19-03.md b/19-03.md index dd02da3..98dfbf5 100644 --- a/19-03.md +++ b/19-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '19' +pages: 375-377 +--- + ### Faster Addressing and More {#Heading7} I'll spend the rest of this chapter covering a variety of Pentium diff --git a/19-04.md b/19-04.md index 3e5709b..425e8a1 100644 --- a/19-04.md +++ b/19-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '19' +pages: 377-379 +--- + ### Branch Prediction {#Heading8} One brand-spanking-new feature of the Pentium is *branch prediction*, diff --git a/20-01.md b/20-01.md index b5dfede..4012022 100644 --- a/20-01.md +++ b/20-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '20' +pages: 381-386 +--- + Chapter 20\ Pentium Rules {#Heading1} -------------- diff --git a/20-02.md b/20-02.md index 49aebfd..05d511c 100644 --- a/20-02.md +++ b/20-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '20' +pages: 386-390 +--- + ### V-Pipe-Capable Instructions {#Heading4} Any instruction can go through the U-pipe, and, for practical purposes, diff --git a/20-03.md b/20-03.md index d48f52e..3298ff6 100644 --- a/20-03.md +++ b/20-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '20' +pages: 390-393 +--- + ### Lockstep Execution {#Heading5} You may wonder why anyone would bother breaking **ADD [MemVar],EAX** diff --git a/20-04.md b/20-04.md index 295fa25..f697580 100644 --- a/20-04.md +++ b/20-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '20' +pages: 393-396 +--- + However, this beneficial pairing does not extend to non-**MOV** instructions with explicit memory destination operands, such as **ADD [EBX],EAX**. The Pentium executes only one such memory instruction at a diff --git a/21-01.md b/21-01.md index 840c4ee..bc5d1f7 100644 --- a/21-01.md +++ b/21-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '21' +pages: 397-402 +--- + Chapter 21\ Unleashing the Pentium's V-Pipe {#Heading1} -------------------------------- diff --git a/21-02.md b/21-02.md index ed6a7e9..857d9a6 100644 --- a/21-02.md +++ b/21-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '21' +pages: 402-405 +--- + As on the 486, you should keep a careful eye out for AGIs involving the stack pointer. Implicit modifiers of ESP, such as **PUSH** and **POP**, are special-cased so you don't have to worry about AGIs. However, if you diff --git a/21-03.md b/21-03.md index 5fe52be..5f7cbc9 100644 --- a/21-03.md +++ b/21-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '21' +pages: 405-407 +--- + It's actually not hard to figure out which instructions go through which pipes; just back up until you find an instruction that can't pair or can only go through the U-pipe, and work forward from there, given the diff --git a/21-04.md b/21-04.md index ec4af68..c0cdcef 100644 --- a/21-04.md +++ b/21-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '21' +pages: 407-409 +--- + The first, obvious thing we can do to Listing 21.1 is change **ADC AX,0** to **ADC EAX,0**, eliminating a prefix byte and saving a full cycle. Now we're down from five to four cycles. What next? diff --git a/21-05.md b/21-05.md index ef2bfe7..41420f2 100644 --- a/21-05.md +++ b/21-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '21' +pages: 409-411 +--- + **LISTING 21.4 L21-4.ASM** ; Calculates TCP/IP (16-bit carry-wrapping) checksum for buffer diff --git a/22-01.md b/22-01.md index f3fe6b8..cc9f3da 100644 --- a/22-01.md +++ b/22-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '22' +pages: 413-417 +--- + Chapter 22\ Zenning and the Flexible Mind {#Heading1} ------------------------------ diff --git a/22-02.md b/22-02.md index e5d5a5e..19c70fd 100644 --- a/22-02.md +++ b/22-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '22' +pages: 417-418 +--- + **LISTING 22.2 L22-2.ASM** ClearS proc near diff --git a/22-03.md b/22-03.md index 6c021f0..1f64e2f 100644 --- a/22-03.md +++ b/22-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '22' +pages: 419-420 +--- + **LISTING 22.5 L22-5.ASM** ClearS proc near diff --git a/23-01.md b/23-01.md index 6a889e4..3714bc2 100644 --- a/23-01.md +++ b/23-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '23' +pages: 423-427 +--- + *Part II* {align="center"} --------- diff --git a/23-02.md b/23-02.md index 42916d8..f6437b0 100644 --- a/23-02.md +++ b/23-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '23' +pages: 427-430 +--- + ### At the Core {#Heading5} A little background is necessary before we're ready to examine Listing diff --git a/23-03.md b/23-03.md index 5659d29..e601636 100644 --- a/23-03.md +++ b/23-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '23' +pages: 430-441 +--- + #### Linear Planes and True VGA Modes {#Heading6} The VGA's memory is organized as four 64K planes. Each of these planes diff --git a/23-04.md b/23-04.md index cd5e0bf..7297612 100644 --- a/23-04.md +++ b/23-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '23' +pages: 441-443 +--- + #### Smooth Panning {#Heading7} The first thing you'll notice upon running the sample program is the diff --git a/23-05.md b/23-05.md index 49f9595..1eef014 100644 --- a/23-05.md +++ b/23-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '23' +pages: 443-445 +--- + #### Color Plane Manipulation {#Heading8} The VGA provides a considerable amount of hardware assistance for diff --git a/23-06.md b/23-06.md index b1dbf2b..2b05bf0 100644 --- a/23-06.md +++ b/23-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '23' +pages: 445-448 +--- + One possible solution to this problem is to pick a second page start address that has a 0 value for the lower byte, so only the Start Address High register ever needs to be set, but in the sample program in Listing diff --git a/24-01.md b/24-01.md index bb56f6d..a4b7805 100644 --- a/24-01.md +++ b/24-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '24' +pages: 449-453 +--- + Chapter 24\ Parallel Processing with the VGA {#Heading1} --------------------------------- diff --git a/24-02.md b/24-02.md index cbc1402..1e4e60d 100644 --- a/24-02.md +++ b/24-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '24' +pages: 453-458 +--- + **LISTING 24.1 L24-1.ASM** ; Program to illustrate operation of ALUs and latches of the VGA's diff --git a/24-03.md b/24-03.md index 7c5b58e..10758c4 100644 --- a/24-03.md +++ b/24-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '24' +pages: 458-460 +--- + Logical function 0, which writes the CPU data unmodified, is the standard mode of operation of the ALUs. In this mode, the CPU data is combined with the latched data by ignoring the latched data entirely. diff --git a/25-01.md b/25-01.md index 5070b5b..7e97916 100644 --- a/25-01.md +++ b/25-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '25' +pages: 461-466 +--- + Chapter 25\ VGA Data Machinery {#Heading1} ------------------- diff --git a/25-02.md b/25-02.md index 44aa361..a3f413f 100644 --- a/25-02.md +++ b/25-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '25' +pages: 466-470 +--- + **LISTING 25.1 L25-1.ASM** ; Program to illustrate operation of data rotate and bit mask diff --git a/25-03.md b/25-03.md index 15b6a32..c74013e 100644 --- a/25-03.md +++ b/25-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '25' +pages: 470-472 +--- + It's worth pointing out again that the bit mask operates on the data in the latches, not on the data in display memory. This makes the bit mask a flexible resource that with a little imagination can be used for some diff --git a/25-04.md b/25-04.md index 6ea0e48..4463027 100644 --- a/25-04.md +++ b/25-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '25' +pages: 472-474 +--- + **LISTING 25.2 L25-2.ASM** ; Program to illustrate operation of Map Mask register when drawing diff --git a/25-05.md b/25-05.md index 908d755..e37eaae 100644 --- a/25-05.md +++ b/25-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '25' +pages: 474-478 +--- + **LISTING 25.3 L25-3.ASM** ; Program to illustrate operation of set/reset circuitry to force diff --git a/25-06.md b/25-06.md index 8dd72be..803498e 100644 --- a/25-06.md +++ b/25-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '25' +pages: 478-479 +--- + There is no clearly defined role for the set/reset circuitry, as there is for, say, the bit mask. In many cases, set/reset is largely interchangeable with CPU data, particularly with CPU data written in diff --git a/26-01.md b/26-01.md index 0f23c0c..f830138 100644 --- a/26-01.md +++ b/26-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '26' +pages: 481-484 +--- + Chapter 26\ VGA Write Mode 3 {#Heading1} ----------------- diff --git a/26-02.md b/26-02.md index 1186295..f30853b 100644 --- a/26-02.md +++ b/26-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '26' +pages: 484-489 +--- + **LISTING 26.1 L26-1.ASM** ; Program to illustrate operation of write mode 3 of the VGA. diff --git a/26-03.md b/26-03.md index 6a84a24..186f445 100644 --- a/26-03.md +++ b/26-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '26' +pages: 489-497 +--- + The key to understanding Listing 26.1 is understanding the effect of ANDing the rotated CPU data with the contents of the Bit Mask register. The CPU data is the pattern for the character to be drawn, with bits diff --git a/27-01.md b/27-01.md index 2a064e0..370d8fd 100644 --- a/27-01.md +++ b/27-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '27' +pages: 499-504 +--- + Chapter 27\ Yet Another VGA Write Mode {#Heading1} --------------------------- diff --git a/27-02.md b/27-02.md index 4ab39a5..b41128f 100644 --- a/27-02.md +++ b/27-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '27' +pages: 504-508 +--- + #### Copying Chunky Bitmaps to VGA Memory Using Write Mode 2 {#Heading5} Let's take a look at two examples of write mode 2 in action. Listing diff --git a/27-03.md b/27-03.md index e4048fc..58906b6 100644 --- a/27-03.md +++ b/27-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '27' +pages: 508-515 +--- + "That's an interesting application of write mode 2," you may well say, "but is it really useful?" While the ability to convert chunky bitmaps into VGA bitmaps does have its uses, Listing 27.1 is primarily intended diff --git a/27-04.md b/27-04.md index 4356d3c..fd2e7e8 100644 --- a/27-04.md +++ b/27-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '27' +pages: 515-517 +--- + ### When to Use Write Mode 2 and When to Use Set/Reset {#Heading7} As indicated earlier, write mode 2 and set/reset are functionally diff --git a/27-05.md b/27-05.md index 758722c..7836959 100644 --- a/27-05.md +++ b/27-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '27' +pages: 517-521 +--- + Another interesting point about flipping from graphics to text and back is that the standard mode 3 character/attribute map doesn't actually take up every byte of the first 4000 bytes of planes 0 and 1. The diff --git a/28-01.md b/28-01.md index 07d9230..931ccdd 100644 --- a/28-01.md +++ b/28-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '28' +pages: 523-526 +--- + Chapter 28\ Reading VGA Memory {#Heading1} ------------------- diff --git a/28-02.md b/28-02.md index ca81a63..9f7082e 100644 --- a/28-02.md +++ b/28-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '28' +pages: 526-530 +--- + **LISTING 28.1 L28-1.ASM** ; Program to illustrate the use of the Read Map register in read mode 0. diff --git a/28-03.md b/28-03.md index cb55564..e6343d5 100644 --- a/28-03.md +++ b/28-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '28' +pages: 530-531 +--- + By the way, the code in Listing 28.1 is intended only to illustrate read mode 0, and is, in general, a poor way to perform animation, since it's slow and tends to flicker. Later in this book, we'll take a look at some diff --git a/28-04.md b/28-04.md index 4bef6d4..1ffe214 100644 --- a/28-04.md +++ b/28-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '28' +pages: 531-535 +--- + **LISTING 28.2 L28-2.ASM** ; Program to illustrate use of read mode 1 (color compare mode) diff --git a/28-05.md b/28-05.md index 6cee474..5226b82 100644 --- a/28-05.md +++ b/28-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '28' +pages: 535-537 +--- + Listing 28.3 illustrates an efficient use of write mode 3 in conjunction with read mode 1 and a Color Don't Care register setting of 0. The mask in AL is passed directly to the VGA's bit mask (that's how write mode 3 diff --git a/29-01.md b/29-01.md index e670311..efce246 100644 --- a/29-01.md +++ b/29-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '29' +pages: 539-545 +--- + Chapter 29\ Saving Screens and Other VGA Mysteries {#Heading1} --------------------------------------- diff --git a/29-02.md b/29-02.md index b8bb755..266ed0e 100644 --- a/29-02.md +++ b/29-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '29' +pages: 545-547 +--- + **LISTING 29.2 L29-2.ASM** ; Program to restore a mode 10h EGA graphics screen from diff --git a/29-03.md b/29-03.md index fe9959b..518ff2f 100644 --- a/29-03.md +++ b/29-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '29' +pages: 547-550 +--- + ------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ![](images/i.jpg) *While these requirements are no problem if you're simply calling a subroutine in order to save an image from your program, they pose a considerable problem if you're designing a hot-key operated TSR that can capture a screen image at any time. With the EGA specifically, there's never any way to tell what state the registers are currently in, since the registers aren't readable. (More on this issue later in this chapter.) As a result, any TSR that sets the Bit Mask to 0FFH, the Data Rotate register to 0, and so on runs the risk of interfering with the drawing code of the program that's already running.* ------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/29-04.md b/29-04.md index d2e11df..ba6fa39 100644 --- a/29-04.md +++ b/29-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '29' +pages: 550-555 +--- + How does one go about setting the palette registers? Well, it's certainly possible to set the palette registers directly by addressing them at registers 0 through 0FH of the Attribute Controller. However, diff --git a/29-05.md b/29-05.md index e2f5f90..bdefbac 100644 --- a/29-05.md +++ b/29-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '29' +pages: 555-557 +--- + ### Overscan {#Heading5} While we're at it, I'm going to touch on overscan. Overscan is the color diff --git a/29-06.md b/29-06.md index ca1abd9..9729909 100644 --- a/29-06.md +++ b/29-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '29' +pages: 557-559 +--- + Does that do it for color selection? Yes and no. For the EGA, we've covered the whole of color selection—but not so for the VGA. The VGA can emulate everything we've discussed, but actually performs one 4-bit to diff --git a/30-01.md b/30-01.md index ec445a4..2506411 100644 --- a/30-01.md +++ b/30-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '30' +pages: 561-566 +--- + Chapter 30\ Video Est Omnis Divisa {#Heading1} ----------------------- diff --git a/30-02.md b/30-02.md index 6b87148..e7ff426 100644 --- a/30-02.md +++ b/30-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '30' +pages: 566-572 +--- + Finally, after another keypress, Listing 30.1 halts. **LISTING 30.1 L30-1.ASM** diff --git a/30-03.md b/30-03.md index 1046743..660323d 100644 --- a/30-03.md +++ b/30-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '30' +pages: 572-574 +--- + #### VGA and EGA Split-Screen Operation Don't Mix {#Heading5} You must set the **IS\_VGA** equate at the start of Listing 30.1 diff --git a/30-04.md b/30-04.md index c6c8f23..7d871a6 100644 --- a/30-04.md +++ b/30-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '30' +pages: 574-575 +--- + ### Split Screen and Panning {#Heading8} Back in Chapter 23, I presented a program that performed smooth diff --git a/30-05.md b/30-05.md index 1879362..6fd8ad2 100644 --- a/30-05.md +++ b/30-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '30' +pages: 575-582 +--- + **LISTING 30.2 L30-2.ASM** ; Demonstrates the interaction of the split screen and diff --git a/30-06.md b/30-06.md index df6db64..600b7f1 100644 --- a/30-06.md +++ b/30-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '30' +pages: 582-584 +--- + ### Notes on Setting and Reading Registers {#Heading10} There are a few interesting points regarding setting and reading diff --git a/30-07.md b/30-07.md index 690ed6a..85df1f8 100644 --- a/30-07.md +++ b/30-07.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '30' +pages: 584-585 +--- + ### Split Screens in Other Modes {#Heading11} So far we've only discussed the split screen in mode 10H. What about diff --git a/31-01.md b/31-01.md index abcd8b7..eff4113 100644 --- a/31-01.md +++ b/31-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '31' +pages: 587-591 +--- + Chapter 31\ Higher 256-Color Resolution on the VGA {#Heading1} --------------------------------------- diff --git a/31-02.md b/31-02.md index 322e77a..797894b 100644 --- a/31-02.md +++ b/31-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '31' +pages: 591-593 +--- + That's a shame, because mode 13H has the simplest bitmap organization of any mode—one long, linear bitmap, with each byte controlling one pixel. We can't have that organization, though, so we'll have to find an diff --git a/31-03.md b/31-03.md index 0b73322..7bef705 100644 --- a/31-03.md +++ b/31-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '31' +pages: 593-598 +--- + **LISTING 31.1 L31-1.ASM** ; Program to demonstrate pixel drawing in 320x400 256-color diff --git a/31-04.md b/31-04.md index 6903fa5..c2a6187 100644 --- a/31-04.md +++ b/31-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '31' +pages: 599-600 +--- + The interesting aspects of Listing 31.1 are three. First, the **Set320x400Mode** subroutine selects 320x400 256-color mode. This is accomplished by performing a mode 13H mode set followed by then putting diff --git a/31-05.md b/31-05.md index 6614e2f..8b3ce65 100644 --- a/31-05.md +++ b/31-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '31' +pages: 600-605 +--- + **LISTING 31.2 L31-2.ASM** ; Program to demonstrate the two pages available in 320x400 diff --git a/32-01.md b/32-01.md index 62c17ab..7ae966b 100644 --- a/32-01.md +++ b/32-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '32' +pages: 607-611 +--- + Chapter 32\ Be It Resolved: 360x480 {#Heading1} ------------------------ diff --git a/32-02.md b/32-02.md index 69aca35..90bd274 100644 --- a/32-02.md +++ b/32-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '32' +pages: 611-615 +--- + **LISTING 32.1 L32-1.ASM** ; Borland C/C++ tiny/small/medium model-callable assembler diff --git a/32-03.md b/32-03.md index 6b163b3..22f8ca7 100644 --- a/32-03.md +++ b/32-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '32' +pages: 615-618 +--- + **LISTING 32.2 L32-2.C** * Sample program to illustrate VGA line drawing in 360x480 diff --git a/32-04.md b/32-04.md index e6b93e8..5723666 100644 --- a/32-04.md +++ b/32-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '32' +pages: 618-620 +--- + The second thing you'll notice is that exquisite shading effects are possible in 360x480 256-color mode; adjacent lines blend together remarkably smoothly, even with the default palette. The VGA allows you diff --git a/32-05.md b/32-05.md index f24d989..2712adc 100644 --- a/32-05.md +++ b/32-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '32' +pages: 620-622 +--- + The key to solving this problem lies in recalling that the VGA is designed to drive a monitor that sweeps the electron beam across the screen at exactly the same speed, no matter what mode the VGA is in. If diff --git a/33-01.md b/33-01.md index 11ae63f..c7ea8ea 100644 --- a/33-01.md +++ b/33-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '33' +pages: 623-628 +--- + Chapter 33\ Yogi Bear and Eurythmics Confront VGA Colors {#Heading1} --------------------------------------------- diff --git a/33-02.md b/33-02.md index 1f1d222..ec673bc 100644 --- a/33-02.md +++ b/33-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '33' +pages: 628-630 +--- + #### Color Paging with the Color Select Register {#Heading6} "Wait a minute," you say bemusedly. "Aren't you missing some bits diff --git a/33-03.md b/33-03.md index ffc7009..76b6067 100644 --- a/33-03.md +++ b/33-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '33' +pages: 630-632 +--- + #### Setting the DAC {#Heading9} Like the palette RAM, the DAC registers can be set either directly or diff --git a/33-04.md b/33-04.md index 2cdbeaa..bb1ac61 100644 --- a/33-04.md +++ b/33-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '33' +pages: 632-636 +--- + **LISTING 33.1 L33-1.ASM** ; Program to demonstrate use of the DAC registers by selecting a diff --git a/34-01.md b/34-01.md index 177e75b..1a34c70 100644 --- a/34-01.md +++ b/34-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '34' +pages: 637-641 +--- + Chapter 34\ Changing Colors without Writing Pixels {#Heading1} --------------------------------------- diff --git a/34-02.md b/34-02.md index 36b038e..412fa8c 100644 --- a/34-02.md +++ b/34-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '34' +pages: 641-643 +--- + #### Loading the DAC via the BIOS {#Heading5} The DAC can be loaded either directly or through subfunctions 10H (for a diff --git a/34-03.md b/34-03.md index f6e643e..997d55e 100644 --- a/34-03.md +++ b/34-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '34' +pages: 643-648 +--- + ### A Test Program for Color Cycling {#Heading7} Anyway, the choice of how to load the DAC is yours. Given that I'm not diff --git a/34-04.md b/34-04.md index 9535a1b..d004848 100644 --- a/34-04.md +++ b/34-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '34' +pages: 648-650 +--- + The big question is, How does Listing 34.1 cycle colors? Via the BIOS or directly? With interrupts enabled or disabled? *Et cetera?* diff --git a/34-05.md b/34-05.md index 35b28f2..d7e2bf4 100644 --- a/34-05.md +++ b/34-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '34' +pages: 650-652 +--- + Yet another and somewhat odder workaround is that of using only 128 DAC locations and page flipping. (Page flipping in 256-color modes involves using the VGA's undocumented 256-color modes; see Chapters 31, 43, and diff --git a/35-01.md b/35-01.md index 7a05163..4ed450e 100644 --- a/35-01.md +++ b/35-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '35' +pages: 653-658 +--- + Chapter 35\ Bresenham Is Fast, and Fast Is Good {#Heading1} ------------------------------------ diff --git a/35-02.md b/35-02.md index b7fb81a..94379d3 100644 --- a/35-02.md +++ b/35-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '35' +pages: 658-661 +--- + Let's examine the case of drawing a line where the horizontal, or X length of the line is greater than the vertical, or Y length, and both lengths are greater than 0. For example, suppose we are drawing a line diff --git a/35-03.md b/35-03.md index ff1a8c7..ed10562 100644 --- a/35-03.md +++ b/35-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '35' +pages: 661-664 +--- + ### An Implementation in C {#Heading6} It's time to get down and look at some actual working code. Listing 35.1 diff --git a/35-04.md b/35-04.md index c08cf46..caeab1e 100644 --- a/35-04.md +++ b/35-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '35' +pages: 664-667 +--- + **LISTING 35.2 L35-2.C** /* diff --git a/35-05.md b/35-05.md index b0aa36f..b68e2b6 100644 --- a/35-05.md +++ b/35-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '35' +pages: 667-670 +--- + There is one line-drawing function for octants 0 and 3, **Octant0**, and one line-drawing function for octants 1 and 2, **Octant1**. A single function with **if** statements could certainly be used to handle all diff --git a/35-06.md b/35-06.md index 9d66a4c..24eb384 100644 --- a/35-06.md +++ b/35-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '35' +pages: 670-671 +--- + The result of all this is simply a single pixel drawn in the color set up in **EVGALine**. **EVGADot** may seem excessively complex for a function that does nothing more that draw one pixel, but programming the diff --git a/35-07.md b/35-07.md index 412a1a2..4eb1dee 100644 --- a/35-07.md +++ b/35-07.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '35' +pages: 671-678 +--- + **LISTING 35.3 L35-3.ASM** ; Fast assembler implementation of Bresenham's line-drawing algorithm diff --git a/36-01.md b/36-01.md index a0b9d9f..a2035d4 100644 --- a/36-01.md +++ b/36-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '36' +pages: 679-683 +--- + Chapter 36\ The Good, the Bad, and the Run-Sliced {#Heading1} -------------------------------------- diff --git a/36-02.md b/36-02.md index 17f9b75..362e061 100644 --- a/36-02.md +++ b/36-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '36' +pages: 684-687 +--- + The run-length slice algorithm rotates matters 90 degrees, with salubrious results. The basis of the run-length slice algorithm is stepping one pixel at a time along the minor axis (the shorter diff --git a/36-03.md b/36-03.md index 9dbe39d..60fe219 100644 --- a/36-03.md +++ b/36-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '36' +pages: 687-692 +--- + ### Run-Length Slice Details {#Heading5} A couple of run-length slice implementation details yet remain. First is diff --git a/36-04.md b/36-04.md index 0daae42..ec324a5 100644 --- a/36-04.md +++ b/36-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '36' +pages: 692-693 +--- + Notwithstanding that it's not optimized, Listing 36.1 is reasonably fast. If you run Listing 36.2 (a sample line-drawing program that you can use to test-drive Listing 36.1), you may be as surprised as I was at diff --git a/37-01.md b/37-01.md index 1fcfba9..3535daa 100644 --- a/37-01.md +++ b/37-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '37' +pages: 695-704 +--- + Chapter 37\ Dead Cats and Lightning Lines {#Heading1} ------------------------------ diff --git a/37-02.md b/37-02.md index eb86bd7..bb850b3 100644 --- a/37-02.md +++ b/37-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '37' +pages: 704-706 +--- + #### How Fast Is Fast? {#Heading4} Your first question is likely to be the following: Just how fast is diff --git a/38-01.md b/38-01.md index b374a02..2bc096d 100644 --- a/38-01.md +++ b/38-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '38' +pages: 707-712 +--- + Chapter 38\ The Polygon Primeval {#Heading1} --------------------- diff --git a/38-02.md b/38-02.md index dc9bf6e..99d951b 100644 --- a/38-02.md +++ b/38-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '38' +pages: 712-717 +--- + #### How Do You Fit Polygons Together? {#Heading5} How, then, do you fit polygons together? *Very* carefully. First, the diff --git a/38-03.md b/38-03.md index 45fac6a..fa84d4d 100644 --- a/38-03.md +++ b/38-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '38' +pages: 717-720 +--- + **LISTING 38.3 L38-3.C** /* Sample program to exercise the polygon-filling routines. This code diff --git a/38-04.md b/38-04.md index f80cc36..ca980b5 100644 --- a/38-04.md +++ b/38-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '38' +pages: 720-721 +--- + Listing 38.2 isn't particularly interesting; it merely draws each horizontal line in the passed-in list in the simplest possible way, one pixel at a time. (No, that doesn't make the pixel the fundamental diff --git a/39-01.md b/39-01.md index 45ad7d8..11afe27 100644 --- a/39-01.md +++ b/39-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '39' +pages: 723-727 +--- + Chapter 39\ Fast Convex Polygons {#Heading1} --------------------- diff --git a/39-02.md b/39-02.md index af157d5..86109de 100644 --- a/39-02.md +++ b/39-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '39' +pages: 727-730 +--- + At any rate, Listing 39.1 for this chapter shows a version of **DrawHorizontalLineList** that uses memset to draw each scan line of the polygon in a single call. When linked to Chapter 38's test program, diff --git a/39-03.md b/39-03.md index ce9382c..bb13dd3 100644 --- a/39-03.md +++ b/39-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '39' +pages: 730-733 +--- + Listing 39.2 shows a C implementation of integer edge tracing. Vertical and diagonal lines, which are trivial to trace, are special-cased. Other lines are broken into two categories: Y-major (closer to vertical) and diff --git a/39-04.md b/39-04.md index d70ceca..2886cce 100644 --- a/39-04.md +++ b/39-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '39' +pages: 733-735 +--- + And indeed it does. When the test program is modified to draw to a local buffer, both the C and assembly language versions get 0.29 seconds faster, that being a measure of the time taken by display memory wait diff --git a/39-05.md b/39-05.md index 87b1078..5121106 100644 --- a/39-05.md +++ b/39-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '39' +pages: 735-738 +--- + **LISTING 39.4 L39-4.ASM** ; Scan converts an edge from (X1,Y1) to (X2,Y2), not including the diff --git a/40-01.md b/40-01.md index 48dd843..39d6630 100644 --- a/40-01.md +++ b/40-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '40' +pages: 739-744 +--- + Chapter 40\ Of Songs, Taxes, and the Simplicity of Complex Polygons {#Heading1} -------------------------------------------------------- diff --git a/40-02.md b/40-02.md index 3767375..6ca0ad6 100644 --- a/40-02.md +++ b/40-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '40' +pages: 744-750 +--- + Advancing the X coordinates is easy. For each edge, we'll store the current X coordinate and all required error term information, and we'll use that to advance the edge one scan line at a time; then, we'll resort diff --git a/40-03.md b/40-03.md index acaca54..522bb03 100644 --- a/40-03.md +++ b/40-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '40' +pages: 750-753 +--- + ### Complex Polygon Filling: An Implementation {#Heading5} Listing 40.1 just shown presents a function, **FillPolygon()**, that diff --git a/40-04.md b/40-04.md index cd0e456..bc797bf 100644 --- a/40-04.md +++ b/40-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '40' +pages: 753-755 +--- + Listing 40.4 illustrates several interesting aspects of polygon filling. The first and third polygons drawn illustrate the operation of the odd/even fill rule. The second polygon drawn illustrates how holes can diff --git a/40-05.md b/40-05.md index 6795e48..9aaade1 100644 --- a/40-05.md +++ b/40-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '40' +pages: 755-756 +--- + An insertion sort that scans backward through the AET from the current edge rather than forward from the start of the AET could be quite a bit faster, because edges rarely move more than one or two positions through diff --git a/41-01.md b/41-01.md index b97d175..17cfd91 100644 --- a/41-01.md +++ b/41-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '41' +pages: 757-761 +--- + Chapter 41\ Those Way-Down Polygon Nomenclature Blues {#Heading1} ------------------------------------------ diff --git a/41-02.md b/41-02.md index 1def0ad..feae887 100644 --- a/41-02.md +++ b/41-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '41' +pages: 761-764 +--- + Listings 41.2 and 41.3 are variants of the fast convex polygon fill code from Chapter 39, modified to be able to handle all monotone-vertical polygons, including nonsimple ones; the edge-scanning code (Listing 39.4 diff --git a/41-03.md b/41-03.md index 7ca7099..b7a31ec 100644 --- a/41-03.md +++ b/41-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '41' +pages: 764-766 +--- + **LISTING 41.3 L41-3.ASM** ; Draws all pixels in list of horizontal lines passed in, in mode 13h, VGA's diff --git a/41-04.md b/41-04.md index 207d79c..4cf07b0 100644 --- a/41-04.md +++ b/41-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '41' +pages: 766-771 +--- + **LISTING 41.4 L41-4.C** /* Color-fills an arbitrarily-shaped polygon described by VertexList. diff --git a/42-01.md b/42-01.md index ec2e04d..3c5b4d5 100644 --- a/42-01.md +++ b/42-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '42' +pages: 773-778 +--- + Chapter 42\ Wu'ed in Haste; Fried, Stewed at Leisure {#Heading1} ----------------------------------------- diff --git a/42-02.md b/42-02.md index eacc892..57bc3fd 100644 --- a/42-02.md +++ b/42-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '42' +pages: 778-781 +--- + ### Tracing and Intensity in One {#Heading4} Horizontal, vertical, and diagonal lines do not require Wu antialiasing diff --git a/42-03.md b/42-03.md index 10c89d7..bd73dbb 100644 --- a/42-03.md +++ b/42-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '42' +pages: 782-784 +--- + ### Sample Wu Antialiasing {#Heading5} The true test of any antialiasing technique is how good it looks, so diff --git a/42-04.md b/42-04.md index ec5062f..807ebab 100644 --- a/42-04.md +++ b/42-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '42' +pages: 784-787 +--- + **LISTING 42.4 L42-4.C** /* Function to draw a non-antialiased line from (X0,Y0) to (X1,Y1), using a diff --git a/42-05.md b/42-05.md index 09ac156..a9230fa 100644 --- a/42-05.md +++ b/42-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '42' +pages: 787-792 +--- + **LISTING 42.6 L42-6.ASM** ; C near-callable function to draw an antialiased line from diff --git a/43-01.md b/43-01.md index 59bcee6..924b0eb 100644 --- a/43-01.md +++ b/43-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '43' +pages: 793-799 +--- + Chapter 43\ Bit-Plane Animation {#Heading1} -------------------- diff --git a/43-02.md b/43-02.md index f6a6841..17eab9c 100644 --- a/43-02.md +++ b/43-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '43' +pages: 799-801 +--- + #### Stacking the Palette Registers {#Heading4} Suppose that instead of viewing the four bits per pixel coming out of diff --git a/43-03.md b/43-03.md index 1c76ae0..3e04e5c 100644 --- a/43-03.md +++ b/43-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '43' +pages: 801-810 +--- + **LISTING 43.1 L43-1.ASM** ; Program to demonstrate bit-plane animation. Performs diff --git a/43-04.md b/43-04.md index 388405a..3564b42 100644 --- a/43-04.md +++ b/43-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '43' +pages: 810-811 +--- + For those of you who haven't experienced the frustrations of animation programming on a PC, there's a *whole* lot of animation going on in Listing 43.1. What's more, the animation is virtually flicker-free, diff --git a/43-05.md b/43-05.md index 02d3fd6..11824c2 100644 --- a/43-05.md +++ b/43-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '43' +pages: 811-813 +--- + Another limitation of bit-plane animation is that it's best if images stored in the same plane never cross each other. Why? Because when images do cross, the blank fringe diff --git a/43-06.md b/43-06.md index ee0ae66..02eb457 100644 --- a/43-06.md +++ b/43-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '43' +pages: 813-815 +--- + If the CRT controller scans more slowly than the CPU can modify memory (likely with a 386, a fast VGA, and narrow images), then the CPU can rip right past the CRT controller, with the same net result of mismatched diff --git a/44-01.md b/44-01.md index 4a32cab..da1b79f 100644 --- a/44-01.md +++ b/44-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '44' +pages: 817-820 +--- + Chapter 44\ Split Screens Save the Page Flipped Day {#Heading1} ---------------------------------------- diff --git a/44-02.md b/44-02.md index cab802d..afbbfd2 100644 --- a/44-02.md +++ b/44-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '44' +pages: 820-825 +--- + **LISTING 44.1 L44-1.C** /* Split screen VGA animation program. Performs page flipping in the diff --git a/44-03.md b/44-03.md index 6587a26..458bc59 100644 --- a/44-03.md +++ b/44-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '44' +pages: 825-830 +--- + **LISTING 44.2 L44-2.ASM** ; Low-level animation routines. diff --git a/44-04.md b/44-04.md index 81c5d09..691cefd 100644 --- a/44-04.md +++ b/44-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '44' +pages: 830-833 +--- + Listing 44.1 is written in C. It could equally well have been written in assembly language, and would then have been somewhat faster. However, wanted to make the point (as I've made again and again) that assembly diff --git a/44-05.md b/44-05.md index fffe8a6..089b412 100644 --- a/44-05.md +++ b/44-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '44' +pages: 833-835 +--- + Given the above assumptions, drawing text is easy; we simply copy each byte of each character to the appropriate location in display memory, and *voila*, we're done. Text copying is done in write mode 0, in which diff --git a/44-06.md b/44-06.md index e080fcd..c0cad65 100644 --- a/44-06.md +++ b/44-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '44' +pages: 835-837 +--- + #### Knowing When to Flip {#Heading8 align="center"} There's a hitch, though, and that hitch is knowing exactly when it is diff --git a/45-01.md b/45-01.md index f2dcaa7..2dbd8f0 100644 --- a/45-01.md +++ b/45-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '45' +pages: 839-843 +--- + Chapter 45\ Dog Hair and Dirty Rectangles {#Heading1} ------------------------------ diff --git a/45-02.md b/45-02.md index 4352c17..4d02fca 100644 --- a/45-02.md +++ b/45-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '45' +pages: 843-846 +--- + Of course, VGA display memory has its own performance problems. The fastest ISA bus VGA can, at best, support sustained write times of about 10 cycles per word-sized write on a 486/33; 15 or 20 cycles is more diff --git a/45-03.md b/45-03.md index 240e112..920ff8a 100644 --- a/45-03.md +++ b/45-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '45' +pages: 846-851 +--- + Also, page flipping wastes a good deal of time waiting for the page to flip at the end of the frame. Dirty-rectangle animation never needs to wait for anything because partially drawn images are never present in diff --git a/45-04.md b/45-04.md index 18b2b33..ffea412 100644 --- a/45-04.md +++ b/45-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '45' +pages: 851-853 +--- + One point I'd like to make is that although the system-memory buffer in Listing 45.1 has exactly the same dimensions as the screen bitmap, that's not a requirement, and there are some good reasons not to make diff --git a/45-05.md b/45-05.md index b52c791..dc1d6d4 100644 --- a/45-05.md +++ b/45-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '45' +pages: 853-855 +--- + In 640x400, 16-color mode, page 0 runs from offset 0 to offset 31,999 (7CFFH), and page 1 runs from offset 32,000 (7D00H) to 63,999 (0F9FFH). Page 1 is selected by programming the Start Address registers (CRTC diff --git a/45-06.md b/45-06.md index 492924f..701e777 100644 --- a/45-06.md +++ b/45-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '45' +pages: 855-857 +--- + The 640x400 mode I've described here isn't exactly earthshaking, but it can come in handy for page flipping and CGA emulation, and I'm sure that some of you will find it useful at one time or another. diff --git a/46-01.md b/46-01.md index 09d9364..0898085 100644 --- a/46-01.md +++ b/46-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '46' +pages: 859-862 +--- + Chapter 46\ Who Was that Masked Image? {#Heading1} --------------------------- diff --git a/46-02.md b/46-02.md index b952144..72a3de9 100644 --- a/46-02.md +++ b/46-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '46' +pages: 863-871 +--- + **LISTING 46.1 L46-1.C** /* Sample simple dirty-rectangle animation program, partially optimized and diff --git a/46-03.md b/46-03.md index 178a2dd..d6c87ff 100644 --- a/46-03.md +++ b/46-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '46' +pages: 871-874 +--- + #### Masked Images {#Heading4} Masked images are rendered by drawing an object's pixels through a mask; diff --git a/47-01.md b/47-01.md index d15c7af..c44c863 100644 --- a/47-01.md +++ b/47-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '47' +pages: 875-879 +--- + Chapter 47\ Mode X: 256-Color VGA Magic {#Heading1} ---------------------------- diff --git a/47-02.md b/47-02.md index 7b7a499..9d48cff 100644 --- a/47-02.md +++ b/47-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '47' +pages: 879-882 +--- + Given the tremendous advantages of Mode X over the documented mode 13H, I'd very much like to get it into the hands of as many developers as possible, so I'm going to spend the next few chapters exploring this odd diff --git a/47-03.md b/47-03.md index 06408a5..a48ea3a 100644 --- a/47-03.md +++ b/47-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '47' +pages: 882-885 +--- + After setting up mode 13H, Listing 47.1 alters the vertical counts and timings to select 480 visible scan lines. (There's no need to alter any horizontal values, because mode 13H and Mode X both have 320-pixel diff --git a/47-04.md b/47-04.md index 47266fc..dce6132 100644 --- a/47-04.md +++ b/47-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '47' +pages: 885-887 +--- + ### Designing from a Mode X Perspective {#Heading5} Listing 47.4 shows Mode X rectangle fill code. The plane is selected for diff --git a/47-05.md b/47-05.md index ec97e5c..d4bcfcb 100644 --- a/47-05.md +++ b/47-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '47' +pages: 887-889 +--- + ------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ![](images/i.jpg) *In general, performing plane-at-a-time operations can make almost any Mode X operation, at the worst, nearly as fast as the same operation in mode 13H (although this sort of Mode X programming is admittedly fairly complex). In this pursuit, it can help to organize data structures with Mode X in mind. For example, icons could be prearranged in system memory with the pixels organized into four plane-oriented sets (or, again, in four sets per scan line to avoid a fading-in effect) to facilitate copying to the screen a plane at a time with **REP MOVS*** ------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/47-06.md b/47-06.md index 6c79d86..f7f989c 100644 --- a/47-06.md +++ b/47-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '47' +pages: 889-891 +--- + ### Hardware Assist from an Unexpected Quarter {#Heading6} Listing 47.5 illustrates the benefits of designing code from a Mode X diff --git a/47-07.md b/47-07.md index 5ef8e74..fc8e1d0 100644 --- a/47-07.md +++ b/47-07.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '47' +pages: 891-893 +--- + **LISTING 47.6 L47-6.ASM** ; Mode X (320x240, 256 colors) rectangle fill routine. Works on all diff --git a/48-01.md b/48-01.md index 993103c..9efe75e 100644 --- a/48-01.md +++ b/48-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '48' +pages: 895-900 +--- + Chapter 48\ Mode X Marks the Latch {#Heading1} ----------------------- diff --git a/48-02.md b/48-02.md index a6b6516..a7dda33 100644 --- a/48-02.md +++ b/48-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '48' +pages: 900-903 +--- + **LISTING 48.2 L48-2.ASM** ; Mode X (320x240, 256 colors) rectangle 4x4 pattern fill routine. diff --git a/48-03.md b/48-03.md index 676e127..3abb120 100644 --- a/48-03.md +++ b/48-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '48' +pages: 903-905 +--- + Four-pixel-wide patterns are more useful than you might imagine. There are actually 2128 possible patterns (16 pixels, each with 28 possible colors); that set is certainly large enough for most color-dithering diff --git a/48-04.md b/48-04.md index 35ed3e0..f9ca4f4 100644 --- a/48-04.md +++ b/48-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '48' +pages: 905-908 +--- + **LISTING 48.3 L48-3.ASM** ; Mode X (320x240, 256 colors) display memory to display memory copy diff --git a/48-05.md b/48-05.md index 4ad6735..e473267 100644 --- a/48-05.md +++ b/48-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '48' +pages: 908-911 +--- + Listing 48.3 has an important limitation: It does not guarantee proper handling when the source and destination overlap, as in the case of a downward scroll, for example. Listing 48.3 performs top-to-bottom, diff --git a/49-01.md b/49-01.md index a6aebd6..f0382ef 100644 --- a/49-01.md +++ b/49-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '49' +pages: 913-918 +--- + Chapter 49\ Mode X 256-Color Animation {#Heading1} --------------------------- diff --git a/49-02.md b/49-02.md index 3ad15c9..0636097 100644 --- a/49-02.md +++ b/49-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '49' +pages: 918-922 +--- + #### Faster Masked Copying {#Heading4} In the previous chapter we saw how the VGA's latches can be used to copy diff --git a/49-03.md b/49-03.md index ec885e3..4a3c9fe 100644 --- a/49-03.md +++ b/49-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '49' +pages: 922-924 +--- + It would be handy to have a function that, given a base image and mask, generates the four image and mask alignments and fills in the **MaskedImage** structure. Listing 49.3, together with the include file diff --git a/49-04.md b/49-04.md index feffe53..266b30f 100644 --- a/49-04.md +++ b/49-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '49' +pages: 924-929 +--- + ### Animation {#Heading6} Gosh. There's just no way I can discuss high-level animation diff --git a/49-05.md b/49-05.md index 307b03e..6ae09c5 100644 --- a/49-05.md +++ b/49-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '49' +pages: 929-930 +--- + Here's something worth noting: The animation is extremely smooth on a 20 MHz 386. It is somewhat more jerky on an 8 MHz 286, because only 30 frames a second can be processed. If animation looks jerky on your PC, diff --git a/50-01.md b/50-01.md index c96aff1..5797324 100644 --- a/50-01.md +++ b/50-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '50' +pages: 931-935 +--- + Chapter 50\ Adding a Dimension {#Heading1} ------------------- diff --git a/50-02.md b/50-02.md index 53f189e..0e23e4b 100644 --- a/50-02.md +++ b/50-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '50' +pages: 935-940 +--- + One note: I'll use a purely *right-handed* convention for coordinate systems. Right-handed means that if you hold your right hand with your fingers curled and the thumb sticking out, the thumb points along the Z diff --git a/50-03.md b/50-03.md index 6dda3ef..24b367f 100644 --- a/50-03.md +++ b/50-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '50' +pages: 940-943 +--- + **LISTING 50.1 L50-1.ASM** ; Draws all pixels in the list of horizontal lines passed in, in diff --git a/50-04.md b/50-04.md index fb7a4ff..973a138 100644 --- a/50-04.md +++ b/50-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '50' +pages: 943-945 +--- + The other 2-D element we need is some way to erase the polygon at its old location before it's moved and redrawn. We'll do that by remembering the bounding rectangle of the polygon each time it's drawn, then erasing diff --git a/50-05.md b/50-05.md index 3c1b795..1c2e886 100644 --- a/50-05.md +++ b/50-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '50' +pages: 945-946 +--- + **LISTING 50.4 POLYGON.H** /* POLYGON.H: Header file for polygon-filling code, also includes diff --git a/50-06.md b/50-06.md index be2e942..814b794 100644 --- a/50-06.md +++ b/50-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '50' +pages: 946-948 +--- + **LISTING 50.5 L50-5.C** /* Simple 3-D drawing program to view a polygon as it rotates in diff --git a/50-07.md b/50-07.md index be8e361..48f869d 100644 --- a/50-07.md +++ b/50-07.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '50' +pages: 948-949 +--- + #### Notes on the 3-D Animation Example {#Heading9} The sample program transforms the polygon's vertices from object space diff --git a/51-01.md b/51-01.md index 3fadb48..473be49 100644 --- a/51-01.md +++ b/51-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '51' +pages: 951-955 +--- + Chapter 51\ Sneakers in Space {#Heading1} ------------------ diff --git a/51-02.md b/51-02.md index f70611b..662b013 100644 --- a/51-02.md +++ b/51-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '51' +pages: 955-957 +--- + For a single convex polyhedron, removal of polygons that aren't facing the viewer would solve all hidden surface problems. In a convex polyhedron, any polygon facing the viewer can never be obscured by any diff --git a/51-03.md b/51-03.md index f1347f4..649faf9 100644 --- a/51-03.md +++ b/51-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '51' +pages: 957-960 +--- + **LISTING 51.1 L51-1.C** /* 3D animation program to view a cube as it rotates in Mode X. The viewpoint diff --git a/51-04.md b/51-04.md index 66bb9f0..f6e5068 100644 --- a/51-04.md +++ b/51-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '51' +pages: 960-963 +--- + **LISTING 51.2 L51-2.C** /* Transforms all vertices in the specified object into view spa ce, then diff --git a/51-05.md b/51-05.md index 43ddac5..adc2a46 100644 --- a/51-05.md +++ b/51-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '51' +pages: 963-965 +--- + With the above optimizations, the sample program is certainly adequately responsive on a 20 MHz 386 (sans 387; I'm sure it's wonderfully responsive with a math coprocessor). Still, it couldn't quite keep up diff --git a/51-06.md b/51-06.md index 833b768..5c55658 100644 --- a/51-06.md +++ b/51-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '51' +pages: 965-967 +--- + **LISTING 51.5 POLYGON.H** /* POLYGON.H: Header file for polygon-filling code, also includes a number of diff --git a/52-01.md b/52-01.md index c1f4bd2..f539799 100644 --- a/52-01.md +++ b/52-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '52' +pages: 969-972 +--- + Chapter 52\ Fast 3-D Animation: Meet X-Sharp {#Heading1} --------------------------------- diff --git a/52-02.md b/52-02.md index e7a9fd1..96cb6f2 100644 --- a/52-02.md +++ b/52-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '52' +pages: 973-974 +--- + **LISTING 52.1 L52-1.C** /* 3-D animation program to rotate 12 cubes. Uses fixed point. All C code diff --git a/52-03.md b/52-03.md index 37fd249..a2a167f 100644 --- a/52-03.md +++ b/52-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '52' +pages: 975-977 +--- + **LISTING 52.3 L52-3.C** /* Routines to perform incremental rotations around the three axes. */ diff --git a/52-04.md b/52-04.md index 31bac7c..7cf92fd 100644 --- a/52-04.md +++ b/52-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '52' +pages: 977-979 +--- + **LISTING 52.6 L52-6.C** /* Rotates and moves a polygon-based object around the three axes. diff --git a/52-05.md b/52-05.md index 6af5d67..343009f 100644 --- a/52-05.md +++ b/52-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '52' +pages: 979-981 +--- + **LISTING 52.8 L52-8.C** /* Initializes the cubes and adds them to the object list. */ diff --git a/52-06.md b/52-06.md index 56c4c5b..edf9ec1 100644 --- a/52-06.md +++ b/52-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '52' +pages: 981-984 +--- + **LISTING 52.9 L52-9.ASM** ; 386-specific fixed point multiply and divide. diff --git a/52-07.md b/52-07.md index b7aef90..80acf0a 100644 --- a/52-07.md +++ b/52-07.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '52' +pages: 984-985 +--- + ### A New Animation Framework: X-Sharp {#Heading4} Listings 52.1 through 52.10 shown earlier represent not merely faster diff --git a/52-08.md b/52-08.md index cb544e7..85ee732 100644 --- a/52-08.md +++ b/52-08.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '52' +pages: 985-987 +--- + The keys to the performance increase manifested in this chapter's code are three. The first key is fixed-point arithmetic. In the previous two chapters, we worked with floating-point coordinates and transformation diff --git a/53-01.md b/53-01.md index d252096..9d5908c 100644 --- a/53-01.md +++ b/53-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '53' +pages: 989-992 +--- + Chapter 53\ Raw Speed and More {#Heading1} ------------------- diff --git a/53-02.md b/53-02.md index 1d72c90..fdbb839 100644 --- a/53-02.md +++ b/53-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '53' +pages: 992-999 +--- + **LISTING 53.1 FIXED.ASM** ; 386-specific fixed point routines. diff --git a/53-03.md b/53-03.md index 0ab6dc1..c4bb194 100644 --- a/53-03.md +++ b/53-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '53' +pages: 999-1001 +--- + ### Raw Speed, Part II: Look it Up {#Heading4} It's a funny thing about Turbo Profiler: Time spent in the Borland C++ diff --git a/53-04.md b/53-04.md index 1700b7b..7d14848 100644 --- a/53-04.md +++ b/53-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '53' +pages: 1001-1003 +--- + **LISTING 53.2 OLIST.C** /* Object list-related functions. */ diff --git a/54-01.md b/54-01.md index 6367774..60ce634 100644 --- a/54-01.md +++ b/54-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '54' +pages: 1005-1008 +--- + Chapter 54\ 3-D Shading {#Heading1} ------------ diff --git a/54-02.md b/54-02.md index 4f3cd89..61def25 100644 --- a/54-02.md +++ b/54-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '54' +pages: 1008-1022 +--- + **LISTING 54.1 FIXED.ASM** ; Fixed point routines. diff --git a/54-03.md b/54-03.md index 82b3b39..6e13c7d 100644 --- a/54-03.md +++ b/54-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '54' +pages: 1023-1025 +--- + #### Shading {#Heading4} So far, the polygons out of which our animated objects have been built diff --git a/54-04.md b/54-04.md index 33fca92..f866124 100644 --- a/54-04.md +++ b/54-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '54' +pages: 1025-1027 +--- + **LISTING 54.2 DRAWPOBJ.C** /* Draws all visible faces in the specified polygon-based object. The object diff --git a/54-05.md b/54-05.md index d9e4031..796c94d 100644 --- a/54-05.md +++ b/54-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '54' +pages: 1027-1029 +--- + #### Shading: Implementation Details {#Heading7} In order to calculate the cosine of the angle between an incoming light diff --git a/55-01.md b/55-01.md index 79620b2..9db16d8 100644 --- a/55-01.md +++ b/55-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '55' +pages: 1031-1035 +--- + Chapter 55\ Color Modeling in 256-Color Mode {#Heading1} --------------------------------- diff --git a/55-02.md b/55-02.md index c57a1c6..5750426 100644 --- a/55-02.md +++ b/55-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '55' +pages: 1036-1038 +--- + So it's perfectly reasonable to maintain 24 bits of color resolution, and X-Sharp represents colors internally as ideal, device-independent 24-bit RGB triplets. All shading calculations are performed on these diff --git a/55-03.md b/55-03.md index 1b7ba02..1c597d8 100644 --- a/55-03.md +++ b/55-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '55' +pages: 1038-1040 +--- + **LISTING 55.3 L55-3.C** /* Converts a model color (a color in the RGB color cube, in the current diff --git a/55-04.md b/55-04.md index 8f2be6c..08c2dd7 100644 --- a/55-04.md +++ b/55-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '55' +pages: 1040-1044 +--- + This is where it gets a little complicated. In write mode 3 (which incidentally is not available on the EGA), each byte value that the CPU writes to the VGA does not get written to display memory. Instead, it diff --git a/56-01.md b/56-01.md index cdd91a5..c7015cd 100644 --- a/56-01.md +++ b/56-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '56' +pages: 1046-1050 +--- + Chapter 56\ Pooh and the Space Station {#Heading1} --------------------------- diff --git a/56-02.md b/56-02.md index 4778593..50e7643 100644 --- a/56-02.md +++ b/56-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '56' +pages: 1050-1053 +--- + Ah, but what is an "equivalent amount"? Think of it this way. If a destination edge is 100 scan lines high, it will be stepped 100 times. Then, we'll divide the **SourceXWidth** and **SourceYHeight** lengths of diff --git a/56-03.md b/56-03.md index 67e1958..3c613d3 100644 --- a/56-03.md +++ b/56-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '56' +pages: 1053-1059 +--- + ### Fast Texture Mapping: An Implementation {#Heading6} As you might expect, I've implemented DDA texture mapping in X-Sharp, diff --git a/57-01.md b/57-01.md index b2353fc..65b4fa9 100644 --- a/57-01.md +++ b/57-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '57' +pages: 1061-1065 +--- + Chapter 57\ 10,000 Freshly Sheared Sheep on the Screen {#Heading1} ------------------------------------------- diff --git a/57-02.md b/57-02.md index 2682c9a..7bb0eed 100644 --- a/57-02.md +++ b/57-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '57' +pages: 1065-1068 +--- + #### Texture Mapping: Orientation Independence {#Heading5} The double-DDA texture-mapping code presented in the previous chapter diff --git a/57-03.md b/57-03.md index 78f51b3..1e7ff45 100644 --- a/57-03.md +++ b/57-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '57' +pages: 1069-1073 +--- + **LISTING 57.2 L57-2.ASM** ; Draws all pixels in the specified scan line, with the pixel colors diff --git a/57-04.md b/57-04.md index 29a5555..cc8ad0d 100644 --- a/57-04.md +++ b/57-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '57' +pages: 1074-1075 +--- + Within Listing 57.2, all the important optimization is in the loop that draws across each destination scan line, near the end of the listing. One optimization is elimination of the call to the set-pixel routine diff --git a/58-01.md b/58-01.md index aa51ed4..0aad4a9 100644 --- a/58-01.md +++ b/58-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '58' +pages: 1077-1081 +--- + Chapter 58\ Heinlein's Crystal Ball, Spock's Brain, and the 9-Cycle Dare {#Heading1} ------------------------------------------------------------- diff --git a/58-02.md b/58-02.md index 1351b0f..3d791d1 100644 --- a/58-02.md +++ b/58-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '58' +pages: 1082-1085 +--- + **LISTING 58.1 L58-1.ASM** ; Inner loop to draw a single texture-mapped horizontal scanline in diff --git a/58-03.md b/58-03.md index 9aa0040..c752f59 100644 --- a/58-03.md +++ b/58-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '58' +pages: 1085-1089 +--- + I'd like to emphasize that algorithmically and conceptually, there is *no* difference between scanning out a polygon top to bottom and scanning it out left to right; it is only in conjunction with the diff --git a/58-04.md b/58-04.md index 56d24cc..c19d6ef 100644 --- a/58-04.md +++ b/58-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '58' +pages: 1089-1091 +--- + All of the above optimizations together get us to 10 cycles—*very* close to John Miles, but not there yet. We have one more trick up our sleeve, though: Suppose we point SS to the segment containing our textures, and diff --git a/58-05.md b/58-05.md index 7895d4e..6cfa76f 100644 --- a/58-05.md +++ b/58-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '58' +pages: 1091-1093 +--- + **LISTING 58.4 L58-4.ASM** ; Inner loop to draw a single texture-mapped vertical column, diff --git a/59-01.md b/59-01.md index f9ebacd..88aff0a 100644 --- a/59-01.md +++ b/59-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '59' +pages: 1095-1099 +--- + Chapter 59\ The Idea of BSP Trees {#Heading1} ---------------------- diff --git a/59-02.md b/59-02.md index 31de0bc..ba2148d 100644 --- a/59-02.md +++ b/59-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '59' +pages: 1099-1102 +--- + Back-to-front or front-to-back traversal in itself wouldn't be so impressive—there are many ways to do that—were it not for one additional detail: The traversal can always be performed in linear time, as we'll diff --git a/59-03.md b/59-03.md index 324277f..a203caf 100644 --- a/59-03.md +++ b/59-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '59' +pages: 1102-1106 +--- + Creating a BSP tree is a recursive process, so we'll perform the first split and go from there. Figure 59.3 shows the world carved along the line of wall C into two parts: walls that are in front of wall C, and diff --git a/59-04.md b/59-04.md index 89bce99..a61f85b 100644 --- a/59-04.md +++ b/59-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '59' +pages: 1107-1110 +--- + ### Inorder Walks of BSP Trees {#Heading8} It was implementing BSP trees that got me to thinking about inorder tree diff --git a/59-05.md b/59-05.md index 08ba387..56152ac 100644 --- a/59-05.md +++ b/59-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '59' +pages: 1110-1112 +--- + Take a few minutes to look over Listing 59.4 and relate it to Listing 59.2. The structure is different, but upon examination it becomes clear that both listings reflect the same underlying model: For each node, diff --git a/59-06.md b/59-06.md index 3d00203..bef06ee 100644 --- a/59-06.md +++ b/59-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '59' +pages: 1112-1114 +--- + Things change when maximum optimization is selected, however: The performance of the two implementations becomes virtually identical! How can this be? Part of the answer is that the compiler does an amazingly diff --git a/60-01.md b/60-01.md index 59824d5..d53d201 100644 --- a/60-01.md +++ b/60-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '60' +pages: 1115-1119 +--- + Chapter 60\ Compiling BSP Trees {#Heading1} -------------------- diff --git a/60-02.md b/60-02.md index 4baec08..89130f0 100644 --- a/60-02.md +++ b/60-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '60' +pages: 1119-1123 +--- + If you find any of the above confusing (and it would be understandable if that were the case; BSP trees are not easy to get the hang of), you might want to refer back to the previous chapter. It would also be a diff --git a/60-03.md b/60-03.md index fc2c587..6ff2631 100644 --- a/60-03.md +++ b/60-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '60' +pages: 1123-1127 +--- + **Listing 60.1 L60\_1.CPP** #define MAX_NUM_LINESEGS 1000 diff --git a/60-04.md b/60-04.md index d63b9ae..43c04f4 100644 --- a/60-04.md +++ b/60-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '60' +pages: 1127-1129 +--- + Listing 60.1 isn't very long or complex, but it's somewhat more complicated than it could be because it's structured to allow visual display of the ongoing compilation process. That's because Listing 60.1 diff --git a/61-01.md b/61-01.md index 5e6d59f..66a4334 100644 --- a/61-01.md +++ b/61-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '61' +pages: 1131-1135 +--- + Chapter 61\ Frames of Reference {#Heading1} -------------------- diff --git a/61-02.md b/61-02.md index 23a1831..a3a9c1e 100644 --- a/61-02.md +++ b/61-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '61' +pages: 1135-1138 +--- + I'll be working in a left-handed coordinate system, whereby if you wrap the fingers of your left hand around the z axis with your thumb pointing in the positive z direction, your fingers will curl from the positive x diff --git a/61-03.md b/61-03.md index 3da02f3..55c3dd6 100644 --- a/61-03.md +++ b/61-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '61' +pages: 1138-1141 +--- + Why does this matter? It matters because, on average, half the polygons in any scene are facing away from the viewer, and hence shouldn't be drawn. One way to identify such polygons is to see whether they're diff --git a/61-04.md b/61-04.md index dfa4ccd..b789643 100644 --- a/61-04.md +++ b/61-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '61' +pages: 1141-1144 +--- + ### Using the Dot Product for Projection {#Heading9} Consider Equation 3 again, but this time make one of the vectors, say diff --git a/62-01.md b/62-01.md index a4c4fea..6d33c8b 100644 --- a/62-01.md +++ b/62-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '62' +pages: 1145-1149 +--- + Chapter 62\ One Story, Two Rules, and a BSP Renderer {#Heading1} ----------------------------------------- diff --git a/62-02.md b/62-02.md index 49495a3..13fc68f 100644 --- a/62-02.md +++ b/62-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '62' +pages: 1149-1157 +--- + **Listing 62.1 L62\_1.C** /* Core renderer for Win32 program to demonstrate drawing from a 2-D diff --git a/62-03.md b/62-03.md index f741ea7..71ef943 100644 --- a/62-03.md +++ b/62-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '62' +pages: 1157-1160 +--- + #### The Rendering Pipeline {#Heading4} Conceptually rendering from a BSP tree really is that simple, but the diff --git a/62-04.md b/62-04.md index 2d2c1a9..34c8567 100644 --- a/62-04.md +++ b/62-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '62' +pages: 1160-1162 +--- + ### Walking the Tree, Backface Culling and Drawing {#Heading9} Now that we have all the walls clipped to the frustum, with vertices diff --git a/63-01.md b/63-01.md index 1eb78f4..35fe796 100644 --- a/63-01.md +++ b/63-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '63' +pages: 1163-1167 +--- + Chapter 63\ Floating-Point for Real-Time 3-D {#Heading1} --------------------------------- diff --git a/63-02.md b/63-02.md index 98037f3..addb952 100644 --- a/63-02.md +++ b/63-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '63' +pages: 1168-1170 +--- + FDIV is a painfully slow instruction, taking 39 cycles at full precision and 33 cycles at double precision, which is the default precision for Visual C++ 2.0. While FDIV executes, the FPU is occupied, and can't diff --git a/63-03.md b/63-03.md index ad268d3..a75e940 100644 --- a/63-03.md +++ b/63-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '63' +pages: 1170-1173 +--- + **Listing 63.2 1 L63-2.ASM** ; unoptimized dot product; 17 cycles diff --git a/63-04.md b/63-04.md index fb1b424..8e0760c 100644 --- a/63-04.md +++ b/63-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '63' +pages: 1173-1175 +--- + When it comes to implementation, however, transformation is quite different from three separate dot products and additions, because once again the magic number *three* is involved. Three separate dot products diff --git a/64-01.md b/64-01.md index 7cb9751..4338190 100644 --- a/64-01.md +++ b/64-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '64' +pages: 1177-1181 +--- + Chapter 64\ Quake's Visible-Surface Determination {#Heading1} -------------------------------------- diff --git a/64-02.md b/64-02.md index 1c4085e..5fdcd42 100644 --- a/64-02.md +++ b/64-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '64' +pages: 1181-1185 +--- + ### The Structure of Quake Levels {#Heading4} Before diving into VSD, let me note that each Quake level is stored as a diff --git a/64-03.md b/64-03.md index 6e60d6d..59c8215 100644 --- a/64-03.md +++ b/64-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '64' +pages: 1185-1188 +--- + ### The Beam Tree {#Heading8} John's original Quake design was to draw front-to-back, using a second diff --git a/64-04.md b/64-04.md index 05a7381..724a10b 100644 --- a/64-04.md +++ b/64-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '64' +pages: 1188-1190 +--- + When I came in on Monday, John had the look of a man who had broken through to the other side—and also the look of a man who hadn't had much sleep. He had worked all weekend on the direct-BSP approach, and had diff --git a/65-01.md b/65-01.md index 6b8ae70..2a6bfd2 100644 --- a/65-01.md +++ b/65-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '65' +pages: 1191-1195 +--- + Chapter 65\ 3-D Clipping and Other Thoughts {#Heading1} -------------------------------- diff --git a/65-02.md b/65-02.md index 37e19e0..a7369be 100644 --- a/65-02.md +++ b/65-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '65' +pages: 1195-1199 +--- + #### Intersecting a Line Segment with a Plane {#Heading4} The fundamental 3-D clipping operation is clipping a line segment to a diff --git a/65-03.md b/65-03.md index 1cb487a..90bca82 100644 --- a/65-03.md +++ b/65-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '65' +pages: 1199-1206 +--- + **LISTING 65.2 L65\_2.c** int ClipToPlane(polygon_t *pin, plane_t *pplane, polygon_t *pout) diff --git a/65-04.md b/65-04.md index bbbfe9a..93befbb 100644 --- a/65-04.md +++ b/65-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '65' +pages: 1206-1208 +--- + #### The Lessons of Listing 65.3 {#Heading7} There are several interesting points to Listing 65.3. First, diff --git a/66-01.md b/66-01.md index 608e849..dd33bd2 100644 --- a/66-01.md +++ b/66-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '66' +pages: 1209-1213 +--- + Chapter 66\ Quake's Hidden-Surface Removal {#Heading1} ------------------------------- diff --git a/66-02.md b/66-02.md index 2210a65..86b7aec 100644 --- a/66-02.md +++ b/66-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '66' +pages: 1213-1217 +--- + As you may recall from Chapter 64, we're concerned with both raw performance and level performance. That is, we want the drawing code to run as fast as possible, but we also want the difference in drawing diff --git a/66-03.md b/66-03.md index bf3a505..b1bf598 100644 --- a/66-03.md +++ b/66-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '66' +pages: 1217-1220 +--- + For each scan line, a z-sorted active polygon list (APL) is maintained. The x-sorted AEL is stepped through in order. As each new edge is encountered (that is, as each polygon starts or ends as we move left to diff --git a/66-04.md b/66-04.md index 7b8d92b..51237f6 100644 --- a/66-04.md +++ b/66-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '66' +pages: 1221-1222 +--- + The obvious way to get a 1/z value at any arbitrary point on a polygon is to calculate 1/z at the vertices, interpolate it down both edges of the polygon, and interpolate between the edges to get the value at the diff --git a/67-01.md b/67-01.md index 3bf543d..fe1e4c3 100644 --- a/67-01.md +++ b/67-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '67' +pages: 1223-1227 +--- + Chapter 67\ Sorted Spans in Action {#Heading1} ----------------------- diff --git a/67-02.md b/67-02.md index 364dd3a..acc3b91 100644 --- a/67-02.md +++ b/67-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '67' +pages: 1227-1230 +--- + And then yet another crop of sorting errors popped up. We could have fixed those errors too; we'll take a quick look at how to diff --git a/67-03.md b/67-03.md index 4f091b7..9edab65 100644 --- a/67-03.md +++ b/67-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '67' +pages: 1230-1238 +--- + #### Independent Span Sorting {#Heading7} Finally, we come to independent span sorting, the simplest and fastest diff --git a/67-04.md b/67-04.md index 56af441..e104d2f 100644 --- a/67-04.md +++ b/67-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '67' +pages: 1238-1239 +--- + By the same token, Listing 67.1 is quite a bit more complicated than the earlier code. The earlier code's HSR consisted of a z-sort of objects, followed by the drawing of the objects in back-to-front order, one diff --git a/67-05.md b/67-05.md index 5a31768..28b2d1a 100644 --- a/67-05.md +++ b/67-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '67' +pages: 1239-1241 +--- + #### Implementation Notes {#Heading9} Finally, a few notes on Listing 67.1. First, you'll notice that although diff --git a/68-01.md b/68-01.md index 37e8091..f8d29ae 100644 --- a/68-01.md +++ b/68-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '68' +pages: 1243-1247 +--- + Chapter 68\ Quake's Lighting Model {#Heading1} ----------------------- diff --git a/68-02.md b/68-02.md index 28c1815..8e65f61 100644 --- a/68-02.md +++ b/68-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '68' +pages: 1247-1251 +--- + A primary problem with Gouraud shading is that it requires the vertices used for world geometry to serve as lighting sample points as well, even though there isn't necessarily a close relationship between lighting and diff --git a/68-03.md b/68-03.md index 3f339cd..3a4fd22 100644 --- a/68-03.md +++ b/68-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '68' +pages: 1251-1254 +--- + Quake's approach, which I'll call surface-based lighting, preprocesses differently, and adds an extra rendering step. During off-line preprocessing, a grid, called a light map, is calculated for each diff --git a/68-04.md b/68-04.md index 308a24b..c0ea3c8 100644 --- a/68-04.md +++ b/68-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '68' +pages: 1254-1256 +--- + The amount of memory required for surface caching looked forbidding at first. Surfaces are large relative to texture tiles, because every texel of every surface is unique. Also, a surface can contain many texels diff --git a/69-01.md b/69-01.md index 349121b..5298eb0 100644 --- a/69-01.md +++ b/69-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '69' +pages: 1257-1261 +--- + Chapter 69\ Surface Caching and Quake's Triangle Models {#Heading1} -------------------------------------------- diff --git a/69-02.md b/69-02.md index 4a1f4ad..a4dc6b9 100644 --- a/69-02.md +++ b/69-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '69' +pages: 1261-1263 +--- + #### Letting the Graphics Card Build the Textures {#Heading4} One obvious solution is to have the accelerator card build the textures, diff --git a/69-03.md b/69-03.md index bfdc920..4cef3e9 100644 --- a/69-03.md +++ b/69-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '69' +pages: 1263-1266 +--- + Triangle models are stored quite differently from the world itself. Each model consists of front and back skins stretched around a triangle mesh, and contains a full set of vertex coordinates for each animation frame, diff --git a/69-04.md b/69-04.md index 6e15500..668b0c1 100644 --- a/69-04.md +++ b/69-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '69' +pages: 1266-1271 +--- + Once the vertices are drawn, the triangles are processed one at a time. Each triangle that makes it through backface culling is then drawn with recursive subdivision. If any of the triangle's sides is more than one diff --git a/70-01.md b/70-01.md index 50ac42b..4512c28 100644 --- a/70-01.md +++ b/70-01.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '70' +pages: 1273-1277 +--- + Chapter 70\ Quake: A Post-Mortem and a Glimpse into the Future {#Heading1} --------------------------------------------------- diff --git a/70-02.md b/70-02.md index f585564..5bae907 100644 --- a/70-02.md +++ b/70-02.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '70' +pages: 1277-1279 +--- + Getting proper front-to-back drawing order is a little more complicated with polygons on nodes. As we walk the BSP tree front-to-back, in each leaf we mark the polygons that are at least partially in that leaf, and diff --git a/70-03.md b/70-03.md index c1947c3..7192895 100644 --- a/70-03.md +++ b/70-03.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '70' +pages: 1279-1281 +--- + ### Passages: The Last-Minute Change that Didn't Happen {#Heading4} Earlier, I mentioned that we almost changed 3-D engines again in the diff --git a/70-04.md b/70-04.md index 7dc1166..55ed4a8 100644 --- a/70-04.md +++ b/70-04.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '70' +pages: 1281-1284 +--- + The edge list is an atypical technology for John; it's an extra stage in the engine, it's complex, and it doesn't scale well. A Quake level might have a maximum of 500 potentially drawable polygons that get placed into diff --git a/70-05.md b/70-05.md index 24c196e..bb1150d 100644 --- a/70-05.md +++ b/70-05.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '70' +pages: 1284-1286 +--- + ### Entities {#Heading9} So far, all we've drawn is the static, unchanging (apart from dynamic diff --git a/70-06.md b/70-06.md index f31b134..b5418b2 100644 --- a/70-06.md +++ b/70-06.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '70' +pages: 1286-1288 +--- + #### The Subdivision Rasterizer {#Heading12} This rasterizer, which we call the *subdivision rasterizer*, first draws diff --git a/70-07.md b/70-07.md index 8a2a74c..9282369 100644 --- a/70-07.md +++ b/70-07.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '70' +pages: 1288-1291 +--- + #### GLQuake {#Heading17} The second (and, according to current plans, last) port of Quake to a diff --git a/70-08.md b/70-08.md index ce4f477..a92a0e9 100644 --- a/70-08.md +++ b/70-08.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '70' +pages: 1291-1293 +--- + From the beginning, Quake was conceived as a client-server app, specifically so that it would be possible to have persistent servers always running on the Internet, independent of whether anyone was diff --git a/70-09.md b/70-09.md index 428aed1..7553cfb 100644 --- a/70-09.md +++ b/70-09.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '70' +pages: 1293-1285 +--- + Also, the moving sky texture will probably be gone or will change. One likely replacement is an enclosing texture-mapped box around the world, at a virtually infinite distance; this will allow open vistas, much like diff --git a/about.md b/about.md index e8ccf74..c37ea1c 100644 --- a/about.md +++ b/about.md @@ -1,3 +1,13 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +--- + Foreword {#Heading1} -------- diff --git a/about_author.md b/about_author.md index f997f1a..b236d90 100644 --- a/about_author.md +++ b/about_author.md @@ -1,3 +1,13 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +--- + Acknowledgments {#Heading1} --------------- diff --git a/appendix-a.md b/appendix-a.md index 0e347f4..8fc11ff 100644 --- a/appendix-a.md +++ b/appendix-a.md @@ -1,3 +1,13 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +--- + Afterword {#Heading1} --------- diff --git a/book-index.md b/book-index.md index e0cf16e..2b49cd4 100644 --- a/book-index.md +++ b/book-index.md @@ -1,3 +1,13 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +--- + Index {#Heading1} ----- diff --git a/index.md b/index.md index 1a3d764..94a1dfc 100644 --- a/index.md +++ b/index.md @@ -1,3 +1,15 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +chapter: '0' +pages: '0' +--- + Michael Abrash's Graphics Programming Black Book Special Edition ---------------------------------------------------------------- diff --git a/intro.md b/intro.md index f46c8b9..b855db3 100644 --- a/intro.md +++ b/intro.md @@ -1,3 +1,13 @@ +--- +title: Michael Abrash's Graphics Programming Black Book, Special Edition +author: Michael Abrash +date: '1997-07-01' +isbn: '1576101746' +publisher: The Coriolis Group +category: 'Web and Software Development: Game Development,Web and Software Development: + Graphics and Multimedia Development' +--- + Introduction {#Heading1} ------------