home *** CD-ROM | disk | FTP | other *** search
- '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- '% (C) 1987 HUMBLEWARE Custom Programming Author: Lawrence A. Westhaver %
- '% 247 Paul Martin Drive, Baltimore MD 21227 (301) 799-1975 %
- '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- '% %
- '% FILENAME: TRANSA2A.SUB LAST UPDATE: 05-24-1987 %
- '% %
- '% DESCRIPTION: Translates an ATTRIBUTE value used by many video interupt %
- '% calls to an ANSI color control string used by ANSI.SYS %
- '% %
- '% CALL: CALL TRANSA2A(ATTR%,ANSI$) %
- '% %
- '% INPUTS: ATTR% = Attribute value (0-255). %
- '% %
- '% OUTPUTS: ANSI$ = ANSI.SYS compatible color control string %
- '% %
- '% NOTE: If the attribute value is out of range, the foreground %
- '% color will be returned as white (37) and the background %
- '% color will be returned as black (40). %
- '% %
- '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
- SUB TRANSA2A(ATTR%,ANSI$) Static
-
-
- 'initialize ansi color control strings
-
- DIM FG$(7), BG$(7)
-
- FG$(0)="30m" : BG$(0)="40;"
- FG$(1)="34m" : BG$(1)="44;"
- FG$(2)="32m" : BG$(2)="42;"
- FG$(3)="36m" : BG$(3)="46;"
- FG$(4)="31m" : BG$(4)="41;"
- FG$(5)="35m" : BG$(5)="45;"
- FG$(6)="33m" : BG$(6)="43;"
- FG$(7)="37m" : BG$(7)="47;"
-
-
- 'initialize temporary vars
-
- FG%=0 : BG%=0
-
-
- 'check attribute for out of range
-
- IF ATTR% < 0 OR ATTR% > 255 THEN
- ANSI$=CHR$(27)+"[0;40;37m"
- EXIT SUB
- END IF
-
-
- 'initialize ansi color control string
-
- ANSI$=CHR$(27)+"[0;"
-
-
- 'if blink then add blink code to string
-
- IF (ATTR% AND 128) THEN
- ANSI$=ANSI$+"5;"
- END IF
-
-
- 'determine background color and add to code to string
-
- IF (ATTR% AND 64) THEN
- BG%=BG%+4
- END IF
-
- IF (ATTR% AND 32) THEN
- BG%=BG%+2
- END IF
-
- IF (ATTR% AND 16) THEN
- BG%=BG%+1
- END IF
-
- ANSI$=ANSI$+BG$(BG%)
-
-
- 'if high intensity then add high intensity code to string
-
- IF (ATTR% AND 8) THEN
- ANSI$=ANSI$+"1;"
- END IF
-
-
- 'determine foreground color and add to code to string
-
- IF (ATTR% AND 4) THEN
- FG%=FG%+4
- END IF
-
- IF (ATTR% AND 2) THEN
- FG%=FG%+2
- END IF
-
- IF (ATTR% AND 1) THEN
- FG%=FG%+1
- END IF
-
- ANSI$=ANSI$+FG$(FG%)
-
-
- END SUB 'transa2a
-