Diff for /np2/sound/s98.c between versions 1.3 and 1.11

version 1.3, 2003/10/28 18:30:30 version 1.11, 2005/02/09 20:11:35
Line 4 Line 4
 //  //
   
 #include        "compiler.h"  #include        "compiler.h"
   
   #if defined(SUPPORT_S98)
   
 #include        "dosio.h"  #include        "dosio.h"
 #include        "pccore.h"  #include        "pccore.h"
 #include        "iocore.h"  #include        "iocore.h"
Line 15 Line 18
 #define S98LOG_BUFSIZE (32 * 1024)  #define S98LOG_BUFSIZE (32 * 1024)
   
 typedef struct {  typedef struct {
         BYTE    magic[3];          UINT8   magic[3];
         BYTE    formatversion;          UINT8   formatversion;
         BYTE    timerinfo[4];          UINT8   timerinfo[4];
         BYTE    timerinfo2[4];          UINT8   timerinfo2[4];
         BYTE    compressing[4];          UINT8   compressing[4];
         BYTE    offset[4];          UINT8   offset[4];
         BYTE    dumpdata[4];          UINT8   dumpdata[4];
         BYTE    looppoint[4];          UINT8   looppoint[4];
         BYTE    headerreserved[0x24];          UINT8   headerreserved[0x24];
         BYTE    title[0x40];          UINT8   title[0x40];
 } S98HDR;  } S98HDR;
   
 static struct {  static struct {
Line 32  static struct { Line 35  static struct {
         UINT32  intcount;          UINT32  intcount;
         SINT32  clock;          SINT32  clock;
         UINT    p;          UINT    p;
         BYTE    buf[S98LOG_BUFSIZE];          UINT8   buf[S98LOG_BUFSIZE];
 } s98log;  } s98log;
   
   
Line 61  static void S98_flush(void) { Line 64  static void S98_flush(void) {
         }          }
 }  }
   
 static void S98_putc(BYTE data) {  static void S98_putc(REG8 data) {
   
         s98log.buf[s98log.p++] = data;          s98log.buf[s98log.p++] = data;
         if (s98log.p == S98LOG_BUFSIZE) {          if (s98log.p == S98LOG_BUFSIZE) {
Line 83  static void S98_putint(void) { Line 86  static void S98_putint(void) {
                         S98_putc(0xFE);                                 /* SYNC(n) */                          S98_putc(0xFE);                                 /* SYNC(n) */
                         s98log.intcount -= 2;                          s98log.intcount -= 2;
                         while (s98log.intcount > 0x7f) {                          while (s98log.intcount > 0x7f) {
                                 S98_putc((BYTE)(0x80 | (s98log.intcount & 0x7f)));                                  S98_putc((REG8)(0x80 | (s98log.intcount & 0x7f)));
                                 s98log.intcount >>= 7;                                  s98log.intcount >>= 7;
                         }                          }
                         S98_putc((BYTE)(s98log.intcount & 0x7f));                          S98_putc((REG8)(s98log.intcount & 0x7f));
                 }                  }
                 s98log.intcount = 0;                  s98log.intcount = 0;
         }          }
Line 105  void S98_trash(void) { Line 108  void S98_trash(void) {
         S98_close();          S98_close();
 }  }
   
 BOOL S98_open(const char *filename) {  BRESULT S98_open(const OEMCHAR *filename) {
   
         UINT    i;          UINT    i;
         S98HDR  hdr;          S98HDR  hdr;
Line 117  BOOL S98_open(const char *filename) { Line 120  BOOL S98_open(const char *filename) {
         }          }
   
         // 初期化          // 初期化
         s98log.clock = pc.realclock / 1000;          s98log.clock = pccore.realclock / 1000;
         s98log.p = 0;          s98log.p = 0;
   
         // ヘッダの保存          // ヘッダの保存
Line 130  BOOL S98_open(const char *filename) { Line 133  BOOL S98_open(const char *filename) {
         STOREINTELDWORD(hdr.offset, offsetof(S98HDR, title));          STOREINTELDWORD(hdr.offset, offsetof(S98HDR, title));
         STOREINTELDWORD(hdr.dumpdata, sizeof(S98HDR));          STOREINTELDWORD(hdr.dumpdata, sizeof(S98HDR));
         for (i=0; i<sizeof(hdr); i++) {          for (i=0; i<sizeof(hdr); i++) {
                 S98_putc(*(((BYTE *)&hdr) + i));                  S98_putc(*(((UINT8 *)&hdr) + i));
         }          }
   
 #if 0  #if 1
         // FM          // FM
         for (i=0x30; i<0xb6; i++) {          for (i=0x30; i<0xb6; i++) {
                 if ((i & 3) != 3) {                  if ((i & 3) != 3) {
                         S98_putc(NORMAL2608);                          S98_putc(NORMAL2608);
                         S98_putc((BYTE)i);                          S98_putc((REG8)i);
                         S98_putc(opna.reg.b[i]);                          S98_putc(opn.reg[i]);
   
                         S98_putc(EXTEND2608);                          S98_putc(EXTEND2608);
                         S98_putc((BYTE)i);                          S98_putc((REG8)i);
                         S98_putc(opna.reg.b[i+0x100]);                          S98_putc(opn.reg[i+0x100]);
                 }                  }
         }          }
         // PSG          // PSG
         for (i=0x00; i<0x0e; i++) {          for (i=0x00; i<0x0e; i++) {
                 S98_putc(NORMAL2608);                  S98_putc(NORMAL2608);
                 S98_putc((BYTE)i);                  S98_putc((REG8)i);
                 S98_putc(opna.reg.b[i]);                  S98_putc(((UINT8 *)&psg1.reg)[i]);
         }          }
 #endif  #endif
   
Line 172  void S98_close(void) { Line 176  void S98_close(void) {
         }          }
 }  }
   
 void S98_put(BYTE module, BYTE addr, BYTE data) {  void S98_put(REG8 module, REG8 addr, REG8 data) {
   
         if (s98log.fh != FILEH_INVALID) {          if (s98log.fh != FILEH_INVALID) {
                 S98_putint();                  S98_putint();
Line 182  void S98_put(BYTE module, BYTE addr, BYT Line 186  void S98_put(BYTE module, BYTE addr, BYT
         }          }
 }  }
   
   void S98_sync(void) {
   }
   #endif
   

Removed from v.1.3  
changed lines
  Added in v.1.11


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