$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) DEFINT A-Z ' Required for all numeric functions, forces PB to not ' include floating point in UNIT (makes it smaller) '/*------------------------------------------------------------------*/ $CODE SEG "MLIB1" '/*------------------------------------------------------------------*/ ' CALCBYTE ATTR,FCOLOR,BCOLOR ' Returns the forground and background color numbers calculated ' from ATTR. ' EXAMPLE: CALCBYTE 112,FCOLOR,BCOLOR ' ' See MKATTR, RATTR '/*------------------------------------------------------------------*/ SUB CALCBYTE(ATTR%,FCOLOR%,BCOLOR%) PUBLIC XN = ATTR% CF = (XN MOD 16) CB = (((XN - CF) / 16) MOD 128) IF CB > 7 THEN CB = CB - 8 CF = CF + 16 END IF FCOLOR% = CF BCOLOR% = CB END SUB