Элита
Регистрация: 16.01.2010
Адрес: Новосибирск
Сообщений: 2,158
Написано 502 полезных сообщений (для 1,012 пользователей)
|
Где ошибка,хелп...

//#include "libgame.h"
#define NULL (void*)0
extern void **ftab;
#define COLOR_ROP_TRANSP 0xcc // transparency
#define COLOR_ROP_NOP 0xf0 // nop - just paint
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
typedef unsigned long long uint64_t;
int chars[]={
1,1,1,1,1,1,1,1, //пробел
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
0,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1
};
typedef struct gfx_rect {
uint16_t x, y;
uint16_t width, height;
} gfx_rect_t;
typedef struct key_data {
uint32_t key1;
uint32_t key2;
} key_data_t;
void (*dprintf)(char *fmt, ...);
//int (*gfx_init)();
int (*gfx_init)(void *buffer, int buffsize);
int (*gfx_set_framebuffer)(int width, int height);
int (*gfx_set_display_screen)(gfx_rect_t *rect);//int with, int height);
int (*gfx_set_cammmode)(int mode);
int (*gfx_set_fgcolor)(uint32_t *color);
uint32_t (*gfx_get_fgcolor)();
int (*gfx_set_colorrop)(uint32_t rop);
int (*gfx_fillrect)(gfx_rect_t *rect);
int (*gfx_enable_feature)(uint32_t feature);
int (*gfx_flush)();
int (*gfx_paint)();
uint32_t (*get_time)(); // returns system ticks equivalent
void (*get_keys)(key_data_t *keys);//uint64_t *keys);
#define FUNC(n) *(ftab + (n >> 2))
#define MAKE_RGB(r, g, b) (r & 0xff) | ((g & 0xff) << 8) | ((b & 0xff) << 16);
int i,n;
int main()
{
int i;
gfx_rect_t rect;
uint32_t color;
uint16_t fbuff[320*240];
key_data_t keys, no_keys;
// setup function pointers
dprintf = FUNC(0x04);
gfx_init = FUNC(0x38);
gfx_set_framebuffer = FUNC(0x90);
gfx_set_display_screen= FUNC(0x54);
gfx_set_cammmode = FUNC(0x8c);
gfx_set_colorrop = FUNC(0x3c);
gfx_set_fgcolor = FUNC(0x44);
gfx_get_fgcolor = FUNC(0x48);
gfx_fillrect = FUNC(0xc4);
gfx_enable_feature = FUNC(0x7c);
gfx_flush = FUNC(0xc);
gfx_paint = FUNC(0x10);
get_time = FUNC(0x124);
get_keys = FUNC(0x100);
// dprintf("Hello World!\n");эт нихрена не пашет,своё делаю..
gfx_init(fbuff, sizeof(fbuff));
rect.x = 0;
rect.y = 0;
rect.width = 320;
rect.height = 240;
gfx_set_framebuffer(320,240);
gfx_set_display_screen(&rect);//320, 240);
for(i=0;i<8;i++){
for(n=0;n<8;n++){
rect.x = 20+i;
rect.y = 20+n;
rect.width = 1;
rect.height = 1;
if(chars[i*n]==1 )color = MAKE_RGB(255,255,255);
if(chars[i*n]==0 )color = MAKE_RGB(0,255,255);
gfx_set_fgcolor(&color);
gfx_set_colorrop(COLOR_ROP_NOP);
gfx_fillrect(&rect);
}
}
gfx_set_colorrop(COLOR_ROP_NOP);
gfx_flush();
gfx_paint();
get_keys(&no_keys);
// no_keys.key2 &= ~0x5ff0;
while (1) {
get_keys(&keys);
// keys.key2 &= ~0x5ff0;
if (keys.key2!=no_keys.key2) break;
}
return 0;
}
(код на процессор spmp8000).
должен рисовать на экране пмп квадрат 8*8 толщиной линии в 1 пиксель,х*ею какую-то рисует типа
11111111
1111100
1110000
1100000
(типо так,картинку не могу...мелко очень)
где косяк?и ещё,у кого-нить есть набор символо аск2 в текстовом(как ниже)
int chars[]={
0,0,0,0,0,0,0,0,//пробел
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,1,1,0,0,0,//!
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,1,1,0,1,1,0,0,//"
0,1,1,0,1,1,0,0,
0,1,0,0,1,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0
};
,а то все символы как-то руками не пркол
|