Codes 4 and 5 change the graphics writing mode. If the code is 4, the drawing mode is set to normal. If 5 is specified, the drawing mode is set to alternate. The graphics writing mode provides a great deal of flexibility in the generation of graphic displays. It defines the method used to modify the pixel color bits. These include clearing, setting, inclusive or, exclusive or, complementing, and anding the color bits with the complement of the current pixel color bits. It is specified by a combination of the drawing mode and the sign of the current pen number.
The writing mode of the pen is specified by the current drawing mode and the sign of the pen number. The following table defines the different writing modes available. P is a positive pen number, X is the present value of a pixel.
Statement
GESCAPE CRT,4 Normal
GESCAPE CRT,5 Alternate
PENP
P
BINIOR(X,P)
AREA PEN P
P
BINIOR(X,P)
PEN 0
BINCMP(X)*
0
AREA PEN 0
0
0
PEN -P
BINAND(X,BINCMP(P))
BINEOR(X,P)
AREA PEN -P
BINAND(X,BINCMP(P))
BINAND(X,BINCMP(P))
GESCAPE codes 4 and 5 are not supported on monochrome graphic displays such as CGA and Hercules (HGC). The following statements show how to change the graphics writing mode.