3 #include "../PicoInt.h"
5 #define rot_comp Pico_mcd->rot_comp
7 static int Table_Rot_Time[] =
9 0x00054000, 0x00048000, 0x00040000, 0x00036000, //; 008-032 ; briefing - sprite
10 0x0002E000, 0x00028000, 0x00024000, 0x00022000, //; 036-064 ; arbre souvent
11 0x00021000, 0x00020000, 0x0001E000, 0x0001B800, //; 068-096 ; map thunderstrike
12 0x00019800, 0x00017A00, 0x00015C00, 0x00013E00, //; 100-128 ; logo défoncé
14 0x00012000, 0x00011800, 0x00011000, 0x00010800, //; 132-160 ; briefing - map
15 0x00010000, 0x0000F800, 0x0000F000, 0x0000E800, //; 164-192
16 0x0000E000, 0x0000D800, 0x0000D000, 0x0000C800, //; 196-224
17 0x0000C000, 0x0000B800, 0x0000B000, 0x0000A800, //; 228-256 ; batman visage
19 0x0000A000, 0x00009F00, 0x00009E00, 0x00009D00, //; 260-288
20 0x00009C00, 0x00009B00, 0x00009A00, 0x00009900, //; 292-320
21 0x00009800, 0x00009700, 0x00009600, 0x00009500, //; 324-352
22 0x00009400, 0x00009300, 0x00009200, 0x00009100, //; 356-384
24 0x00009000, 0x00008F00, 0x00008E00, 0x00008D00, //; 388-416
25 0x00008C00, 0x00008B00, 0x00008A00, 0x00008900, //; 420-448
26 0x00008800, 0x00008700, 0x00008600, 0x00008500, //; 452-476
27 0x00008400, 0x00008300, 0x00008200, 0x00008100, //; 480-512
34 unsigned int Reg_58; // Stamp_Size
40 unsigned int Reg_64; // V_Dot
43 unsigned int Stamp_Map_Adr;
44 unsigned int Buffer_Adr;
45 unsigned int Vector_Adr;
47 unsigned int Float_Part;
48 unsigned int Draw_Speed;
61 static void gfx_cd_start(void)
65 dprintf("gfx_cd_start()");
67 upd_len = (rot_comp.Reg_62 >> 3) & 0x3f;
68 upd_len = Table_Rot_Time[upd_len];
70 rot_comp.Draw_Speed = rot_comp.Float_Part = upd_len;
72 rot_comp.Reg_58 |= 0x8000; // Stamp_Size, we start a new GFX operation
78 static void gfx_completed(void)
80 rot_comp.Reg_58 &= 0x7fff; // Stamp_Size
82 if (Pico_mcd->s68k_regs[0x33] & (1<<1))
84 dprintf("gfx_cd irq 1");
90 //static void gfx_do(void)
95 void gfx_cd_update(void)
97 unsigned char *V_Dot = (unsigned char *) &rot_comp.Reg_64;
100 dprintf("gfx_cd_update, Reg_64 = %04x", rot_comp.Reg_64);
109 jobs = rot_comp.Float_Part >> 16;
113 rot_comp.Float_Part += rot_comp.Draw_Speed;
117 rot_comp.Float_Part &= 0xffff;
118 rot_comp.Float_Part += rot_comp.Draw_Speed;
123 (*V_Dot)--; // dec byte [V_Dot]
135 unsigned int gfx_cd_read(unsigned int a)
140 case 0x58: d = rot_comp.Reg_58; break;
141 case 0x5A: d = rot_comp.Reg_5A; break;
142 case 0x5C: d = rot_comp.Reg_5C; break;
143 case 0x5E: d = rot_comp.Reg_5E; break;
144 case 0x60: d = rot_comp.Reg_60; break;
145 case 0x62: d = rot_comp.Reg_62; break;
146 case 0x64: d = rot_comp.Reg_64; break;
148 default: dprintf("gfx_cd_read: unexpected address: %02x", a); break;
151 dprintf("gfx_cd_read(%02x) = %04x", a, d);
156 void gfx_cd_write(unsigned int a, unsigned int d)
158 dprintf("gfx_cd_write(%x, %04x)", a, d);
161 case 0x58: // .Reg_Stamp_Size
162 rot_comp.Reg_58 = d & 7;
165 case 0x5A: // .Reg_Stamp_Adr
166 rot_comp.Reg_5A = d & 0xffe0;
169 case 0x5C: // .Reg_IM_VCell_Size
170 rot_comp.Reg_5C = d & 0x1f;
173 case 0x5E: // .Reg_IM_Adr
174 rot_comp.Reg_5E = d & 0xFFF8;
177 case 0x60: // .Reg_IM_Offset
178 rot_comp.Reg_60 = d & 0x3f;
181 case 0x62: // .Reg_IM_HDot_Size
182 rot_comp.Reg_62 = d & 0x1ff;
185 case 0x64: // .Reg_IM_VDot_Size
186 rot_comp.Reg_64 = d & 0xff; // V_Dot, must be 32bit?
189 case 0x66: // .Reg_Vector_Adr
190 rot_comp.Reg_66 = d & 0xfffe;
191 if (Pico_mcd->s68k_regs[3]&4) return; // can't do tanformations in 1M mode
195 default: dprintf("gfx_cd_write: unexpected address: %02x", a); return;