Abstract:
A method and system of displaying a pattern using a bitmap memory display which acomplishes an overall pattern display by writing to the display memory one copy of the pattern. The logical unit (LU) of the system&#39;s graphics adapter (GA) is then used to replicate the pattern throughout the bitmap memory with a reduced number of write operations from the central processing unit (CPU) to the GA.

Description:
This application is a continuation of U.S. application Ser. No. 07/244,449 filed Sept. 13, 1988, now abandoned. 
    
    
     TECHNICAL FIELD 
     This invention relates generally to a computer system for displaying information on a bitmap display and more specifically a method and apparatus for efficiently displaying patterns on a computer system. 
     BACKGROUND ART 
     The output devices of a personal computer often include a graphics adapter and a monochrome display. The graphics adapter (GA) contains a bitmap memory that is accessible by the computer&#39;s central processing unit (CPU) and the GA&#39;s CPU. Each bit in the bitmap memory corresponds to one pixel on the display screen. To display data, the GA CPU reads the bitmap memory. If a bit is 1 then the GA turns the corresponding pixel on. If a bit is 0 then the GA turns the corresponding pixel off. By changing the contents of the bitmap memory, a computer program can effect a change on the display screen. 
     To accommodate color displays the GA needs to be more sophisticated. A single bit in bitmap memory per screen pixel is not sufficient to represent more than two colors. If four colors are to be displayed, then two bits per pixel are needed; if eight colors are to be displayed, then three bits per pixel are needed; if sixteen colors are to be displayed, then four bits per pixel are needed; and so on. Each bit per pixel is conceptually considered to be in a separate plane, with a one bit per pixel bitmap maintained for each plane. FIG. 1 illustrates a bitmap with four planes. The GA CPU will read the 4 bits for each pixel from each of the four planes and turn the appropriate color on for that pixel on the screen. 
     The GA bitmap memory, is typically an 8-bit byte (a byte is a sequence of adjacent binary digits operated upon as a unit in a computer); that is, eight bits can be written to the bitmap memory at a time. To fill an entire bitmap memory in a conventional computer system, the computer CPU would generally for each plane write each byte. Thus, the total number of bytes written to the GA in a conventional system is the number of planes times the number of bytes per scan line times the number of scan lines. Such an arrangement is considered undesirable because write operations from the computer CPU to the GA are relatively time intensive, and require valuable CPU time that could be better spent on other operations. 
     DISCLOSURE OF THE INVENTION 
     It is an object of the present invention to provide a method and system of efficiently displaying patterns using a bitmap memory. 
     It is another object of the present invention to provide such a method and system that will reduce the number of times a computer&#39;s CPU must write to the GA to effect the display of the desired pattern. 
     These and other objects, which will become apparent as the invention is more fully described below, are obtained by providing an improved method and system of pattern displays. In a preferred embodiment, a system according to the present invention accomplishes an overall pattern display by writing to the display memory one copy of the pattern. The logical unit (LU) of the GA is then used to replicate the pattern throughout the bitmap memory with a reduced number of write operations from the CPU to the GA. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 illustrates a bitmap memory with four planes. 
     FIG. 2 is a schematic of a graphics adapter. 
     FIG. 3 illustrates the ESRR and SRR. 
     FIG. 4 illustrates a typical use of the LUs. 
     FIG. 5 illustrates a sample pattern. 
     FIG. 6 illustrates an area of the bitmap memory after filled in with the pattern. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     A preferred embodiment of the present invention is described below as implemented on an IBM PC or compatible computer including a typical graphics adapter (GA). To facilitate an understanding of this embodiment, the following section describes the operation of a typical GA in a personal computer system. 
     GRAPHICS ADAPTER 
     A typical color graphics adapter (GA) displays information in color based on four planes (Plane 0-Plane3) of a bitmap memory. Thus, one of sixteen colors can be displayed at each screen pixel. The GA provides several functions that allow the GA to process a byte of information that has been sent to it by the computer CPU. While the GA is processing such a byte, the computer CPU is free to execute its own instructions. This is in effect parallel processing. The GA performs several complex graphics functions that can significantly increase the speed of processing graphics information. 
     FIG. 2 is a schematic of a typical GA. (Typical GAs include IBM&#39;s Color Graphics Adapter and Enhanced Graphics Adapter). Only one byte (201) of information is transferred from the computer CPU to the GA at a time. The GA logically contains four banks of eight data selectors (DS0-DS3) (202A-202D), corresponding to one bank for each plane. Bit 0 of DS0 is referred to DS0[0]; bit 1 of DS0 is referred to as DS0[1]; and so on. A data selector (203) is a logical element with three inputs and one output. If a logical one is applied to the enable input (E) then the DS selects the 1-input to output. If a logical zero is applied to the enable input the DS selects the 0-input to output. 
     The GA contains a Set/Reset Register (SRR) (205) and an Enable Set/Reset Register (ESRR) (204). Both registers are 4 bits wide. Each bit corresponds to one of the four planes. These registers are loaded from the computer CPU. 
     The SRR, the ESRR, and the input byte are inputs for the DSs. The ESRR is logically connected to the enable inputs of the DSs. Bit 0 of the ESRR is logically connected to each enable input of DS0. (202A); bit 1 of the ESRR is logically connected to each enable input of DS1 (202B); and so on for DS2 and DS3. The SRR is logically connected of the 1-inputs of the DSs. Bit 0 of the SRR is logically connected to each 1-input of DS0 (202A); bit 1 of the SRR is logically connected to each 1-input of DS1 (202B); and so on for DS2 and DS3. The input byte (201) is logically connected to the 0-input of each DS. Bit 0 of the input byte is logically connected to the 0-input of DS0[0], DSI[0], DS2[0], and DS3[0]; bit 1 of the input byte is logically connected to the 0-input of DSI[1], DSI[1], DS2[1], and DS3[1]; and so on for the other six bits of DS0-DS4. 
     The GA contains four eight-bit latch registers (LR0-LR3) (206A-206D). Each latch register corresponds to one of the four planes. The computer CPU can instruct the GA to load the LRs registers with one byte of data from a location in the corresponding plane of the bitmap memory. 
     The GA contains four logical units (LU0-LU3) (207A-207D). Each logical unit corresponds to one of the four planes. The LUs perform logical operations (e.g., AND, OR, XOR, and data selection) on the outputs from the DSs and the LRs. The computer CPU can select the logical operation to perform. 
     The GA contains four display memory planes (Plane0-Plane3) (208A-208D). The GA writes the output of the LUs to a specified location in the corresponding plane that has its enable input set to 1. The GA contains an 4-bit Memory Mask Register (MMR) (209). Each bit corresponds to a plane. The MMR is logically connected to the enable input of the planes. Bit 0 of the MMR (MMR[0]) is logically connected to the enable input of Plane0; bit 1 of the MMR (MMR[1]) is logically connected to the enable input of Plane 1; and so on the other two planes. 
     In operation, the SRR and the ESRR are used to force the output of each bit in a DS to a 0 or 1. FIG. 3 illustrates the ESRR loaded (&#34;0100&#34;) to select, Plane2 and the SRR loaded (&#34;*0**&#34;) to force the output of each bit of DS2 to a 0. The asterisks (205) indicate that the contents do not matter (i.e., don&#39;t care) because the corresponding DS selects the data from the input byte and not from the SRR. 
     In operation, the LRs and LUs are used to update the current content of bitmap memory byte. Typically, the computer CPU directs the GA to select a logical operation and to load the LRs from a specified bitmap memory byte. The computer CPU then sends an input byte to the GA. The GA performs the logical operation on the output of the LRs and the DSs. The GA updates the specified bitmap memory, byte. FIG. 4 illustrates the performing of a logical AND operation. The computer CPU directs the LUs to perform the AND function. The computer CPU then directs the loading of the LRs from a specified byte in the bitmap memory. The LR0 of FIG. 4 has been loaded with &#34;01011100&#34; from the bitmap memory. The computer CPU then directs the loading of the input byte, which is illustrated as a &#34;01110101&#34;, which depending upon the ESRR and SRR contents, is output on DS0. The GA updates the specified byte with the output of LU0, which is the logical AND of LR0 and DS0 (&#34;01010100&#34;). All four planes can be updated depending on the contents of the MMR. 
     PATTERN FILL 
     In accordance with the method of the present invention, a system comprising a preferred embodiment fills an area of the bitmap memory with a pattern. A particular display is designated as a pattern and processed accordingly. The pattern is one byte wide by a variable number of scan lines. In a four plane bitmap memory, each pixel of the pattern can be any one of sixteen colors. 
     FIG. 5 illustrates a sample pattern. The pattern consist of four planes by one byte by a specified number of scan lines. 
     FIG. 6 illustrates the contents of an area of plane0 of the bitmap memory after the system has replicated the sample pattern in an area of five bytes by three times the number of scan lines. The system also replicates plane1 through plane3 of the pattern onto plane1 through plane3 of the bitmap memory (not shown). 
     The system replicates the pattern by first writing to the bitmap memory one copy of the pattern. In accordance with the preferred method, the pattern is written starting at the first byte of the destination area. In FIG. 6 that area is indicated as column[0] of row[0] through row[scan lines-1]. All four planes of the pattern are filled in. In an alternative embodiment, the GA may support the direct loading of the LRs from the CPU. Such support would make unnecessary this first step of replicating because its purpose is to load the LRs. 
     The system then uses a function of the LUs that causes the output of the LUs to be selected from the LRs. This is accomplished by setting a Bit Mask Register (BMR) on some GAs. The BMR is set to &#34;11111111.&#34; On the IBM EGA, however, this setting would be &#34;00000000&#34; because a 0-setting selects the LRs. 
     The system loads the byte at row[0] of column[0] for all four planes into the LRs. The system sets to MMR to &#34;1111&#34; to enable all four planes. The computer CPU then executes a write to each column of row[0]. In this preferred embodiment, the &#34;rep stosb&#34; instructions can be used to effect the move. Since the LRs holds the first byte of the pattern, the system then writes to each column of row[scan lines], then to each column of row[2 * scan lines], and so on. The effect is to replicate the first byte of the pattern to all appropriate locations in the bitmap memory. 
     The system then loads the byte at row[1] of column[0] for all four planes into the LRs. The computer CPU then executes a write to each column of row[1], then to each column of row[scan lines+1], then to each column of row[2 * scan lines+1], and so on. 
     The system repeats this process for each byte in the pattern to complete the pattern display. 
     The visual effect of updating the bitmap memory in this manner is a &#34;Venetian blind&#34; effect. As each successive byte of the pattern is moved to the bitmap memory, the pattern is filled in from top to bottom. 
     Although the present invention has been described in terms of a preferred embodiment, it is not intended that the invention be limited to this embodiment. Modifications within the spirit of the invention will be apparent to those skilled in the art. The scope of the present invention is defined by the claims which follow.