|
楼主 |
发表于 2013-7-18 15:25:31
|
显示全部楼层
nbzwt 发表于 2013-7-18 11:43
prizm的程序发下,我实体机测试下 - #include <display.h>
- extern void WaitFor( unsigned int );
- typedef unsigned short word;
- #define RGB16(r,g,b) (((word)(r>>3))<<11 | ((word)(g>>2))<<5 | ((word)(b>>3)))
- void* GetVRAMAdress()
- {
- asm("mov.l syscall_adress, r2\n"
- "mov.l getVRAM, r0\n"
- "jmp @r2\n"
- "nop\n"
- "syscall_adress: .long 0x80020070\n"
- "getVRAM: .long 0x01E6");
- }
- void FillVRAM(short color)
- {
- int i, color32, *VRAM = GetVRAMAdress();
- color32 = (color<<16) | color;
- for(i=LCD_WIDTH_PX*LCD_HEIGHT_PX/2 ; i ; i--)
- *(VRAM++) = color32;
- }
- void SetPixel(int x,int y,unsigned short color)
- {
- unsigned short * VRAM = GetVRAMAdress();
- VRAM += LCD_WIDTH_PX * y + x;
- *(VRAM) = color;
- }
- int key_down(int basic_keycode)
- {
- const unsigned short* keyboard_register = (unsigned short*)0xA44B0000;
- int row, col, word, bit;
- row = basic_keycode%10;
- col = basic_keycode/10-1;
- word = row>>1;
- bit = col + ((row&1)<<3);
- return (0 != (keyboard_register[word] & 1<<bit));
- }
- int main ()
- {
- int r,g,b;
-
- FillVRAM(0xFFFF);
-
- for (g=0;g<256;++g)
- for(r=255,b=0;b<240;++b,--r)
- SetPixel(g,b,RGB16(r,g,b));
-
- Bdisp_PutDisp_DD();
- while(!key_down(31));
-
- return 0;
- }
复制代码 key_down在模拟器上好像没法正常工作..所以做好捅菊花的准备..
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|