$CPU 8086 ' make compatible with XT systems $LIB ALL OFF ' turn off all PowerBASIC libraries $ERROR ALL OFF ' turn off all PowerBASIC error checking $OPTIMIZE SIZE ' optimize for smaller code $COMPILE UNIT ' compile to a UNIT (.PBU) '$COMPILE EXE ' compile to a UNIT (.PBU) DEFINT A-Z ' Required for all numeric functions, forces PB to not ' include floating point in UNIT (makes it smaller) '/*------------------------------------------------------------------*/ $CODE SEG "MLIB1" '/*------------------------------------------------------------------*/ ' GETFB ATTR,CF,CB ' Get foregournd and Backgound color numbers in true IBM format. ' Returns a true foreground (CF) and background (CB) consistent ' with IBM's design. CF may be 0-15 and BC 0-15. ' EXAMPLE: GETFB 112,CF,CB CF = 0 CB = 7 ' GETFB 31,CF,CB CF = 15 CB = 1 ' NOTE: If you examine how IBM set up the attributes, the first ' hex character is the foreground color and the second ' hex character is the backgournd color. Hence this is ' why I wrote this routine. It provides consistency with ' the real Video attribute design and makes calculations ' easier. See MKTATTR '/*------------------------------------------------------------------*/ SUB GETFB(ATTR,CF,CB) PUBLIC CF = (ATTR MOD 16) CB = (((ATTR - CF) / 16) MOD 128) END SUB '/*------------------------------------------------------------------*/ FUNCTION MKTATTR(CF,CB) PUBLIC AS INTEGER FUNCTION = (CB*16)+CF END FUNCTION '/*------------------------------------------------------------------*/ ' $INCLUDE "C:\CODE\MLIB\MLIB.INC" ' GETFB 31,FC,BC ' SAY 10,1,STR$(112)+STR$(FC)+STR$(BC),31 ' Y$ = GETKEY '/*------------------------------------------------------------------*/