added copyright line to top of source files next to license information
[cyclone68000.git] / Pico / PicoInt.h
1 \r
2 // This file is part of the PicoDrive Megadrive Emulator\r
3 \r
4 // Copyright (c) 2011 FinalDave (emudave (at) gmail.com)\r
5 \r
6 // This code is licensed under the GNU General Public License version 2.0 and the MAME License.\r
7 // You can choose the license that has the most advantages for you.\r
8 \r
9 // SVN repository can be found at http://code.google.com/p/cyclone68000/\r
10 \r
11 #include <stdio.h>\r
12 #include <stdlib.h>\r
13 #include <string.h>\r
14 #include "Pico.h"\r
15 \r
16 #if defined(__GNUC__) || defined(_WIN32_WCE)\r
17 #define EMU_C68K // Use the Cyclone 68000 emulator\r
18 #else\r
19 #define EMU_A68K // Use the 'A68K' (Make68K) Assembler 68000 emulator\r
20 #endif\r
21 \r
22 //#define MSOUND\r
23 \r
24 // Disa.h also defines CPU_CALL to be fastcall or normal call\r
25 #include "Disa.h"\r
26 \r
27 \r
28 // ----------------------- 68000 CPU -----------------------\r
29 #ifdef EMU_A68K\r
30 // The format of the data in a68k.asm (at the _M68000_regs location)\r
31 struct A68KContext\r
32 {\r
33   unsigned int d[8],a[8];\r
34   unsigned int isp,srh,ccr,xc,pc,irq,sr;\r
35   int (*IrqCallback) (int nIrq);\r
36   unsigned int ppc;\r
37   void *pResetCallback;\r
38   unsigned int sfc,dfc,usp,vbr;\r
39   unsigned int AsmBank,CpuVersion;\r
40 };\r
41 extern "C" struct A68KContext M68000_regs;\r
42 #endif\r
43 \r
44 #ifdef EMU_C68K\r
45 #include "../Cyclone/Cyclone.h"\r
46 extern struct Cyclone PicoCpu;\r
47 #endif\r
48 \r
49 #ifdef MSOUND\r
50 extern "C" {\r
51 #include "ym2612.h"\r
52 }\r
53 #endif\r
54 \r
55 // ---------------------------------------------------------\r
56 \r
57 struct PicoVideo\r
58 {\r
59   unsigned char reg[0x20];\r
60   unsigned int command; // 32-bit Command\r
61   unsigned char pending; // 1 if waiting for second half of 32-bit command\r
62   unsigned char type; // Command type (v/c/vsram read/write)\r
63   unsigned short addr; // Read/Write address\r
64   int status; // Status bits\r
65   unsigned char pad[0x14];\r
66 };\r
67 \r
68 struct PicoMisc\r
69 {\r
70   unsigned char rotate;\r
71   unsigned char z80Run;\r
72   unsigned char padSelect[2]; // Select high or low bit from joypad\r
73   short scanline; // -38 to 223\r
74   char dirtyPal; // Is the palette dirty\r
75   unsigned char hardware; // Hardware value for country\r
76   unsigned char pal; // 1=PAL 0=NTSC\r
77   unsigned char pad[0x16];\r
78 };\r
79 \r
80 struct PicoSound\r
81 {\r
82   unsigned char fmsel[2]; // FM selected register\r
83   unsigned char reg[0x100];\r
84   unsigned char pad[0x3e];\r
85 };\r
86 \r
87 struct Pico\r
88 {\r
89   unsigned char ram[0x10000]; // scratch ram\r
90   unsigned short vram[0x8000];\r
91   unsigned char zram[0x2000]; // Z80 ram\r
92   unsigned int highpal[0x40];\r
93   unsigned short cram[0x40];\r
94   unsigned short vsram[0x40];\r
95 \r
96   unsigned char *rom;\r
97   unsigned int romsize;\r
98 \r
99   struct PicoMisc m;\r
100   struct PicoVideo video;\r
101   struct PicoSound s;\r
102 };\r
103 \r
104 // Draw.cpp\r
105 int PicoLine(int scan);\r
106 \r
107 // Draw2.cpp\r
108 int PicoDraw2();\r
109 \r
110 // Memory.cpp\r
111 int PicoInitPc(unsigned int pc);\r
112 unsigned short CPU_CALL PicoRead16(unsigned int a);\r
113 unsigned int CPU_CALL PicoRead32(unsigned int a);\r
114 int PicoMemInit();\r
115 void PicoDasm(int start,int len);\r
116 \r
117 // Pico.cpp\r
118 extern struct Pico Pico;\r
119 \r
120 // Sek.cpp\r
121 int SekInit();\r
122 int SekReset();\r
123 int SekRun(int cyc);\r
124 int SekInterrupt(int irq);\r
125 int SekPc();\r
126 void SekState(unsigned char *data);\r
127 \r
128 // Sine.cpp\r
129 extern short Sine[];\r
130 \r
131 // Psnd.cpp\r
132 int PsndReset();\r
133 int PsndFm(int a,int d);\r
134 int PsndRender();\r
135 \r
136 // VideoPort.cpp\r
137 void PicoVideoWrite(unsigned int a,unsigned int d);\r
138 unsigned int PicoVideoRead(unsigned int a);\r
139 \r
140 // External:\r
141 extern "C" int dprintf(char *Format, ...);\r