(mode, colorswitch)
Get the low-level mode number used by mode switching interrupt.
Get the low-level mode number used by mode switching interrupt.
Get the low - level mode number used by mode switching interrupt .
def get_mode_number(mode, colorswitch):
    """Get the low-level mode number used by mode switching interrupt."""
    if mode.is_text_mode:
        if mode.name in ('mdatext80', 'ega_monotext80'):
            return 7
        return (mode.width == 40) * 2 + colorswitch % 2
    elif mode.name == '320x200x4':
        return 4 + colorswitch % 2 # mode_5 if colorswitch == 1
    else:
        try:
            return _MODE_NUMBER[mode.name]
        except KeyError:
            return 0xff
def get_mode_number ( mode , colorswitch ) : if mode . is_text_mode : if mode . name in ( 'mdatext80' , 'ega_monotext80' ) : return 7 return ( mode . width == 40 ) * 2 + colorswitch % 2 elif mode . name == '320x200x4' : return 4 + colorswitch % 2 # mode_5 if colorswitch == 1 else : try : return _MODE_NUMBER [ mode . name ] except KeyError : return 0xff