2017-05-03 14:53:27 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "gr-sim.h"
|
|
|
|
|
2017-05-04 18:32:41 +00:00
|
|
|
static unsigned char title_rle[]=
|
|
|
|
{ 0x28,0x28,
|
|
|
|
0x01,0x00,0x19,0x20,
|
|
|
|
0x0F,0x00,0x01,0x22,0x03,0x66,0x01,0x22,0x01,0x62,0x01,0x66,0x01,0x62,0x01,0x22,0x01,0x66,0x03,0x22,0x01,0x66,0x01,0x26,0x01,0x62,0x01,0x22,0x01,0x62,0x01,0x26,0x01,0x62,0x01,0x22,0x03,0x66,0x01,0x22,0x01,0x55,0x01,0x00,0x03,0x11,0x01,0x44,0x03,0x22,0x01,0x44,0x03,0x22,
|
|
|
|
0x02,0x00,0x02,0x22,0x01,0x66,0x02,0x22,0x01,0x66,0x01,0x62,0x01,0x66,0x01,0x22,0x01,0x66,0x03,0x22,0x01,0x66,0x01,0x26,0x01,0x62,0x01,0x22,0x01,0x66,0x01,0x22,0x01,0x66,0x02,0x22,0x01,0x66,0x02,0x22,0x01,0x55,0x01,0x00,0x01,0x01,0x01,0x11,0x01,0x41,0x01,0x44,0x01,0x42,0x01,0x22,0x01,0x42,0x01,0x44,0x01,0x42,0x01,0x22,0x01,0x02,
|
|
|
|
0x02,0x00,0x02,0x22,0x01,0x66,0x02,0x22,0x01,0x66,0x01,0x22,0x01,0x66,0x01,0x22,0x03,0x66,0x01,0x22,0x01,0x66,0x01,0x62,0x01,0x26,0x01,0x22,0x01,0x26,0x01,0x62,0x01,0x26,0x02,0x22,0x01,0x66,0x02,0x22,0x01,0x55,0x02,0x00,0x01,0x11,0x03,0x44,0x01,0x22,0x03,0x44,0x01,0x22,
|
|
|
|
0x03,0x00,0x01,0x02,0x18,0x52,0x01,0x55,
|
|
|
|
0x0E,0x00,0x1E,0x60,
|
|
|
|
0x0A,0x00,0x01,0x66,0x03,0x22,0x01,0x66,0x01,0x26,0x01,0x22,0x01,0x26,0x01,0x66,0x01,0x22,0x01,0x26,0x01,0x66,0x01,0x22,0x01,0x66,0x03,0x22,0x01,0x66,0x01,0x26,0x01,0x22,0x01,0x26,0x01,0x66,0x01,0x26,0x02,0x62,0x01,0x66,0x01,0x22,0x01,0x66,0x01,0x22,0x01,0x66,0x01,0x55,
|
|
|
|
0x09,0x00,0x01,0x66,0x01,0x22,0x01,0x26,0x02,0x66,0x01,0x22,0x01,0x26,0x01,0x22,0x01,0x66,0x01,0x22,0x01,0x62,0x01,0x26,0x01,0x22,0x02,0x66,0x01,0x22,0x02,0x66,0x01,0x22,0x01,0x26,0x01,0x22,0x01,0x66,0x01,0x22,0x02,0x26,0x01,0x66,0x01,0x62,0x01,0x26,0x01,0x62,0x01,0x66,0x01,0x55,
|
|
|
|
0x09,0x00,0x01,0x66,0x01,0x22,0x03,0x66,0x01,0x22,0x01,0x66,0x01,0x22,0x01,0x66,0x01,0x22,0x01,0x66,0x01,0x62,0x01,0x22,0x02,0x66,0x01,0x22,0x02,0x66,0x01,0x22,0x01,0x66,0x01,0x22,0x01,0x66,0x02,0x26,0x01,0x22,0x02,0x66,0x01,0x22,0x02,0x66,0x01,0x55,
|
|
|
|
0x09,0x00,0x01,0x06,0x1D,0x56,0x01,0x55,0x03,0x00,0x01,0x10,
|
|
|
|
0x24,0x00,0x01,0x10,0x01,0x00,0x01,0x10,0x01,0x11,0x01,0x01,
|
|
|
|
0x05,0x00,0x08,0xCC,0x01,0x40,0x09,0x00,0x01,0xD0,0x01,0x0D,0x01,0x00,0x01,0xD0,0x01,0x0D,0x01,0x00,0x01,0xD0,0x05,0x00,0x01,0x11,
|
|
|
|
0x0A,0x00,0x01,0x04,0x04,0x54,0x02,0xCC,0x01,0x44,0x01,0x55,0x06,0x00,0x01,0xD0,0x01,0xDD,0x02,0xD0,0x01,0xDD,0x02,0xD0,0x01,0xDD,0x01,0xD0,0x03,0x00,0x02,0x01,0x01,0x11,0x02,0x01,
|
|
|
|
0x0C,0x00,0x02,0xCC,0x01,0x44,0x01,0x54,0x01,0x55,0x06,0x00,0x01,0xDD,0x07,0xBB,0x01,0xDD,0x04,0x00,0x01,0x10,0x01,0x11,0x01,0x10,
|
|
|
|
0x0C,0x00,0x02,0xCC,0x01,0x44,0x01,0x54,0x01,0x55,0x07,0x00,0x01,0xDD,0x01,0xBB,0x01,0xBF,0x01,0xB0,0x01,0xBB,0x01,0xBF,0x01,0xB0,0x01,0xBB,0x01,0xDD,0x03,0x00,0x01,0x10,0x03,0x11,0x01,0x10,
|
|
|
|
0x0A,0x00,0x02,0xCC,0x01,0x44,0x01,0x54,0x01,0x55,0x08,0x00,0x01,0xDD,0x01,0xDB,0x01,0xBB,0x01,0x3B,0x01,0x33,0x02,0xBB,0x01,0xDB,0x01,0xDD,0x03,0x00,0x02,0x01,0x01,0x11,0x02,0x01,
|
|
|
|
0x0A,0x00,0x02,0xCC,0x01,0x44,0x01,0x55,0x09,0x00,0x02,0xDD,0x05,0xBB,0x02,0xDD,0x05,0x00,0x01,0x11,
|
|
|
|
0x0C,0x00,0x02,0xCC,0x01,0x44,0x01,0x55,0x09,0x00,0x01,0x0D,0x01,0x00,0x01,0xBB,0x03,0xB1,0x01,0xBB,0x01,0x00,0x01,0x0D,0x04,0x00,0x02,0xBB,
|
|
|
|
0x0C,0x00,0x01,0x0C,0x01,0x4C,0x01,0x44,0x01,0x55,0x0C,0x00,0x02,0xBB,0x06,0x00,0x01,0x20,0x01,0x22,0x01,0x2B,0x01,0x0B,
|
|
|
|
0x0E,0x00, 0x02,0x05, 0x09,0x00, 0x01,0x20, 0x06,0x22, 0x03,0x20,
|
2017-05-06 23:29:19 +00:00
|
|
|
0x02,0x22, 0x01,0x02, 0x09,0x00,
|
|
|
|
0xff,0xff
|
2017-05-04 18:32:41 +00:00
|
|
|
// " 55 2222222222222"
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-05-12 16:50:24 +00:00
|
|
|
static unsigned char test_sprite[]={
|
|
|
|
0x8,0x4,
|
|
|
|
0x55,0x50,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0xff,0x1f,0x4f,0x2f,0xff,0x22,0x20,0x00,
|
|
|
|
0x5f,0x5f,0x5f,0x5f,0xff,0xf2,0xf2,0xf2,
|
|
|
|
};
|
|
|
|
|
2017-05-04 18:32:41 +00:00
|
|
|
|
2017-05-03 14:53:27 +00:00
|
|
|
int main(int argc, char **argv) {
|
|
|
|
|
2017-05-04 18:32:41 +00:00
|
|
|
int ch;
|
2017-05-12 16:50:24 +00:00
|
|
|
int x,y;
|
2017-05-03 14:53:27 +00:00
|
|
|
|
|
|
|
grsim_init();
|
|
|
|
|
2017-05-17 21:14:47 +00:00
|
|
|
gr();
|
|
|
|
|
2017-05-03 14:53:27 +00:00
|
|
|
/* Title Screen */
|
2017-05-12 16:50:24 +00:00
|
|
|
grsim_unrle(title_rle,0x800);
|
|
|
|
gr_copy(0x800,0x400);
|
2017-05-03 14:53:27 +00:00
|
|
|
|
|
|
|
grsim_update();
|
|
|
|
|
2017-05-12 16:50:24 +00:00
|
|
|
x=20; y=21;
|
|
|
|
color_equals(0);
|
|
|
|
|
2017-05-03 14:53:27 +00:00
|
|
|
while(1) {
|
|
|
|
|
|
|
|
ch=grsim_input();
|
|
|
|
|
|
|
|
if (ch=='q') break;
|
2017-05-12 16:50:24 +00:00
|
|
|
if (ch=='i') if (y>0) y-=2;
|
|
|
|
if (ch=='m') if (y<39) y+=2;
|
|
|
|
if (ch=='j') if (x>0) x--;
|
|
|
|
if (ch=='k') if (x<39) x++;
|
|
|
|
|
|
|
|
gr_copy(0x800,0x400);
|
|
|
|
grsim_put_sprite(test_sprite,x,y);
|
|
|
|
|
|
|
|
grsim_update();
|
2017-05-03 14:53:27 +00:00
|
|
|
|
|
|
|
usleep(100000);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2017-05-04 18:32:41 +00:00
|
|
|
|