#include <stdio.h>
char *opcodes[] = {
"line_open",
"autoline_open",
"line_close",
"autoline_close",
"trapezoid",
"trapezoid texture map",
"reserved trap",
"reserved trap",
"bitblt",
"iload",
"reserved",
"reserved",
"fbitblt",
"iload scale",
"reserved",
"iload filter"
};
char *atype[] = {
"rpl - Write (Replace)",
"rstr - read-modify-write (raster)",
"reserved",
"z1 - depth mode with gouraud",
"blk - block write mode",
"reserved",
"reserved",
"I - Gouraud (with depth compare)"
};
char *zmode[] = {
"NOZCMP - always",
"reserved",
"ZE - depth =",
"zne - depth !=",
"zlt",
"zlte",
"zgt",
"zgte"
};
char *bop[] = {
"0",
"~(D|S)",
"D & ~S",
"~S",
"(~D) & S",
"~D",
"D ^ S",
"~ (D & S)",
"D & S",
"~(D^S)",
"D",
"D | ~S",
"S",
"(~D) | S",
"D | S",
"1"
};
char *bitmod[] = {
"BMONOLEF - Source is mono, or if iload, source is little endian",
"BPLAN - source is mono from one plane",
"BFCOL - source is colour, and is formatted from host",
"BU32BGR - source is colour. For ILOAD, it's in 32bpp, BGR format",
"BMONOWEF - source is mono, or if iload, source is windows format",
"error! no such mode",
"error! no such mode",
"BU32RGB - source is colour, or if iload, source is 32 bpp RGB",
"error! no such mode",
"error! no such mode",
"error! no such mode",
"BU24BGR - source is colour, of if iload, source is 24 bpp BGR",
"error! no such mode",
"error! no such mode",
"BUYUV - source is color, or for ILOAD, it's in 4:2:2 YUV format",
"BU24RGB - source is color, or for ILOAD, it's in 24 bpp RGB"
};
main(argc, argv)
int argc;
char *argv[];
{
unsigned long val, tmp;
if ( argc != 2 )
{
fprintf(stderr, "usage: %s hexval\n", argv[0]);
return 1;
}
val = strtoul(argv[1], NULL, 16);
printf("the val is : %d\n", val);
tmp = val & 0x0f;
printf("opcode: %s\n", opcodes[tmp]);
tmp = ( val >> 4 ) & 0x7;
printf("atype: %s\n", atype[tmp]);
if ( val & 128 )
printf("xy bitblt\n");
else
printf("linear bitblt\n");
tmp = ( val >> 8 ) & 7;
printf("zmode: %s\n", zmode[tmp]);
if ( val & ( 1 << 11 ) )
printf("solid line or constant trapezoid\n");
else
printf("src0 - 3 may need to be loaded");
if ( val & ( 1 << 12 ))
printf("ar0-ar6 = 0\n");
else
printf("you may need to set ar0-6.\n");
if ( val & ( 1 << 13 ))
printf("sgn = 0\n");
else
printf("sgn is not affected\n");
if ( val & ( 1 << 14 ))
printf("shift = 0\n");
else
printf("shift is not affected\n");
tmp = (val>>16) & 0x0f;
if ( ((val >> 4) & 7) == 4 && tmp != 0x0c )
printf("Error! Block (BLK) atype and non-source binary op chosen. Replace (S) bop will be used.\n");
printf("bop = %s, where ~ = bitwise complement, ^ = xor\n", bop[tmp]);
if ( ((val >> 20) & 0x0f) == 0 )
printf("opaque object\n");
else
printf("partially opaque object\n");
tmp = (val >> 25) & 0x0f;
printf("bitmod: %s\n", bitmod[tmp]);
if ((val >> 29) & 0x01)
printf("patterning enabled\n");
else
printf("patterning disabled\n");
if ((val >> 30) & 0x01)
printf("background colour is transparent\n");
else
printf("background colour is opaque\n");
return 0;
}