home *** CD-ROM | disk | FTP | other *** search
- (*
- This procedure allows the programmer to set the border color on the IBM
- Color Display from within Turbo Pascal. It seems odd to me that Turbo
- provides TextColor and TextBackground functions without supplying border
- color control. (If it is available, I haven't found it!) You may choose
- the color you want from among the 16 that IBM provides-- they are
- the same as in BASIC, and are numbered 0 (black) through F hex (high
- intensity white). In the third line of code:
-
- $B0/$01/ { MOV AL,01 }
- ^ ^
- |--------this nybble--------|
-
- is what controls the color. I have set it to "1" right now for blue, but
- it can be any of the low-intensity colors 0 through 7 or high-intensity 8
- through F hex.
-
- Eric Cohane CompuServe 75206,1117 12-Mar-85
-
- Reference: IBM PC Technical Reference (April 1983), p. 1-149.
- *)
- (*
- Procedure TurnOnBorderColor;
-
- Begin
- Inline
- ($50/ { PUSH AX ; save registers }
- $52/ { PUSH DX ; " " }
- $B0/$01/ { MOV AL,01 ; 01 is blue }
- $BA/$D9/$03/ { MOV DX,03D9H ; portaddress of 6845 CRT
- color-select register }
- $EE/ { OUT DX,AL ; send the color code }
- $5A/ { POP DX ; restore registers }
- $58); { POP AX ; " " }
- End;
- *)
- (*
- The border color can also be set by use of a variable (Thanks to Bela
- Lubkin for this one!) and be changed from within the program by the
- programmer or the user. This is coded slightly differently. A calling
- routine is provided to demonstrate its effectiveness.
- *)
-
- Program Border;
-
- var
- ColorNumber : byte;
- Ch : char;
-
- Procedure SetBorderColor(ColorNumber : byte);
-
- Begin
- Inline
- ($50/ { PUSH AX ; save registers }
- $52/ { PUSH DX ; " " }
- $8A/$86/ColorNumber/ { MOV AL,[BP + ColorNumber] }
- $BA/$D9/$03/ { MOV DX,03D9H ; portaddress of 6845 CRT
- color-select register }
- $EE/ { OUT DX,AL ; send the color code }
- $5A/ { POP DX ; restore registers }
- $58); { POP AX ; " " }
- End;
-
- Begin
- repeat
- ClrScr;
- Write('To change the border color, enter a number in [0..15]: ');
- Readln(ColorNumber);
- SetBorderColor(ColorNumber);
- Write('Enter D for Done or press another key to do it again: ');
- Read(kbd,ch);
- ch := upcase(ch);
- until (ch = 'D');
- End.