4 #include "../PicoInt.h"
6 #define rot_comp Pico_mcd->rot_comp
8 static const int Table_Rot_Time[] =
10 0x00054000, 0x00048000, 0x00040000, 0x00036000, //; 008-032 ; briefing - sprite
11 0x0002E000, 0x00028000, 0x00024000, 0x00022000, //; 036-064 ; arbre souvent
12 0x00021000, 0x00020000, 0x0001E000, 0x0001B800, //; 068-096 ; map thunderstrike
13 0x00019800, 0x00017A00, 0x00015C00, 0x00013E00, //; 100-128 ; logo défoncé
15 0x00012000, 0x00011800, 0x00011000, 0x00010800, //; 132-160 ; briefing - map
16 0x00010000, 0x0000F800, 0x0000F000, 0x0000E800, //; 164-192
17 0x0000E000, 0x0000D800, 0x0000D000, 0x0000C800, //; 196-224
18 0x0000C000, 0x0000B800, 0x0000B000, 0x0000A800, //; 228-256 ; batman visage
20 0x0000A000, 0x00009F00, 0x00009E00, 0x00009D00, //; 260-288
21 0x00009C00, 0x00009B00, 0x00009A00, 0x00009900, //; 292-320
22 0x00009800, 0x00009700, 0x00009600, 0x00009500, //; 324-352
23 0x00009400, 0x00009300, 0x00009200, 0x00009100, //; 356-384
25 0x00009000, 0x00008F00, 0x00008E00, 0x00008D00, //; 388-416
26 0x00008C00, 0x00008B00, 0x00008A00, 0x00008900, //; 420-448
27 0x00008800, 0x00008700, 0x00008600, 0x00008500, //; 452-476
28 0x00008400, 0x00008300, 0x00008200, 0x00008100, //; 480-512
35 unsigned int Reg_58; // Stamp_Size
41 unsigned int Reg_64; // V_Dot
44 unsigned int Stamp_Map_Adr;
45 unsigned int Buffer_Adr;
46 unsigned int Vector_Adr;
48 unsigned int Float_Part;
49 unsigned int Draw_Speed;
62 static void gfx_cd_start(void)
66 dprintf("gfx_cd_start()");
68 upd_len = (rot_comp.Reg_62 >> 3) & 0x3f;
69 upd_len = Table_Rot_Time[upd_len];
71 rot_comp.Draw_Speed = rot_comp.Float_Part = upd_len;
73 rot_comp.Reg_58 |= 0x8000; // Stamp_Size, we start a new GFX operation
79 static void gfx_completed(void)
81 rot_comp.Reg_58 &= 0x7fff; // Stamp_Size
83 if (Pico_mcd->s68k_regs[0x33] & (1<<1))
85 dprintf("gfx_cd irq 1");
91 //static void gfx_do(void)
96 void gfx_cd_update(void)
98 unsigned char *V_Dot = (unsigned char *) &rot_comp.Reg_64;
101 dprintf("gfx_cd_update, Reg_64 = %04x", rot_comp.Reg_64);
110 jobs = rot_comp.Float_Part >> 16;
114 rot_comp.Float_Part += rot_comp.Draw_Speed;
118 rot_comp.Float_Part &= 0xffff;
119 rot_comp.Float_Part += rot_comp.Draw_Speed;
124 (*V_Dot)--; // dec byte [V_Dot]
136 unsigned int gfx_cd_read(unsigned int a)
141 case 0x58: d = rot_comp.Reg_58; break;
142 case 0x5A: d = rot_comp.Reg_5A; break;
143 case 0x5C: d = rot_comp.Reg_5C; break;
144 case 0x5E: d = rot_comp.Reg_5E; break;
145 case 0x60: d = rot_comp.Reg_60; break;
146 case 0x62: d = rot_comp.Reg_62; break;
147 case 0x64: d = rot_comp.Reg_64; break;
149 default: dprintf("gfx_cd_read FIXME: unexpected address: %02x", a); break;
152 dprintf("gfx_cd_read(%02x) = %04x", a, d);
157 void gfx_cd_write(unsigned int a, unsigned int d)
159 dprintf("gfx_cd_write(%x, %04x)", a, d);
162 case 0x58: // .Reg_Stamp_Size
163 rot_comp.Reg_58 = d & 7;
166 case 0x5A: // .Reg_Stamp_Adr
167 rot_comp.Reg_5A = d & 0xffe0;
170 case 0x5C: // .Reg_IM_VCell_Size
171 rot_comp.Reg_5C = d & 0x1f;
174 case 0x5E: // .Reg_IM_Adr
175 rot_comp.Reg_5E = d & 0xFFF8;
178 case 0x60: // .Reg_IM_Offset
179 rot_comp.Reg_60 = d & 0x3f;
182 case 0x62: // .Reg_IM_HDot_Size
183 rot_comp.Reg_62 = d & 0x1ff;
186 case 0x64: // .Reg_IM_VDot_Size
187 rot_comp.Reg_64 = d & 0xff; // V_Dot, must be 32bit?
190 case 0x66: // .Reg_Vector_Adr
191 rot_comp.Reg_66 = d & 0xfffe;
192 if (Pico_mcd->s68k_regs[3]&4) return; // can't do tanformations in 1M mode
196 default: dprintf("gfx_cd_write FIXME: unexpected address: %02x", a); return;
201 void gfx_cd_reset(void)
203 memset(&rot_comp.Reg_58, 0, sizeof(rot_comp));
207 // --------------------------------
209 #include "cell_map.c"
211 typedef unsigned short u16;
213 // check: Heart of the alien, jaguar xj 220
214 void DmaSlowCell(unsigned int source, unsigned int a, int len, unsigned char inc)
217 unsigned int asrc, a2;
220 base = Pico_mcd->word_ram1M[Pico_mcd->s68k_regs[3]&1];
222 switch (Pico.video.type)
228 asrc = cell_map(source >> 2) << 2;
230 // if(a&1) d=(d<<8)|(d>>8); // ??
231 r[a>>1] = *(u16 *)(base + asrc);
242 for(a2=a&0x7f; len; len--)
244 asrc = cell_map(source >> 2) << 2;
246 r[a2>>1] = *(u16 *)(base + asrc);
251 if(a2 >= 0x80) break;
256 case 5: // vsram[a&0x003f]=d;
258 for(a2=a&0x7f; len; len--)
260 asrc = cell_map(source >> 2) << 2;
262 r[a2>>1] = *(u16 *)(base + asrc);
267 if(a2 >= 0x80) break;
273 Pico.video.addr=(u16)a;