Previous 199869 Revisions Next

r19318 Wednesday 5th December, 2012 at 02:21:37 UTC by David Haywood
code reduction (nw)
[src/mame/machine]megacdcd.c megacdcd.h
[src/mess/drivers]ng_aes.c

trunk/src/mame/machine/megacdcd.c
r19317r19318
553553}
554554
555555
556
557
556558UINT8 lc89510_temp_device::CDC_Reg_r(void)
557559{
558560   int reg = CDC_REG0 & 0xF;
559561   UINT8 ret = 0;
562   
563   
560564   UINT16 decoderegs = 0x73F2;
561565
562566   if ((decoderegs>>reg)&1)
563567      CDC_DECODE |= (1 << reg);
564568
565   //if (reg!=REG_R_STAT3)
566      CDC_REG0 = (CDC_REG0 & 0xFFF0) | ((reg+1)&0xf);
567569
570   CDC_REG0 = (CDC_REG0 & 0xFFF0) | ((reg+1)&0xf);
568571
569572   switch (reg)
570573   {
571574      case REG_R_COMIN:  ret = 0/*COMIN*/;                  break;
572575      case REG_R_IFSTAT: ret = LC8951RegistersR[REG_R_IFSTAT];   break;
573576      case REG_R_DBCL:   ret = LC8951RegistersW[REG_W_DBCL];      break;
574      case REG_R_DBCH:   ret = LC8951RegistersW[REG_W_DBCH];      break;
577      case REG_R_DBCH:
578//         LC8951RegistersR[REG_R_DBCH] &=  0x0F; // NeoCD?
579//         LC8951RegistersR[REG_R_DBCH] |=  (LC8951RegistersR[REG_R_IFSTAT] & 0x40) ? 0x00 : 0xF0; // NeoCD?
580         ret = LC8951RegistersW[REG_W_DBCH];      break;
575581      case REG_R_HEAD0:  ret = LC8951RegistersR[REG_R_HEAD0];      break;
576582      case REG_R_HEAD1:  ret = LC8951RegistersR[REG_R_HEAD1];      break;
577583      case REG_R_HEAD2:  ret = LC8951RegistersR[REG_R_HEAD2];      break;
r19317r19318
581587      case REG_R_WAL:    ret = LC8951RegistersW[REG_W_WAL];      break;
582588      case REG_R_WAH:    ret = LC8951RegistersW[REG_W_WAH];      break;
583589      case REG_R_STAT0:  ret = LC8951RegistersR[REG_R_STAT0];      break;
584      case REG_R_STAT1:  ret = LC8951RegistersR[REG_R_STAT1];      break;
590      case REG_R_STAT1:  ret = LC8951RegistersR[REG_R_STAT1];   
591   //      LC8951RegistersR[REG_R_IFSTAT] |= 0x20;    // NeoCD? // reset DECI
592         break;
585593      case REG_R_STAT2:  ret = LC8951RegistersR[REG_R_STAT2];      break;
586594      case REG_R_STAT3:  ret = LC8951RegistersR[REG_R_STAT3];
587595
588         LC8951RegistersR[REG_R_IFSTAT] |= 0x20;
589
590         if ((LC8951RegistersW[REG_W_CTRL0] & 0x80) && (LC8951RegistersW[REG_W_IFCTRL] & 0x20))
596         LC8951RegistersR[REG_R_IFSTAT] |= 0x20; // SegaCD? // reset DECI
597         if (!is_neoCD)
591598         {
592            if ((CDC_DECODE & decoderegs) == decoderegs)
593            LC8951RegistersR[REG_R_STAT3] = 0x80;
599            if ((LC8951RegistersW[REG_W_CTRL0] & 0x80) && (LC8951RegistersW[REG_W_IFCTRL] & 0x20))
600            {
601               if ((CDC_DECODE & decoderegs) == decoderegs)
602               LC8951RegistersR[REG_R_STAT3] = 0x80;
603            }
594604         }
595605         break;
606
596607   }
597608
609
598610   return ret;
599611}
600612
r19317r19318
11571169            if (CDD_TX[0]) {
11581170               INT32  sum = 0;
11591171
1160                  printf("has command %02x\n", CDD_TX[0]);
1172               //   printf("has command %02x\n", CDD_TX[0]);
11611173
11621174//                  bprintf(PRINT_NORMAL, _T("  - CD mechanism command receive completed : 0x"));
11631175               for (INT32 i = 0; i < 9; i++) {
r19317r19318
11681180//                  bprintf(PRINT_NORMAL, _T(" (CS 0x%X, %s)\n"), CDD_TX[9], (sum == CDD_TX[9]) ? _T("OK") : _T("NG"));
11691181               if (sum == CDD_TX[9]) {
11701182
1171                  printf("request to process command %02x\n", CDD_TX[0]);
1183               //      printf("request to process command %02x\n", CDD_TX[0]);
11721184
11731185                  NeoCDProcessCommand();
11741186
r19317r19318
15221534
15231535UINT16 lc89510_temp_device::nff0016_r(void) { return nff0016; }
15241536
1525UINT16 lc89510_temp_device::nLC8951_r(void)
1526{
1527   int regno = CDC_REG0 & 0xf;
1528   INT32 reg = LC8951RegistersR[regno];
15291537
1530   switch (regno) {
1531      case 0x03:                                          // DBCH
1532         LC8951RegistersR[REG_R_DBCH] &=  0x0F;
1533         LC8951RegistersR[REG_R_DBCH] |=  (LC8951RegistersR[REG_R_IFSTAT] & 0x40) ? 0x00 : 0xF0;
1534         break;
1535      case 0x0D:                                          // STAT3
1536         LC8951RegistersR[REG_R_IFSTAT] |= 0x20;                        // reset DECI
1537         // bprintf(PRINT_ERROR, _T("  - DECI (PC: 0x%06X)\n"), SekGetPC(-1));
1538         break;
1539   }
1540
1541   CDC_REG0 = (regno + 1) & 0x0F;
1542   return reg;
1543}
1544
15451538void lc89510_temp_device::nLC8951_w(UINT16 byteValue)
15461539{
15471540   int regno = CDC_REG0 & 0xf;
trunk/src/mame/machine/megacdcd.h
r19317r19318
305305   void reset_NeoCd(void);
306306
307307   void nLC8951_w(UINT16 byteValue);
308   UINT16 nLC8951_r(void);
309308   UINT16 nff0016_r(void);
310309   void nff0016_set(UINT16 wordValue);
311310   void nff0002_set(UINT16 wordValue);
trunk/src/mess/drivers/ng_aes.c
r19317r19318
719719      case 0x0100:
720720         return m_tempcdc->segacd_cdc_mode_address_r(*curr_space, 0, 0xffff);
721721      case 0x0102:
722         return m_tempcdc->nLC8951_r();
722         return m_tempcdc->CDC_Reg_r();
723723
724724      // CD mechanism communication
725725      case 0x0160:

Previous 199869 Revisions Next


© 1997-2024 The MAME Team