7 unsigned char ram[0x10000]; // 0x00000 scratch ram
\r
8 unsigned short vram[0x8000]; // 0x10000
\r
9 unsigned char zram[0x2000]; // 0x20000 Z80 ram
\r
10 unsigned char ioports[0x10];
\r
11 unsigned int pad[0x3c]; // unused
\r
12 unsigned short cram[0x40]; // 0x22100
\r
13 unsigned short vsram[0x40]; // 0x22180
\r
15 unsigned char *rom; // 0x22200
\r
16 unsigned int romsize; // 0x22204
\r
18 // struct PicoMisc m;
\r
19 // struct PicoVideo video;
\r
21 extern struct Pico Pico;
\r
24 unsigned short *EmuScreen=NULL;
\r
25 extern "C" unsigned short *framebuff=NULL;
\r
26 int EmuWidth=0,EmuHeight=0;
\r
28 static int EmuScan(unsigned int num, void *sdata);
\r
35 // PsndRate=44100; PsndLen=DSoundSeg;
\r
40 EmuWidth=320; EmuHeight=224;
\r
41 len=EmuWidth*EmuHeight; len<<=1;
\r
42 EmuScreen=(unsigned short *)malloc(len); if (EmuScreen==NULL) return 1;
\r
43 framebuff=(unsigned short *)malloc((8+320)*(8+224+8)*2);
\r
44 memset(EmuScreen,0,len);
\r
54 free(EmuScreen); EmuScreen=NULL; // Deallocate screen
\r
56 EmuWidth=EmuHeight=0;
\r
61 // Megadrive scanline callback:
\r
62 static int EmuScan(unsigned int num, void *sdata)
\r
64 unsigned short *pd=NULL,*end=NULL;
\r
65 unsigned short *ps=NULL;
\r
67 if (num>=(unsigned int)EmuHeight) return 0;
\r
69 // Copy scanline to screen buffer:
\r
70 pd=EmuScreen+(num<<8)+(num<<6); end=pd+320;
\r
71 ps=(unsigned short *)sdata;
\r
73 do { *pd++=(unsigned short)PicoCram(*ps++); } while (pd<end);
\r
80 char map[12]={0,1,2,3,8,9,10,4,11,12,13,14}; // Joypads, format is UDLR BCAS ZYXM
\r
83 // Set Megadrive buttons:
\r
87 if (m>=0) if (Inp.button[m]>30) input|=1<<a;
\r
93 PsndOut=(short *)DSoundNext; PicoFrame(); PsndOut=NULL;
\r
97 unsigned short *pd=EmuScreen;
\r
98 unsigned char *ps=(unsigned char*)framebuff+328*8;
\r
100 unsigned short palHigh[0x40];
\r
101 for(int i = 0; i < 0x40; i++)
\r
102 palHigh[i]=(unsigned short)PicoCram(Pico.cram[i]);
\r
104 for(int y=0; y < 224; y++) {
\r
106 for(int x=0; x < 320; x++)
\r
107 *pd++=palHigh[*ps++];
\r