#include #include #include #include #include #include "gfx.h" extern short vdih; /* calculate MFDB compatible rowstride (in number of bits) */ #define MFDB_STRIDE( w ) (((w & 15) != 0) ? (w | 15)+1 : w) /* Calculate size of an mfdb, params: Bits per pixel, Word aligned rowstride (width) as returned by MFDB_STRIDE, height in pixels */ #define MFDB_SIZE( bpp, stride, h ) ( ((stride >> 3) * h) * bpp ) /* Flags for init_mfdb function: */ #define MFDB_FLAG_STAND 0x01 #define MFDB_FLAG_ZEROMEM 0x02 #define MFDB_FLAG_NOALLOC 0x04 #ifndef WITHOUT_GFX static int logo_img[] = { 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x03c0,0x3018,0x0300,0xfe01,0x8003,0xfc00, 0x0000,0x3f00,0x01f0,0x000f,0x800f,0xff00,0x0000,0x07e0, 0x301c,0x0700,0xff01,0x8003,0xfc00,0x0000,0x3f80,0x07fc, 0x003f,0xe00f,0xff00,0x0000,0x0c28,0x321e,0x8f20,0xcba1, 0x8803,0x2a80,0x0000,0x32e0,0x0e0e,0x0070,0xf800,0xeaa0, 0x0000,0x0c54,0x311f,0x5f50,0xc5d1,0x9003,0x1540,0x0000, 0x31d0,0x1c57,0x40e1,0x7c00,0x7550,0x0000,0x0e82,0x321b, 0xbba0,0xcba9,0x8803,0x2000,0x0000,0x33e8,0x18a3,0xa0c2, 0x1e00,0x6200,0x0000,0x0740,0x3119,0xf350,0xff11,0x9003, 0xfc00,0x0000,0x3f54,0x3141,0xd184,0x0d00,0x6400,0x0000, 0x03e0,0x3218,0xe3a0,0xfe29,0x8803,0xfc00,0x0000,0x3fe8, 0x3081,0xa988,0x0c80,0x6200,0x0000,0x01f0,0x3119,0xf310, 0xc551,0x9003,0x1540,0x0000,0x31d0,0x3101,0x9190,0x0c40, 0x6400,0x0000,0x0078,0x3218,0xcb20,0xcaa1,0x8803,0x2a80, 0x3e00,0x32e8,0x3201,0x8988,0x0c80,0x6200,0x0000,0x0034, 0x3119,0x0710,0xc401,0x9003,0x1000,0x3e00,0x3164,0x1903, 0x90d0,0x1c40,0x6400,0x0000,0x0832,0x3218,0x8320,0xc801, 0x8803,0x2000,0x02a0,0x3262,0x1e07,0x08e8,0x3880,0x6200, 0x0000,0x0c71,0x3119,0x0310,0xc401,0x9003,0x1000,0x0140, 0x31e4,0x0f0e,0x1074,0x7140,0x6400,0x0000,0x0fe2,0x3218, 0x8320,0xc801,0xfe03,0xfc00,0x0000,0x3fc2,0x07fc,0x203f, 0xe280,0x6200,0x0000,0x07c5,0x3119,0x0310,0xc401,0xfe03, 0xfc00,0x0000,0x3f84,0x01f0,0x400f,0x8500,0x6400,0x0000, 0x00aa,0x0200,0x8020,0x0800,0x0aa0,0x2a80,0x0000,0x02a8, 0x002a,0x8002,0xaa00,0x0200,0x0000,0x0054,0x0101,0x0010, 0x0400,0x1540,0x1540,0x0000,0x0150,0x0015,0x0000,0x5000, 0x0400,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0112,0x4955,0x56db,0x6eff,0xffff, 0xffff,0xffff,0xff00,0x0000,0x0000,0x0000,0x0004,0x92aa, 0xda49,0x2aaa,0xa955,0xb592,0xaadb,0x7fff,0xffff,0xffa0, 0x0000,0x0000,0x0000,0x4948,0x4912,0x24aa,0xd525,0x5aaa, 0xab6d,0x776e,0xd56e,0xffff,0xff40,0x0000,0x0000,0x0012, 0x0022,0x0044,0x8524,0x92d5,0x56db,0x5dbf,0xbbbb,0xfff7, 0xdfff,0xffa0,0x0000,0x0000,0x0100,0x2481,0x2a22,0x5252, 0x4a5a,0xa955,0xb552,0xdb77,0x6edf,0xf6ff,0xff40,0x0000 }; /* real dim: 194 * 24 */ /* BITBLK LOGO = {logo_img, 26, 24, 0, 0, 1}; */ MFDB LOGO = { logo_img, 208, 24, 208 >> 4, 1, 1 }; long init_mfdb(int bpp, int w, int h, unsigned long flags, MFDB * out ) { long size; short dststride; dststride = MFDB_STRIDE( w ); size = MFDB_SIZE( bpp, dststride, h ); if( bpp > 0 ) { if( (flags & MFDB_FLAG_NOALLOC) == 0 ) { out->fd_addr = malloc( size ); if( out->fd_addr == 0 ){ return( 0 ); } if( (flags & MFDB_FLAG_ZEROMEM) ){ memset( out->fd_addr, 0, size ); } } out->fd_stand = (flags & MFDB_FLAG_STAND) ? 1 : 0; out->fd_nplanes = (short)bpp; out->fd_r1 = out->fd_r2 = out->fd_r3 = 0; } else { memset( out, 0, sizeof(MFDB) ); } out->fd_w = dststride; out->fd_h = h; out->fd_wdwidth = dststride >> 4; return( size ); } void draw_logo( short x, short y ) { short c[2] = {1, 0}; long size; MFDB screen, tran; short pxy[8]; init_mfdb( 0, LOGO.fd_w, LOGO.fd_h, 0, &screen ); size = init_mfdb( 1, LOGO.fd_w, LOGO.fd_h, MFDB_FLAG_NOALLOC, &tran ); tran.fd_addr = malloc( size ); vr_trnfm( vdih, &LOGO, &tran ); pxy[0] = 0; pxy[1] = 0; pxy[2] = LOGO.fd_w -1; pxy[3] = LOGO.fd_h -1; pxy[4] = x; pxy[5] = y; pxy[6] = x+LOGO.fd_w-1; pxy[7] = y+LOGO.fd_h-1; vrt_cpyfm( vdih, MD_TRANS, (short*)&pxy, (MFDB*)&tran, (MFDB*)&screen, (short*)&c ); } #endif #ifdef WITHOUT_VDI void print_var( char * desc, short idx ) { short laitem = *(short*)(lineavar+idx); printf("%s -> %d\r\n", desc, laitem ); } void linea_info(void) { linea_init_cf(); print_var("bpp", LINEA_BYTES_PER_ROW); print_var("h", LINEA_RES_H); print_var("w", LINEA_RES_W); print_var("fh", -0x2e); print_var("pl", 0); print_var("bs", 2); } #else #endif