+/* video peripheral IO */
+#define IO_DISPLAY_CTRL 0x00
+#define IO_BG_PAL 0x01
+#define IO_CUR_LINE 0x02
+#define IO_LINE_COMP 0x03
+#define IO_SPR_TABLE 0x04
+#define IO_SPR_START 0x05
+#define IO_SPR_STOP 0x06
+#define IO_FGBG_MAP 0x07
+#define IO_FG_WIN_X0 0x08
+#define IO_FG_WIN_Y0 0x09
+#define IO_FG_WIN_X1 0x0A
+#define IO_FG_WIN_Y1 0x0B
+#define IO_SPR_WIN_X0 0x0C
+#define IO_SPR_WIN_Y0 0x0D
+#define IO_SPR_WIN_X1 0x0E
+#define IO_SPR_WIN_Y1 0x0F
+#define IO_BG_X 0x10
+#define IO_BG_Y 0x11
+#define IO_FG_X 0x12
+#define IO_FG_Y 0x13
+#define IO_LCD_CTRL 0x14
+#define IO_LCD_ICONS 0x15
+
+/* settings */
+#define BG_ON 0x01
+#define BG_OFF 0x00
+#define FG_ON 0x02
+#define FG_OFF 0x00
+#define SPR_ON 0x04
+#define SPR_OFF 0x00
+#define SPR_WIN_ON 0x08
+#define SPR_WIN_OFF 0x00
+#define FG_IN_OUT_WIN 0x00
+#define FG_IN_WIN 0x10
+#define FG_OUT_WIN 0x30
+#define BG_COLOR(a) (a)
+#define BG_PAL(a) (a << 4)
+#define SPR_TABLE(a) (a >> 9) /* Sprite Table Address must be 512 bytes aligned */
+#define FG_MAP(a) ((a >> 11) << 4) /* FG Map Address must be 2048 bytes aligned */
+#define BG_MAP(a) (a >> 11) /* BG Map Address must be 2048 bytes aligned */
+
+#define IO_VIDEO_MODE 0x60
+#define VMODE_16C_CHK 0xE0 /* 16 colors per tile chunky mode */
+#define VMODE_16C_PLN 0xC0 /* 16 colors per tile planar mode */
+#define VMODE_4C 0x40 /* 4 colors per tile color */
+#define VMODE_4C_MONO 0x00 /* 4 colors per tile mono */
+#define VMODE_CLEANINIT 0x0C /*(?) from FF2 */
+
+#define LCD_ON 0x01
+#define LCD_OFF 0x00
+
+#define LCD_ICON_SLEEP 0x01
+#define LCD_ICON_VERTI 0x02
+#define LCD_ICON_HORIZ 0x04
+#define LCD_ICON_DOT1 0x08
+#define LCD_ICON_DOT2 0x10
+#define LCD_ICON_DOT3 0x20
+
+/* PAL modes */
+#define IO_PALSHADE_10 0x1C
+#define IO_PALSHADE_32 0x1D
+#define IO_PALSHADE_54 0x1E
+#define IO_PALSHADE_76 0x1F
+#define IO_WS_PAL_00 0x20
+#define IO_WS_PAL_01 0x21
+#define IO_WS_PAL_10 0x22
+#define IO_WS_PAL_11 0x23
+#define IO_WS_PAL_20 0x24
+#define IO_WS_PAL_21 0x25
+#define IO_WS_PAL_30 0x26
+#define IO_WS_PAL_31 0x27
+#define IO_WS_PAL_40 0x28
+#define IO_WS_PAL_41 0x29
+#define IO_WS_PAL_50 0x2A
+#define IO_WS_PAL_51 0x2B
+#define IO_WS_PAL_60 0x2C
+#define IO_WS_PAL_61 0x2D
+#define IO_WS_PAL_70 0x2E
+#define IO_WS_PAL_71 0x2F
+#define IO_WS_PAL_80 0x30
+#define IO_WS_PAL_81 0x31
+#define IO_WS_PAL_90 0x32
+#define IO_WS_PAL_91 0x33
+#define IO_WS_PAL_A0 0x34
+#define IO_WS_PAL_A1 0x35
+#define IO_WS_PAL_B0 0x36
+#define IO_WS_PAL_B1 0x37
+#define IO_WS_PAL_C0 0x38
+#define IO_WS_PAL_C1 0x39
+#define IO_WS_PAL_D0 0x3A
+#define IO_WS_PAL_D1 0x3B
+#define IO_WS_PAL_E0 0x3C
+#define IO_WS_PAL_E1 0x3D
+#define IO_WS_PAL_F0 0x3E
+#define IO_WS_PAL_F1 0x3F