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