Diff for /np2/win9x/board118.c between versions 1.1 and 1.9

version 1.1, 2004/02/03 08:24:40 version 1.9, 2008/02/17 01:29:17
Line 20  static void romeo_restore(BOOL opna) { Line 20  static void romeo_restore(BOOL opna) {
         for (i=0x30; i<0xa0; i++) {          for (i=0x30; i<0xa0; i++) {
                 juliet_YMF288A(i, opn.reg[i]);                  juliet_YMF288A(i, opn.reg[i]);
         }          }
         for (i=0xb7; i>=0xa0; i--) {          for (i=0; i<3; i++) {
                 juliet_YMF288A(i, opn.reg[i]);                  juliet_YMF288A((UINT8)(i + 0xa4), opn.reg[i + 0x0a4]);
                   juliet_YMF288A((UINT8)(i + 0xa0), opn.reg[i + 0x0a0]);
                   juliet_YMF288A((UINT8)(i + 0xb0), opn.reg[i + 0x0b0]);
                   juliet_YMF288A((UINT8)(i + 0xb4), opn.reg[i + 0x0b4]);
         }          }
         if (opna) {          if (opna) {
                 for (i=0x30; i<0xa0; i++) {                  for (i=0x30; i<0xa0; i++) {
                         juliet_YMF288B(i, opn.reg[i + 0x100]);                          juliet_YMF288B(i, opn.reg[i + 0x100]);
                 }                  }
                 for (i=0xb7; i>=0xa0; i--) {                  for (i=0; i<3; i++) {
                         juliet_YMF288B(i, opn.reg[i + 0x100]);                          juliet_YMF288B((UINT8)(i + 0xa4), opn.reg[i + 0x1a4]);
                           juliet_YMF288B((UINT8)(i + 0xa0), opn.reg[i + 0x1a0]);
                           juliet_YMF288B((UINT8)(i + 0xb0), opn.reg[i + 0x1b0]);
                           juliet_YMF288B((UINT8)(i + 0xb4), opn.reg[i + 0x1b4]);
                 }                  }
                 juliet_YMF288A(0x11, opn.reg[0x11]);                  juliet_YMF288A(0x11, opn.reg[0x11]);
                 juliet_YMF288A(0x18, opn.reg[0x18]);                  juliet_YMF288A(0x18, opn.reg[0x18]);
Line 39  static void romeo_restore(BOOL opna) { Line 45  static void romeo_restore(BOOL opna) {
                 juliet_YMF288A(0x1d, opn.reg[0x1d]);                  juliet_YMF288A(0x1d, opn.reg[0x1d]);
         }          }
         for (i=0; i<0x0e; i++) {          for (i=0; i<0x0e; i++) {
                 juliet_YMF288A(i, ((BYTE *)&psg1.reg)[i]);                  juliet_YMF288A(i, ((UINT8 *)&psg1.reg)[i]);
         }          }
 }  }
   
Line 48  static void romeo_restore(BOOL opna) { Line 54  static void romeo_restore(BOOL opna) {
   
 static void IOOUTCALL ymf_o188(UINT port, REG8 dat) {  static void IOOUTCALL ymf_o188(UINT port, REG8 dat) {
   
         opn.opnreg = dat;          opn.addr = dat;
           opn.data = dat;
         (void)port;          (void)port;
 }  }
   
 static void IOOUTCALL ymf_o18a(UINT port, REG8 dat) {  static void IOOUTCALL ymf_o18a(UINT port, REG8 dat) {
   
         S98_put(NORMAL2608, opn.opnreg, dat);          UINT    addr;
         if (opn.opnreg < 0x10) {  
                 if (opn.opnreg != 0x0e) {          opn.data = dat;
                         psggen_setreg(&psg1, opn.opnreg, dat);          addr = opn.addr;
           if (addr >= 0x100) {
                   return;
           }
           S98_put(NORMAL2608, addr, dat);
           if (addr < 0x10) {
                   if (addr != 0x0e) {
                           psggen_setreg(&psg1, addr, dat);
                 }                  }
         }          }
         else {          else {
                 if (opn.opnreg < 0x20) {                  if (addr < 0x20) {
                         rhythm_setreg(&rhythm, opn.opnreg, dat);                          rhythm_setreg(&rhythm, addr, dat);
                 }                  }
                 else if (opn.opnreg < 0x30) {                  else if (addr < 0x30) {
                         if (opn.opnreg == 0x28) {                          if (addr == 0x28) {
                                 if ((dat & 0x0f) < 3) {                                  if ((dat & 0x0f) < 3) {
                                         opngen_keyon(dat & 0x0f, dat);                                          opngen_keyon(dat & 0x0f, dat);
                                 }                                  }
Line 75  static void IOOUTCALL ymf_o18a(UINT port Line 89  static void IOOUTCALL ymf_o18a(UINT port
                                 }                                  }
                         }                          }
                         else {                          else {
                                 fmtimer_setreg(opn.opnreg, dat);                                  fmtimer_setreg(addr, dat);
                         }                          }
                 }                  }
                 else if (opn.opnreg < 0xc0) {                  else if (addr < 0xc0) {
                         opngen_setreg(0, opn.opnreg, dat);                          opngen_setreg(0, addr, dat);
                 }                  }
                 opn.reg[opn.opnreg] = dat;                  opn.reg[addr] = dat;
         }          }
         (void)port;          (void)port;
 }  }
   
 static void IOOUTCALL ymf_o18c(UINT port, REG8 dat) {  static void IOOUTCALL ymf_o18c(UINT port, REG8 dat) {
   
         opn.extreg = dat;          if (opn.extend) {
                   opn.addr = dat + 0x100;
                   opn.data = dat;
           }
         (void)port;          (void)port;
 }  }
   
 static void IOOUTCALL ymf_o18e(UINT port, REG8 dat) {  static void IOOUTCALL ymf_o18e(UINT port, REG8 dat) {
   
         S98_put(EXTEND2608, opn.extreg, dat);          UINT    addr;
         opn.reg[opn.extreg + 0x100] = dat;  
         if (opn.extreg >= 0x30) {          if (!opn.extend) {
                 opngen_setreg(3, opn.extreg, dat);                  return;
           }
           opn.data = dat;
           addr = opn.addr - 0x100;
           if (addr >= 0x100) {
                   return;
           }
           S98_put(EXTEND2608, addr, dat);
           opn.reg[addr + 0x100] = dat;
           if (addr >= 0x30) {
                   opngen_setreg(3, addr, dat);
         }          }
         else {          else {
                 if (opn.extreg == 0x10) {                  if (addr == 0x10) {
                         if (!(dat & 0x80)) {                          if (!(dat & 0x80)) {
                                 opn.adpcmmask = ~(dat & 0x1c);                                  opn.adpcmmask = ~(dat & 0x1c);
                         }                          }
Line 117  static REG8 IOINPCALL ymf_i188(UINT port Line 144  static REG8 IOINPCALL ymf_i188(UINT port
   
 static REG8 IOINPCALL ymf_i18a(UINT port) {  static REG8 IOINPCALL ymf_i18a(UINT port) {
   
         if (opn.opnreg == 0x0e) {          UINT    addr;
   
           addr = opn.addr;
           if (addr == 0x0e) {
                 return(fmboard_getjoy(&psg1));                  return(fmboard_getjoy(&psg1));
         }          }
         else if (opn.opnreg < 0x10) {          else if (addr < 0x10) {
                 return(psggen_getreg(&psg1, opn.opnreg));                  return(psggen_getreg(&psg1, addr));
           }
           else if (addr == 0xff) {
                   return(1);
         }          }
         (void)port;          (void)port;
         return(opn.reg[opn.opnreg]);          return(opn.data);
 }  }
   
 static REG8 IOINPCALL ymf_i18c(UINT port) {  static REG8 IOINPCALL ymf_i18c(UINT port) {
Line 136  static REG8 IOINPCALL ymf_i18c(UINT port Line 169  static REG8 IOINPCALL ymf_i18c(UINT port
         return(0xff);          return(0xff);
 }  }
   
 static REG8 IOINPCALL ymf_i18e(UINT port) {  
   
         if (opn.extend) {  
                 return(opn.reg[opn.opnreg]);  
         }  
         (void)port;  
         return(0xff);  
 }  
   
 static void extendchannel(REG8 enable) {  static void extendchannel(REG8 enable) {
   
         opn.extend = enable;          opn.extend = enable;
Line 177  static REG8 IOINPCALL ymf_ia460(UINT por Line 201  static REG8 IOINPCALL ymf_ia460(UINT por
   
 static void IOOUTCALL ymfr_o18a(UINT port, REG8 dat) {  static void IOOUTCALL ymfr_o18a(UINT port, REG8 dat) {
   
         S98_put(NORMAL2608, opn.opnreg, dat);          UINT    addr;
         if (opn.opnreg < 0x10) {  
                 if (opn.opnreg != 0x0e) {          opn.data = dat;
                         *((BYTE *)(&psg1.reg) + opn.opnreg) = dat;          addr = opn.addr;
                         juliet_YMF288A(opn.opnreg, dat);          if (addr >= 0x100) {
                         if (opn.opnreg == 0x07) {                  return;
           }
           S98_put(NORMAL2608, addr, dat);
           if (addr < 0x10) {
                   *((UINT8 *)(&psg1.reg) + addr) = dat;
                   if (addr < 0x0e) {
                           juliet_YMF288A(addr, dat);
                           if (addr == 0x07) {
                                 keydisp_psgmix(&psg1);                                  keydisp_psgmix(&psg1);
                         }                          }
                         else if ((opn.opnreg == 0x08) || (opn.opnreg == 0x09) ||                          else if ((addr == 0x08) || (addr == 0x09) || (addr == 0x0a)) {
                                         (opn.opnreg == 0x0a)) {                                  keydisp_psgvol(&psg1, (UINT8)(addr - 8));
                                 keydisp_psgvol(&psg1, (BYTE)(opn.opnreg - 8));  
                         }                          }
                 }                  }
         }          }
         else {          else {
                 if (opn.opnreg < 0x20) {                  if (addr < 0x20) {
                         juliet_YMF288A(opn.opnreg, dat);                          juliet_YMF288A(addr, dat);
                 }                  }
                 else if (opn.opnreg < 0x30) {                  else if (addr < 0x30) {
                         if (opn.opnreg == 0x28) {                          if (addr == 0x28) {
                                 juliet_YMF288A(opn.opnreg, dat);                                  juliet_YMF288A(addr, dat);
                                 if ((dat & 0x0f) < 3) {                                  if ((dat & 0x0f) < 3) {
                                         keydisp_fmkeyon((BYTE)(dat & 0x0f), dat);                                          keydisp_fmkeyon((UINT8)(dat & 0x0f), dat);
                                 }                                  }
                                 else if (((dat & 0x0f) != 3) && ((dat & 0x0f) < 7)) {                                  else if (((dat & 0x0f) != 3) && ((dat & 0x0f) < 7)) {
                                         keydisp_fmkeyon((UINT8)((dat & 0x0f) - 1), dat);                                          keydisp_fmkeyon((UINT8)((dat & 0x0f) - 1), dat);
                                 }                                  }
                         }                          }
                         else {                          else {
                                 fmtimer_setreg(opn.opnreg, dat);                                  fmtimer_setreg(addr, dat);
                         }                          }
                 }                  }
                 else if (opn.opnreg < 0xc0) {                  else if (addr < 0xc0) {
                         juliet_YMF288A(opn.opnreg, dat);                          juliet_YMF288A(addr, dat);
                 }                  }
                 opn.reg[opn.opnreg] = dat;                  opn.reg[addr] = dat;
         }          }
         (void)port;          (void)port;
 }  }
   
 static void IOOUTCALL ymfr_o18e(UINT port, REG8 dat) {  static void IOOUTCALL ymfr_o18e(UINT port, REG8 dat) {
   
         S98_put(EXTEND2608, opn.extreg, dat);          UINT    addr;
         opn.reg[opn.extreg + 0x100] = dat;  
         if (opn.extreg >= 0x30) {          if (!opn.extend) {
                 juliet_YMF288B(opn.extreg, dat);                  return;
           }
           opn.data = dat;
           addr = opn.addr - 0x100;
           if (addr >= 0x100) {
                   return;
           }
           S98_put(EXTEND2608, addr, dat);
           opn.reg[addr + 0x100] = dat;
           if (addr >= 0x30) {
                   juliet_YMF288B(addr, dat);
         }          }
         else {          else {
                 if (opn.extreg == 0x10) {                  if (addr == 0x10) {
                         if (!(dat & 0x80)) {                          if (!(dat & 0x80)) {
                                 opn.adpcmmask = ~(dat & 0x1c);                                  opn.adpcmmask = ~(dat & 0x1c);
                         }                          }
Line 241  static const IOOUT ymf_o[4] = { Line 281  static const IOOUT ymf_o[4] = {
                         ymf_o188,       ymf_o18a,       ymf_o18c,       ymf_o18e};                          ymf_o188,       ymf_o18a,       ymf_o18c,       ymf_o18e};
   
 static const IOINP ymf_i[4] = {  static const IOINP ymf_i[4] = {
                         ymf_i188,       ymf_i18a,       ymf_i18c,       ymf_i18e};                          ymf_i188,       ymf_i18a,       ymf_i18c,       NULL};
   
 static const IOOUT ymfr_o[4] = {  static const IOOUT ymfr_o[4] = {
                         ymf_o188,       ymfr_o18a,      ymf_o18c,       ymfr_o18e};                          ymf_o188,       ymfr_o18a,      ymf_o18c,       ymfr_o18e};
   
   
 void board118_reset(void) {  void board118_reset(const NP2CFG *pConfig) {
   
         fmtimer_reset(0xc0);          fmtimer_reset(0xc0);
         opngen_setcfg(3, OPN_STEREO | 0x038);          opngen_setcfg(3, OPN_STEREO | 0x038);
         cs4231io_reset();          cs4231io_reset();
         soundrom_load(0xcc000, "118");          soundrom_load(0xcc000, OEMTEXT("118"));
         fmboard_extreg(extendchannel);          fmboard_extreg(extendchannel);
         juliet_YMF288Reset();          juliet_YMF288Reset();
 }  }
Line 275  void board118_bind(void) { Line 315  void board118_bind(void) {
                 fmboard_rhyrestore(&rhythm, 0);                  fmboard_rhyrestore(&rhythm, 0);
                 sound_streamregist(&opngen, (SOUNDCB)opngen_getpcm);                  sound_streamregist(&opngen, (SOUNDCB)opngen_getpcm);
                 sound_streamregist(&psg1, (SOUNDCB)psggen_getpcm);                  sound_streamregist(&psg1, (SOUNDCB)psggen_getpcm);
                 sound_streamregist(&rhythm, (SOUNDCB)rhythm_getpcm);                  rhythm_bind(&rhythm);
                 cbuscore_attachsndex(0x188, ymf_o, ymf_i);                  cbuscore_attachsndex(0x188, ymf_o, ymf_i);
         }          }
         cs4231io_bind();          cs4231io_bind();

Removed from v.1.1  
changed lines
  Added in v.1.9


RetroPC.NET-CVS <cvs@retropc.net>