#define IBM561_ADDR_LOW 0x00
#define IBM561_ADDR_HIGH 0x01
#define IBM561_CMD 0x02
#define IBM561_CMD_FB_WAT 0x03
#define IBM561_CMD_CMAP 0x03
#define IBM561_CMD_GAMMA 0x03
#define IBM561_CONFIG_REG1 0x0001
#define CR1_MODEMASK 0xe0
#define CR1_MODE_5_1_BASIC 0x00
#define CR1_MODE_4_1_BASIC 0x20
#define CR1_MODE_4_1_EXTENDED 0x40
#define CR1_MODE_4_1_SUPER_EXT 0x60
#define CR1_MODE_5_1_30BPP 0x80
#define CR1_MODE_8_1_MODE_B 0xa0
#define CR1_MODE_4_1_30BPP 0xc0
#define CR1_MODE_8_1_MODE_A 0xe0
#define CR1_OVL_MASK 0x18
#define CR1_OVL_NONE 0x00
#define CR1_OVL_8BPP 0x08
#define CR1_OVL_16BPP 0x10
#define CR1_OVL_VARIABLE 0x18
#define CR1_WID_BITS_MASK 0x07
#define CR1_WID_0 0x00
#define CR1_WID_2 0x01
#define CR1_WID_4 0x02
#define CR1_WID_6 0x03
#define CR1_WID_8 0x04
#define IBM561_CONFIG_REG2 0x0002
#define CR2_ENABLE_VRAM_MASKING 0x20
#define CR2_ENABLE_PLL 0x10
#define CR2_ENABLE_CLC 0x08
#define CR2_PLL_REF_SELECT 0x04
#define CR2_PIXEL_CLOCK_SELECT 0x02
#define CR2_ENABLE_RGB_OUTPUT 0x01
#define IBM561_CONFIG_REG3 0x0003
#define CR3_ENABLE_INTERLACE 0x80
#define CR3_SERIAL_CLK_CTRL 0x40
#define CR3_FIELD_POLARITY 0x20
#define CR3_ENABLE_MISR 0x10
#define CR3_CURSOR_UPDATE_ASYNC 0x08
#define CR3_ENABLE_VIDEO 0x04
#define CR3_RGB 0x01
#define IBM561_CONFIG_REG4 0x0004
#define CR4_FB_SPLIT_WID_MASK 0x78
#define CR4_ENABLE_SPLIT_WID 0x04
#define CR4_SELECT_OL_WID 0x02
#define CR4_SELECT_FB_WID 0x01
#define IBM561_SYNC_CNTL 0x0020
#define SYNC_HSYNC_ENABLE 0x20
#define SYNC_HSYNC_POLARITY 0x08
#define SYNC_SYNC_ON_GREEN 0x02
#define SYNC_ENABLE_PEDESTAL 0x01
#define IBM561_PLL_VCO_DIV 0x0021
#define IBM561_PLL_REF_REG 0x0022
#define IBM561_CURS_CNTL_REG 0x0030
#define CURS_COLOR_3_TRANS 0x80
#define CURS_SEPARATE 0x40
#define CURS_OVERLAP_MASK 0x30
#define CURS_OVERLAP_XOR 0x00
#define CURS_OVERLAP_OR 0x10
#define CURS_OVERLAP_CURSOR 0x20
#define CURS_OVERLAP_XHAIR 0x30
#define CURS_XHAIR_BLINK 0x08
#define CURS_XHAIR_ENABLE 0x04
#define CURS_BLINK 0x02
#define CURS_ENABLE 0x01
#define IBM561_XHAIR_CONTROL_REG 0x0031
#define XHAIR_PRIORITY 0x80
#define XHAIR_WIDTH_MASK 0x60
#define XHAIR_WIDTH_1 0x00
#define XHAIR_WIDTH_3 0x20
#define XHAIR_WIDTH_5 0x40
#define XHAIR_WIDTH_7 0x60
#define XHAIR_CLIP_MASK 0x18
#define XHAIR_CLIP_NONE 0x00
#define XHAIR_CLIP_SCISSORS 0x08
#define XHAIR_CLIP_WINDOW 0x10
#define XHAIR_CLIP_BOTH 0x18
#define XHAIR_COLOR_MASK 0x06
#define XHAIR_EXT_PATTERN 0x01
#define IBM561_CURSOR_BLINK_RATE 0x0032
#define IBM561_CURSOR_BLINK_DUTY 0x0033
#define IBM561_HOTSPOT_REG 0x0034
#define IBM561_HOTSPOT_X_REG 0x0034
#define IBM561_HOTSPOT_Y_REG 0x0035
#define IBM561_CURSOR_X_REG 0x0036
#define IBM561_CURSOR_Y_REG 0x0038
#define IBM561_XHAIR_SCISSORS 0x0040
#define IBM561_XHAIR_LOCATION 0x0048
#define IBM561_XHAIR_PATTERN_CONTROL 0x004c
#define IBM561_XHAIR_PATTERN_HORZ 0x004d
#define IBM561_XHAIR_PATTERN_VERT 0x004e
#define IBM561_VRAM_MASK_REG 0x0050
#define IBM561_DAC_CONTROL 0x005f
#define DAC_DISABLE_OUTPUT 0x08
#define DAC_10BIT_ENABLE 0x04
#define DAC_SHUNT_ENABLE 0x02
#define DAC_SLEW_ENABLE 0x01
#define IBM561_CURSOR_LUT 0x0a10
#define IBM561_CURSOR_BITMAP 0x2000
#define IBM561_DIV_DOTCLCK 0x0082
#define IBM561_FB_WINTYPE 0x1000
#define FB_CLUT_SELECT_MASK 0x03c0
#define FB_PIXEL_FORM_MASK 0x0030
#define FB_PIXEL_8BIT 0x0000
#define FB_PIXEL_12BIT 0x0010
#define FB_PIXEL_16BIT 0x0020
#define FB_PIXEL_24BIT 0x0030
#define FB_BUFFER_SELECT 0x0008
#define FB_MODE_MASK 0x0006
#define FB_MODE_INDEXED 0x0000
#define FB_MODE_GREYSCALE 0x0002
#define FB_MODE_DIRECT 0x0004
#define FB_MODE_TRUECOLOR 0x0006
#define FB_MODE_TRANSP_ENABLE 0x0001
#define IBM561_AUXFB_WINTYPE 0x0e00
#define AUXFB_BYPASS_GAMMA 0x04
#define AUXFB_XHAIR_ENABLE 0x02
#define AUXFB_TRANSPARENT 0x01
#define IBM561_OL_WINTYPE 0x1400
#define OL_CLUT_SELECT_MASK 0x03c0
#define OL_PIXEL_FORM_MASK 0x0030
#define OL_PIXEL_8BIT 0x0000
#define OL_PIXEL_6_2BIT 0x0010
#define OL_PIXEL_4_4BIT 0x0020
#define OL_PIXEL_4_DBL 0x0030
#define OL_BUFFER_SELECT 0x0008
#define OL_MODE_MASK 0x0006
#define OL_MODE_INDEXED 0x0000
#define OL_MODE_GREYSCALE 0x0002
#define OL_MODE_INDIRECT 0x0004
#define OL_MODE_DIRECT 0x0006
#define OL_MODE_TRANSP_ENABLE 0x0001
#define IBM561_AUXOL_WINTYPE 0x0f00
#define AUXOL_TRANSP_MASK 0x21
#define AUXOL_TRANSP_00 0x00
#define AUXOL_TRANSP_FF 0x01
#define AUXOL_TRANSP_CHROMA0 0x20
#define AUXOL_TRANSP_CHROMA1 0x21
#define AUXOL_UNDERLAY_ENABLE 0x10
#define AUXOL_OVERLAY_ENABLE 0x08
#define AUXOL_BYPASS_GAMMA 0x04
#define AUXOL_XHAIR_ENABLE 0x02
#define IBM561_CMAP_TABLE 0x4000
#define IBM561_RED_GAMMA_TABLE 0x3000
#define IBM561_GREEN_GAMMA_TABLE 0x3400
#define IBM561_BLUE_GAMMA_TABLE 0x3800
#define IBM561_CHROMAKEY0 0x0010
#define IBM561_CHROMAKEY1 0x0011
#define IBM561_CHROMAKEYMASK0 0x0012
#define IBM561_CHROMAKEYMASK1 0x0013
#define IBM561_WAT_SEG_REG 0x0006
#define IBM561_NCMAP_ENTRIES 1024
#define IBM561_NGAMMA_ENTRIES 256
#define IBM561_NWTYPES 16