#define P9000_SYSTEM_CONFIG 0x00000004
#define SCR_PIXEL_MASK 0x1c000000
#define SCR_PIXEL_8BPP 0x08000000
#define SCR_PIXEL_16BPP 0x0c000000
#define SCR_PIXEL_24BPP 0x1c000000
#define SCR_PIXEL_32BPP 0x14000000
#define SCR_SWAP_WORDS 0x00002000
#define SCR_SWAP_BYTES 0x00001000
#define SCR_SWAP_BITS 0x00000800
#define SCR_READ_BUFFER_MASK 0x00000400
#define SCR_WRITE_BUFFER_MASK 0x00000200
#define SCR_ID_MASK 0x00000007
#define SCR_SC(sc0, sc1, sc2, sc3) \
(((sc0) << 14) | ((sc1) << 17) | ((sc2) << 20) | ((sc3) << 29))
#define P9000_INTERRUPT 0x00000008
#define P9000_INTERRUPT_ENABLE 0x0000000c
#define IER_MASTER_ENABLE 0x00000080
#define IER_MASTER_INTERRUPT 0x00000040
#define IER_VBLANK_ENABLE 0x00000020
#define IER_VBLANK_INTERRUPT 0x00000010
#define IER_PICK_ENABLE 0x00000008
#define IER_PICK_INTERRUPT 0x00000004
#define IER_IDLE_ENABLE 0x00000002
#define IER_IDLE_INTERRUPT 0x00000001
#define P9000_ALTBANK_READ 0x00000010
#define P9000_ALTBANK_WRITE 0x00000014
#define P9000_HCR 0x00000104
#define P9000_HTR 0x00000108
#define P9000_HSRE 0x0000010c
#define P9000_HBRE 0x00000110
#define P9000_HBFE 0x00000114
#define P9000_HCP 0x00000118
#define P9000_VCR 0x0000011c
#define P9000_VL 0x00000120
#define P9000_VSRE 0x00000124
#define P9000_VBRE 0x00000128
#define P9000_VBFE 0x0000012c
#define P9000_VCP 0x00000130
#define P9000_SRA 0x00000134
#define P9000_SRTC1 0x00000138
#define SRTC1_VSYNC_INTERNAL 0x00000100
#define SRTC1_HSYNC_INTERNAL 0x00000080
#define SRTC1_VIDEN 0x00000020
#define SRTC1_RESTRICTED 0x00000010
#define SRTC1_BUFFER1 0x00000008
#define P9000_QSF 0x0000013c
#define P9000_SRTC2 0x00000140
#define P9000_MCR 0x00000184
#define P9000_REFRESH_PERIOD 0x00000188
#define P9000_REFRESH_COUNT 0x0000018c
#define P9000_RASLOW_MAXIMUM 0x00000190
#define P9000_RASLOW_CURRENT 0x00000194
#define P9000_POWERUP_CONFIG 0x00000198
#define P9100_FREE_FIFO 0x00000198
#define P9100_RAMDAC_REGISTER(index) (0x00000200 + ((index) << 2))
#define P9000_PE_STATUS 0x00000000
#define STATUS_QUAD_BUSY 0x80000000
#define STATUS_BLIT_BUSY 0x40000000
#define STATUS_PICK_DETECTED 0x00000080
#define STATUS_PIXEL_ERROR 0x00000040
#define STATUS_BLIT_ERROR 0x00000020
#define STATUS_QUAD_ERROR 0x00000010
#define STATUS_QUAD_CONCAVE 0x00000008
#define STATUS_QUAD_OUTSIDE 0x00000004
#define STATUS_QUAD_INSIDE 0x00000002
#define STATUS_QUAD_STRADDLE 0x00000001
#define P9000_PE_BLIT 0x00000004
#define P9000_PE_QUAD 0x00000008
#define P9000_PE_PIXEL8 0x0000000c
#define P9000_PE_NEXTPIXELS 0x00000014
#define P9000_PE_PIXEL1(index) (0x00000080 + ((index) << 2))
#define P9000_PE_OOR 0x00000184
#define P9000_PE_INDEX 0x0000018c
#define P9000_PE_WINOFFSET 0x00000190
#define P9000_PE_WINMIN 0x00000194
#define P9000_PE_WINMAX 0x00000198
#define P9000_X_CLIPPING 0x000001a0
#define P9000_Y_CLIPPING 0x000001a4
#define P9000_X_EDGE_LESS 0x000001a8
#define P9000_X_EDGE_GREATER 0x000001ac
#define P9000_Y_EDGE_LESS 0x000001b0
#define P9000_Y_EDGE_GREATER 0x000001b4
#define P9000_DE_FG_COLOR 0x00000200
#define P9000_DE_BG_COLOR 0x00000204
#define P9100_DE_COLOR0 0x00000200
#define P9100_DE_COLOR1 0x00000204
#define P9100_DE_COLOR2 0x00000238
#define P9100_DE_COLOR3 0x0000023c
#define P9100_COLOR8(c) ((c) | ((c) << 8) | ((c) << 16) | ((c) << 24))
#define P9100_COLOR16(c) ((c) | ((c) << 16))
#define P9000_DE_PLANEMASK 0x00000208
#define P9000_DE_DRAWMODE 0x0000020c
#define DM_PICK_CONTROL 0x00000008
#define DM_PICK_ENABLE 0x00000004
#define DM_BUFFER_CONTROL 0x00000002
#define DM_BUFFER_ENABLE0 0x00000000
#define DM_BUFFER_ENABLE1 0x00000001
#define P9000_DE_PATTERN_ORIGIN_X 0x00000210
#define P9000_DE_PATTERN_ORIGIN_Y 0x00000214
#define P9000_DE_RASTER 0x00000218
#define P9100_RASTER_NO_SOLID 0x00002000
#define P9100_RASTER_PATTERN_4COLOR 0x00004000
#define P9100_RASTER_PIXEL1_TRANSPARENT 0x00008000
#define P9000_RASTER_QUAD_OVERSIZE 0x00010000
#define P9000_RASTER_QUAD_PATTERN 0x00020000
#define P9000_RASTER_SRC 0xcccc
#define P9000_RASTER_DST 0xaaaa
#define P9000_RASTER_PATTERN 0xff00
#define P9000_RASTER_MASK 0xffff
#define P9100_RASTER_SRC 0x00cc
#define P9100_RASTER_DST 0x00aa
#define P9100_RASTER_PATTERN 0x00f0
#define P9100_RASTER_MASK 0x00ff
#define P9000_DE_PIXEL8 0x0000021c
#define P9000_DE_WINMIN 0x00000220
#define P9000_DE_WINMAX 0x00000224
#define P9000_DE_PATTERN(index) (0x00000280 + ((index) << 2))
#define P9000_DE_USER(index) (0x00000290 + ((index) << 2))
#define P9100_DE_B_WINMIN 0x000002a0
#define P9100_DE_B_WINMAX 0x000002a4
#define P9000_COORD_X 0x00000008
#define P9000_COORD_Y 0x00000010
#define P9000_COORD_XY 0x00000018
#define P9000_COORD_ABS 0x00000000
#define P9000_COORD_REL 0x00000020
#define P9000_COORDS(x,y) ((((x) & 0x0fff) << 16) | ((y) & 0x0fff))
#define P9000_DC_COORD(index) (0x00001000 + ((index) * 0x40))
#define P9000_LC_POINT 0x00001200
#define P9000_LC_LINE 0x00001240
#define P9000_LC_TRI 0x00001280
#define P9000_LC_QUAD 0x000012c0
#define P9000_LC_RECT 0x00001300