Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Peter Norton Programmer's Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  You can describe the screen display created by IBM video subsystems as a
  memory-mapped display, because each address in the display memory
  corresponds to a specific location on the screen. (See Figure 4-1.) The
  display circuitry repeatedly reads information from memory and places it
  on the screen. The information can be changed as quickly as the computer
  can write new information from your programs into memory. The display
  circuitry translates the stream of bits it receives from memory into
  bursts of light at particular locations on the screen.

                   +-----------------------------------------+
                   | +-------------------------------------+ |
                   | | .. ...  . .... .... ... Pixels or   | |
                   | |                         characters  | |
                   | |                         on screen   | |
                   | |                                     | |
                   | |                                     | |
                   | |                                     | |
                   | |                                     | |
                   | |                                     | |
                   | |                                     | |
                   | +-------------------------------------+ |
                   +-----------------------------------------+
                                      .  .
                                      |  |
  +---------------------------------------------------------------------------+
  |#|#| |#|#|#| | |#| |#|#|#|#| |#|#|#|#| |#|#|#| | | | | | | | | | | | | | | |
  +---------------------------------------------------------------------------+
                            Successive locations in RAM

  Figure 4-1.  The memory-mapped display.

  These dots of light are called pixels and are produced by an electron beam
  striking the phosphorescent surface of the CRT. The electron beam is
  produced by an electron gun that scans the screen line by line. As the gun
  moves across and down the screen in a fixed path called a raster scan, the
  video subsystem generates video control signals that turn the beam on and
  off, matching the pattern of the bits in memory.

  The video circuitry refreshes the screen between 50 and 70 times a second
  (depending on the video mode), making the changing images appear clear and
  steady. At the end of each screen-refresh cycle, the electron beam must
  move from the bottom right corner to the top left corner of the screen to
  begin a new cycle. This movement is called the vertical retrace. During
  the retrace, the beam is blanked and no pixels are written to the screen.

  The vertical retrace period (about 1.25 milliseconds) is important to
  programmers for one main reason, which requires some explanation. The
  special dual-ported design of the video memory gives the CPU and the
  display-refresh circuitry equal access to the display memory. This allows
  the CPU and the display circuitry to access video memory at the same time.

  This causes a problem on the Color Graphics Adapter (CGA). If the CPU
  happens to read or write to the video buffer at the same time the display
  circuitry is copying data out of the buffer to display onscreen, a "snow"
  effect may briefly appear on the screen. However, if you instruct the CPU
  to access memory only during vertical retrace, when the display circuitry
  is not accessing the video buffer, then snow can be eliminated. A program
  running on a CGA can test the value of bit 3 in the adapter's I/O port at
  3DAH. This bit is set on at the beginning of vertical retrace and then set
  off at the end. During this 1.25-millisecond pause, you can have your
  programs write as much data as possible to the video display memory. At
  the end of the retrace, the display circuitry can write this data to the
  screen without snow.

  This technique is useful for any application that directly accesses data
  in the video buffer in text mode on a CGA. Fortunately, the hardware
  design of all other IBM video subsystems avoids this access conflict and
  makes this specialized programming technique unnecessary.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson