Previous 199869 Revisions Next

r34673 Wednesday 28th January, 2015 at 01:48:37 UTC by David Haywood
refactor decathlete protection a bit, hook up 'doa' to the table uploads for it too (nw)
[src/mame/machine]315-5838_317-0229_comp.c 315-5838_317-0229_comp.h

trunk/src/mame/machine/315-5838_317-0229_comp.c
r243184r243185
1010   dumb security check, decompressing a single string.
1111
1212   Each channel appears to be connected to a different set of ROMs, however there is
13   defintiely only 315-5838 single chip.
13   defintiely only a single 315-5838 chip. (could the different channels actually just
14   be mirror addresses, with part of the address determining the ROMs to use?)
1415
1516   Dead of Alive only uses a single channel, and has the source data in RAM, not ROM.
1617   This is similar to how some 5881 games were set up, with the ST-V versions decrypting
r243184r243185
1819
1920   Looking at the values read I don't think there is any address based encryption, for
2021   example many blocks where you'd expect a zero fill start with repeating patterns
21   of 8f708f70 (different lengths) which would appear to relate to compressed 0x00 data
22   of 8f708f70 (different lengths) channel would appear to relate to compressed 0x00 data
2223
2324   read addr 0071253c, blah_r 8f708f70 - read count count 00000004
2425   read addr 00712540, blah_r 8f708f70 - read count count 00000008
r243184r243185
4647
4748void sega_315_5838_comp_device::device_start()
4849{
49   m_decathlt_lastcount = 0;
50   m_decathlt_prot_uploadmode = 0;
51   m_decathlt_prot_uploadoffset = 0;
50   for (int i = 0; i < 2; i++)
51   {
52      m_channel[i].m_decathlt_lastcount = 0;
53      m_channel[i].m_decathlt_prot_uploadmode = 0;
54      m_channel[i].m_decathlt_prot_uploadoffset = 0;
55      m_channel[i].m_read_ch.bind_relative_to(*owner());
5256
53   m_read_ch1.bind_relative_to(*owner());
54   m_read_ch2.bind_relative_to(*owner());
57   }
5558}
5659
5760void sega_315_5838_comp_device::device_reset()
5861{
59   memset(m_decathlt_protregs, 0, sizeof(m_decathlt_protregs));
60   m_decathlt_lastcount = 0;
61   m_decathlt_prot_uploadmode = 0;
62   m_decathlt_prot_uploadoffset = 0;
63   m_decathlt_part = 1;
62   for (int i = 0; i < 2; i++)
63   {
64      m_channel[i].m_srcoffset = 0;
65      m_channel[i].m_decathlt_lastcount = 0;
66      m_channel[i].m_decathlt_prot_uploadmode = 0;
67      m_channel[i].m_decathlt_prot_uploadoffset = 0;
68   }
6469
6570   m_protstate = 0;
6671}
r243184r243185
7782#endif
7883
7984
80READ32_MEMBER(sega_315_5838_comp_device::decathlt_prot_r)
85READ32_MEMBER(sega_315_5838_comp_device::decathlt_prot1_r)
8186{
82   return genericdecathlt_prot_r(offset, mem_mask, 0);
87   return genericdecathlt_prot_r(mem_mask, 0);
8388}
8489
85READ32_MEMBER(sega_315_5838_comp_device::decathlt_prot_ch2_r)
90READ32_MEMBER(sega_315_5838_comp_device::decathlt_prot2_r)
8691{
87   return genericdecathlt_prot_r(offset, mem_mask, 1);
92   return genericdecathlt_prot_r(mem_mask, 1);
8893}
8994
9095
91UINT32 sega_315_5838_comp_device::genericdecathlt_prot_r(UINT32 offset, UINT32 mem_mask, int which)
96UINT32 sega_315_5838_comp_device::genericdecathlt_prot_r(UINT32 mem_mask, int channel)
9297{
93
9498//   UINT32 *fake0 = (UINT32*)memregion( ":fake0" )->base();
99//   UINT32 retvalue = 0xffff;
95100
96   if (offset==2)
101   switch (m_channel[channel].m_srcoffset)
97102   {
98//      UINT32 retvalue = 0xffff;
103      default:
99104
100      switch (m_decathlt_protregs[0])
101      {
102         default:
105      m_channel[channel].m_decathlt_lastcount++;
103106
104         m_decathlt_lastcount++;
107      UINT32 tempdata = 0;
108      tempdata |= m_channel[channel].m_read_ch(m_channel[channel].m_srcoffset) << 0;
109      m_channel[channel].m_srcoffset++;
110      tempdata |= m_channel[channel].m_read_ch(m_channel[channel].m_srcoffset) << 16;
111      m_channel[channel].m_srcoffset++;
105112
106         UINT32 tempdata = 0;
107113
108         if (which == 0)
109         {
110            tempdata |= m_read_ch1(m_decathlt_protregs[0]) << 16;
111            m_decathlt_protregs[0]++;
112            tempdata |= m_read_ch1(m_decathlt_protregs[0]) << 0;
113            m_decathlt_protregs[0]++;
114         }
115         else
116         {
117            tempdata |= m_read_ch2(m_decathlt_protregs[0]) << 16;
118            m_decathlt_protregs[0]++;
119            tempdata |= m_read_ch2(m_decathlt_protregs[0]) << 0;
120            m_decathlt_protregs[0]++;
121         }
114      #ifdef DEBUG_DATA_DUMP
115      //printf("read addr %08x, blah_r %08x - read count count %08x\n", m_channel[channel].m_srcoffset*2, tempdata,  m_channel[channel].m_decathlt_lastcount*4);
116      fwrite(&tempdata, 1, 4, tempfile);
117      #else
118      logerror("read addr %08x, blah_r %08x - read count count %08x\n", m_channel[channel].m_srcoffset*2, tempdata,  m_channel[channel].m_decathlt_lastcount*4);
119      #endif
122120
123         #ifdef DEBUG_DATA_DUMP
124         //printf("read addr %08x, blah_r %08x - read count count %08x\n", m_decathlt_protregs[0]*2, tempdata,  m_decathlt_lastcount*4);
125         fwrite(&tempdata, 1, 4, tempfile);
126         #else
127         logerror("read addr %08x, blah_r %08x - read count count %08x\n", m_decathlt_protregs[0]*2, tempdata,  m_decathlt_lastcount*4);
128         #endif
129
130         return tempdata;
121      return tempdata;
131122#if 0
132         case 0x03228e4:
133            if (fake0) retvalue = fake0[(((0x20080/4)+m_decathlt_lastcount))];
134            m_decathlt_lastcount++;
135            return retvalue;
123      case 0x03228e4:
124         if (fake0) retvalue = fake0[(((0x20080/4)+m_channel[channel].m_decathlt_lastcount))];
125         m_channel[channel].m_decathlt_lastcount++;
126         return retvalue;
136127
137         case 0x00a9f3a:
138            if (fake0) retvalue = fake0[(((0x00000/4)+m_decathlt_lastcount))];
139            m_decathlt_lastcount++;
140            return retvalue;
128      case 0x00a9f3a:
129         if (fake0) retvalue = fake0[(((0x00000/4)+m_channel[channel].m_decathlt_lastcount))];
130         m_channel[channel].m_decathlt_lastcount++;
131         return retvalue;
141132
142         case 0x0213ab4:
143            if (fake0) retvalue = fake0[(((0x40000/4)+m_decathlt_lastcount))];
144            m_decathlt_lastcount++;
145            return retvalue;
133      case 0x0213ab4:
134         if (fake0) retvalue = fake0[(((0x40000/4)+m_channel[channel].m_decathlt_lastcount))];
135         m_channel[channel].m_decathlt_lastcount++;
136         return retvalue;
146137
147         case 0x01efaf0:
148            if (fake0) retvalue = fake0[(((0x60000/4)+m_decathlt_lastcount))];
149            m_decathlt_lastcount++;
150            return retvalue;
138      case 0x01efaf0:
139         if (fake0) retvalue = fake0[(((0x60000/4)+m_channel[channel].m_decathlt_lastcount))];
140         m_channel[channel].m_decathlt_lastcount++;
141         return retvalue;
151142
152         case 0x033f16c:
153         case 0x038929c:
143      case 0x033f16c:
144      case 0x038929c:
154145
155146
156147
157         case 0x00de05a:
158         case 0x0334258:
159         case 0x019fb82:
160         case 0x033dbf6:
161         case 0x0011ac6:
162         case 0x00060dc:
163         case 0x0000002:
164         case 0x0008c90:
165         case 0x035cdc8:
166         case 0x0327960:
167         case 0x0329b8c:
168         case 0x00d6e92:
169         case 0x000081e:
170         case 0x00035d6:
171         case 0x00089a6:
172         case 0x03315f4:
173         case 0x0023fe0:
174         case 0x001e290:
175         case 0x0026e86:
176         case 0x0012494:
177         case 0x001b35a:
178         case 0x0018424:
148      case 0x00de05a:
149      case 0x0334258:
150      case 0x019fb82:
151      case 0x033dbf6:
152      case 0x0011ac6:
153      case 0x00060dc:
154      case 0x0000002:
155      case 0x0008c90:
156      case 0x035cdc8:
157      case 0x0327960:
158      case 0x0329b8c:
159      case 0x00d6e92:
160      case 0x000081e:
161      case 0x00035d6:
162      case 0x00089a6:
163      case 0x03315f4:
164      case 0x0023fe0:
165      case 0x001e290:
166      case 0x0026e86:
167      case 0x0012494:
168      case 0x001b35a:
169      case 0x0018424:
179170
180            return retvalue;
171         return retvalue;
181172#endif
182      }
183
184
185173   }
186   else
187   {
188      logerror("%06x Decathlete prot R offset %04x mask %08x regs %08x, %08x, %08x, %08x\n", safe_pc(), offset, mem_mask, m_decathlt_protregs[0], m_decathlt_protregs[1], m_decathlt_protregs[2], m_decathlt_protregs[3]);
189   }
190174
191   return m_decathlt_protregs[offset];
175   return 0xffffffff;
192176}
193177
194
195void sega_315_5838_comp_device::write_prot_data(UINT32 data, UINT32 mem_mask, int offset, int which)
178void sega_315_5838_comp_device::set_prot_addr(UINT32 data, UINT32 mem_mask, int channel)
196179{
180//   printf("set_prot_addr\n");
181   COMBINE_DATA(&m_channel[channel].m_srcoffset);
197182
198   printf("write_prot_data %08x %08x %08x\n", offset, data, mem_mask);
183   //if (m_decathlt_part==0) logerror("%d, last read count was %06x\n",channel, m_channel[channel].m_decathlt_lastcount*4);
184   m_channel[channel].m_decathlt_lastcount = 0;
199185
200   m_decathlt_protregs[offset] = (data&mem_mask)|(m_decathlt_protregs[offset]&~mem_mask);
201//  m_decathlt_protregs[0] = 0x0c00000/4;
202
203   if (offset==0) // seems to set a source address
186   if (mem_mask == 0x0000ffff)
204187   {
205      m_decathlt_part ^=1;
188      printf("set source address to %08x (channel %d)\n", m_channel[channel].m_srcoffset, channel);
189   }
206190
207      //if (m_decathlt_part==0) logerror("%d, last read count was %06x\n",which, m_decathlt_lastcount*4);
208      m_decathlt_lastcount = 0;
209      if (m_decathlt_part==1) logerror("%d Decathlete prot W offset %04x data %08x, %08x, >>> regs %08x <<<<, %08x, %08x, %08x\n",which, offset, data, m_decathlt_protregs[0], m_decathlt_protregs[0]*4, m_decathlt_protregs[1], m_decathlt_protregs[2], m_decathlt_protregs[3]);
210191
211192#ifdef DEBUG_DATA_DUMP
212      if (mem_mask == 0x0000ffff)
193   if (mem_mask == 0x0000ffff)
194   {
195      if (tempfile)
196         fclose(tempfile);
197
198      char filename[256];
199      sprintf(filename, "%d_compressed_%08x", channel, m_channel[channel].m_srcoffset * 2);
200      tempfile = fopen(filename, "w+b");
201
202      // the table and dictionary are uploaded repeatedly, usually before groups of data transfers but
203      // it's always the same tables (one pair for each channel)
213204      {
214         if (tempfile)
215            fclose(tempfile);
205         FILE* fp;
206         sprintf(filename, "%d_compressed_table1", channel);
207         fp = fopen(filename, "w+b");
208         fwrite(&m_channel[channel].m_decathlt_prottable1, 24, 2, fp);
209         fclose(fp);
210      }
216211
217         char filename[256];
218         sprintf(filename, "%d_compressed_%08x", which, m_decathlt_protregs[0] );
219         tempfile = fopen(filename, "w+b");
212      {
213         FILE* fp;
214         sprintf(filename, "%d_compressed_dictionary", channel);
215         fp = fopen(filename, "w+b");
216         fwrite(&m_channel[channel].m_decathlt_dictionary, 128, 2, fp);
217         fclose(fp);
220218      }
219   }
221220#endif
222221
222}
223
224void sega_315_5838_comp_device::set_upload_mode(UINT16 data, int channel)
225{
226   if ((data == 0x8000) || (data == 0x0000))
227   {
228   //  logerror("changed to upload mode 1\n");
229      m_channel[channel].m_decathlt_prot_uploadmode = 1;
230      m_channel[channel].m_decathlt_prot_uploadoffset = 0;
223231   }
232   else if ((data == 0x8080) || (data == 0x0080))
233   {
234      m_channel[channel].m_decathlt_prot_uploadmode = 2;
235      m_channel[channel].m_decathlt_prot_uploadoffset = 0;
236   }
237   else
238   {
239      fatalerror("unknown upload mode\n");
240   }
241}
224242
225   if (offset==1) // uploads 2 tables...
243void sega_315_5838_comp_device::upload_table_data(UINT16 data, int channel)
244{
245   if (m_channel[channel].m_decathlt_prot_uploadmode == 1)
226246   {
227      if (mem_mask==0xffff0000)
247      if (m_channel[channel].m_decathlt_prot_uploadoffset >= 24)
228248      {
229         if (data == 0x80000000)
230         {
231         //  logerror("changed to upload mode 1\n");
232            m_decathlt_prot_uploadmode = 1;
233            m_decathlt_prot_uploadoffset = 0;
234         }
235         else if (data == 0x80800000)
236         {
237         //  logerror("changed to upload mode 2\n");
238            m_decathlt_prot_uploadmode = 2;
239            m_decathlt_prot_uploadoffset = 0;
240         }
241         else
242         {
243         //  logerror("unknown upload mode\n");
244            m_decathlt_prot_uploadmode = 2;
245            m_decathlt_prot_uploadoffset = 0;
246         }
247
248//          logerror("ARGH! %08x %08x\n",mem_mask,data);
249         fatalerror("upload mode 1 error, too big\n");
250         return;
249251      }
250      else if (mem_mask==0x0000ffff)
251      {
252         if (m_decathlt_prot_uploadmode==1)
253         {
254            if (m_decathlt_prot_uploadoffset>=24)
255            {
256            //  logerror("upload mode 1 error, too big\n");
257               return;
258            }
259252
260            //logerror("uploading table 1 %04x %04x\n",m_decathlt_prot_uploadoffset, data&0xffff);
261            m_decathlt_prottable1[m_decathlt_prot_uploadoffset]=data&0xffff;
262            m_decathlt_prot_uploadoffset++;
263
264            printf("table 1 %04x\n", data & 0xffff);
265
266            {
267               /* 0x18 (24) values in this table, rom data is 0x1800000 long, maybe it has
268                  something to do with that? or 24-address b    its?
269
270                  uploaded values appear to be 12-bit, some are repeated
271               */
272
273               {
274                  FILE* fp;
275                  if (which==1) fp = fopen("table1x","wb");
276                  else fp = fopen("table1","wb");
277
278                  {
279                     fwrite(&m_decathlt_prottable1,24,2,fp);
280                  }
281                  fclose(fp);
282               }
283            }
284
285         }
286         else if (m_decathlt_prot_uploadmode==2)
287         {
288            if (m_decathlt_prot_uploadoffset>=128)
289            {
290               //logerror("upload mode 2 error, too big\n");
291               return;
292            }
293
294            //logerror("uploading table 2 %04x %04x\n",m_decathlt_prot_uploadoffset, data&0xffff);
295            m_decathlt_prottable2[m_decathlt_prot_uploadoffset]=data&0xffff;
296            m_decathlt_prot_uploadoffset++;
297
298            printf("dictionary %04x\n", data & 0xffff);
299
300
301            {
302               /* the table uploaded here is a 256 byte table with 256 unique values, remaps something? */
303
304               {
305                  FILE* fp;
306                  if (which==1) fp = fopen("table2x","wb");
307                  else fp = fopen("table2","wb");
308
309                  {
310                     fwrite(&m_decathlt_prottable2,128,2,fp);
311                  }
312                  fclose(fp);
313               }
314            }
315         }
316         else
317         {
318         //  logerror("unknown upload mode!\n");
319         }
253      //logerror("uploading table 1 %04x %04x\n",m_channel[channel].m_decathlt_prot_uploadoffset, data&0xffff);
254      m_channel[channel].m_decathlt_prottable1[m_channel[channel].m_decathlt_prot_uploadoffset] = data & 0xffff;
255      m_channel[channel].m_decathlt_prot_uploadoffset++;
256      printf("unk table 1 %04x (channel %d)\n", data & 0xffff, channel);
257   }
258   else if (m_channel[channel].m_decathlt_prot_uploadmode == 2)
259   {
260      if (m_channel[channel].m_decathlt_prot_uploadoffset >= 128)
261      {
262         fatalerror("upload mode 2 error, too big\n");
263         return;
320264      }
265
266      //logerror("uploading table 2 %04x %04x\n",m_channel[channel].m_decathlt_prot_uploadoffset, data&0xffff);
267      m_channel[channel].m_decathlt_dictionary[m_channel[channel].m_decathlt_prot_uploadoffset] = data & 0xffff;
268      m_channel[channel].m_decathlt_prot_uploadoffset++;
269      printf("dictionary %04x (channel %d)\n", data & 0xffff, channel);
321270   }
271}
322272
323   if (offset>1)
273void sega_315_5838_comp_device::write_prot_data(UINT32 data, UINT32 mem_mask, int channel, int rev_words)
274{
275   if (mem_mask==0xffff0000)
324276   {
325   //  logerror("higher offset write\n");
277      if (rev_words==0) set_upload_mode(data >> 16, channel);
278      else upload_table_data(data >>16, channel);
326279   }
327
280   else if (mem_mask == 0x0000ffff)
281   {
282      if (rev_words==0) upload_table_data(data & 0xffff, channel);
283      else set_upload_mode(data & 0xffff, channel);
284   }
285   else
286   {
287      fatalerror("write_prot_data invalid mem_mask\b");
288   }
328289}
329290
330WRITE32_MEMBER( sega_315_5838_comp_device::decathlt_prot1_w )
331{
332   write_prot_data(data,mem_mask, offset, 0);
333291
334}
335292
336WRITE32_MEMBER( sega_315_5838_comp_device::decathlt_prot2_w )
337{
338   write_prot_data(data,mem_mask, offset, 1);
293WRITE32_MEMBER( sega_315_5838_comp_device::decathlt_prot1_w_doa )  { write_prot_data(data, mem_mask, 0, 1); }
294WRITE32_MEMBER( sega_315_5838_comp_device::decathlt_prot1_w)  { write_prot_data(data, mem_mask, 0, 0); }
295WRITE32_MEMBER( sega_315_5838_comp_device::decathlt_prot2_w)  { write_prot_data(data, mem_mask, 1, 0); }
339296
297WRITE32_MEMBER( sega_315_5838_comp_device::decathlt_prot1_srcaddr_w ) { set_prot_addr(data, mem_mask, 0); }
298WRITE32_MEMBER( sega_315_5838_comp_device::decathlt_prot2_srcaddr_w)  { set_prot_addr(data, mem_mask, 1); }
340299
341}
342300
343301void sega_315_5838_comp_device::install_decathlt_protection()
344302{
345   /* It uploads 2 tables here, then performs what looks like a number of transfers, setting
346      a source address of some kind (scrambled?) and then making many reads from a single address */
347
348303   //todo, install these in the driver, they differ between games
349304   cpu_device* cpu = (cpu_device*)machine().device(":maincpu");
350305
306   cpu->space(AS_PROGRAM).install_write_handler(0x37FFFF0, 0x37FFFF3, write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_srcaddr_w), this)); // set compressed data source address
307   cpu->space(AS_PROGRAM).install_write_handler(0x37FFFF4, 0x37FFFF7, write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_w), this)); // upload tables
308   cpu->space(AS_PROGRAM).install_read_handler(0x37FFFF8, 0x37FFFFb, read32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_r), this)); // read decompressed data
351309
352   cpu->space(AS_PROGRAM).install_readwrite_handler(0x37FFFF0, 0x37FFFFF, read32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot_r), this), write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_w), this));
353   /* It accesses the device at this address too, with different tables, for the game textures, should it just act like a mirror, or a secondary device? */
354   cpu->space(AS_PROGRAM).install_readwrite_handler(0x27FFFF0, 0x27FFFFF, read32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot_ch2_r), this), write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot2_w), this));
310   // the device is addressed here too, uploading a different set of tables and accessing a different part of ROM
311   cpu->space(AS_PROGRAM).install_write_handler(0x27FFFF0, 0x27FFFF3, write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot2_srcaddr_w), this)); // set compressed data source address
312   cpu->space(AS_PROGRAM).install_write_handler(0x27FFFF4, 0x27FFFF7, write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot2_w), this)); // upload tables
313   cpu->space(AS_PROGRAM).install_read_handler(0x27FFFF8, 0x27FFFFb, read32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot2_r), this)); // read decompressed data
355314}
356315
357316
r243184r243185
387346{
388347   printf("doa_prot_w %08x %08x %08x\n", offset*4, data, mem_mask);
389348
390   if (offset == 0x7ff2 / 4)
391   {
392      if (data == 0)
393      {
394         m_protstate = 0;
395         strcpy((char *)m_protram, "  TECMO LTD.  DEAD OR ALIVE  1996.10.22  VER. 1.00"); // this is the single decompressed string DOA needs
396      }
397   }
398   else logerror("Unhandled Protection WRITE %x @ %x mask %x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc());
349   m_protstate = 0;
399350}
400351
401352
r243184r243185
403354{
404355   //todo, install these in the driver, they differ between games
405356   cpu_device* cpu = (cpu_device*)machine().device(":maincpu");
357
358   m_protstate = 0;
359   strcpy((char *)m_protram, "  TECMO LTD.  DEAD OR ALIVE  1996.10.22  VER. 1.00"); // this is the single decompressed string DOA needs, note, 2 spaces at start, might indicate a dummy read like with 5881 on Model 2
360
406361   cpu->space(AS_PROGRAM).install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(sega_315_5838_comp_device::doa_prot_r), this), write32_delegate(FUNC(sega_315_5838_comp_device::doa_prot_w), this));
362   cpu->space(AS_PROGRAM).install_write_handler(0x01d87ff0, 0x01d87ff3, write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_srcaddr_w), this)); // set compressed data source address (always set 0, data is in RAM)
363   cpu->space(AS_PROGRAM).install_write_handler(0x01d87ff4, 0x01d87ff7, write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_w_doa), this)); // upload tab
364//   cpu->space(AS_PROGRAM).install_read_handler(0x01d87ff8, 0x01d87ffb, read32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_r), this)); // read decompressed data
365
407366}
No newline at end of file
trunk/src/mame/machine/315-5838_317-0229_comp.h
r243184r243185
44#ifndef __SEGA315_5838_COMP__
55#define __SEGA315_5838_COMP__
66
7#define CHANNELS 2
8
79typedef device_delegate<UINT16 (UINT32)> sega_dec_read_delegate;
810
911extern const device_type SEGA315_5838_COMP;
r243184r243185
2022   // construction/destruction
2123   sega_315_5838_comp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
2224
23   sega_dec_read_delegate m_read_ch1;
2425   sega_dec_read_delegate m_read_ch2;
2526
2627   static void set_read_cb_ch1(device_t &device,sega_dec_read_delegate readcb)
2728   {
2829      sega_315_5838_comp_device &dev = downcast<sega_315_5838_comp_device &>(device);
29      dev.m_read_ch1 = readcb;
30      dev.m_channel[0].m_read_ch = readcb;
3031   }
3132
3233   static void set_read_cb_ch2(device_t &device,sega_dec_read_delegate readcb)
3334   {
3435      sega_315_5838_comp_device &dev = downcast<sega_315_5838_comp_device &>(device);
35      dev.m_read_ch2 = readcb;
36      dev.m_channel[1].m_read_ch = readcb;
3637   }
3738
38   DECLARE_READ32_MEMBER(decathlt_prot_r);
39   DECLARE_READ32_MEMBER(decathlt_prot_ch2_r);;
40   UINT32 genericdecathlt_prot_r(UINT32 offset, UINT32 mem_mask, int which);
39   DECLARE_READ32_MEMBER(decathlt_prot1_r);
40   DECLARE_READ32_MEMBER(decathlt_prot2_r);;
41   UINT32 genericdecathlt_prot_r(UINT32 mem_mask, int channel);
4142
42   void write_prot_data(UINT32 data, UINT32 mem_mask, int offset, int which);
43   void write_prot_data(UINT32 data, UINT32 mem_mask, int channel, int rev_words);
44
45   void upload_table_data(UINT16 data, int channel);
46   void set_upload_mode(UINT16 data, int channel);
47   void set_prot_addr(UINT32 data, UINT32 mem_mask, int channel);
48
49   DECLARE_WRITE32_MEMBER(decathlt_prot1_w_doa);
4350   DECLARE_WRITE32_MEMBER(decathlt_prot1_w);
4451   DECLARE_WRITE32_MEMBER(decathlt_prot2_w);
52   DECLARE_WRITE32_MEMBER(decathlt_prot1_srcaddr_w);
53   DECLARE_WRITE32_MEMBER(decathlt_prot2_srcaddr_w);
54
4555   void install_decathlt_protection();
4656   void install_doa_protection();
4757
r243184r243185
5565private:
5666
5767   // Decathlete specific variables and functions (see machine/decathlt.c)
58   UINT32 m_decathlt_protregs[4];
59   UINT32 m_decathlt_lastcount;
60   UINT32 m_decathlt_part;
61   UINT32 m_decathlt_prot_uploadmode;
62   UINT32 m_decathlt_prot_uploadoffset;
63   UINT16 m_decathlt_prottable1[24];
64   UINT16 m_decathlt_prottable2[128];
68   struct channel_type
69   {
70      UINT32 m_srcoffset;
71      UINT16 m_decathlt_prottable1[24];
72      UINT16 m_decathlt_dictionary[128];
6573
74      UINT32 m_decathlt_lastcount;
75      UINT32 m_decathlt_prot_uploadmode;
76      UINT32 m_decathlt_prot_uploadoffset;
77      sega_dec_read_delegate m_read_ch;
78
79   };
80
81   channel_type m_channel[2];
82
83
84
6685   // Doa
6786   int m_protstate;
6887   int m_prot_a;


Previous 199869 Revisions Next


© 1997-2024 The MAME Team