|
|
| version 1.2, 2003/10/17 03:52:24 | 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 12 | Line 15 |
| #include "s98.h" | #include "s98.h" |
| #define S98LOG_BUFSIZE (32*1024) | #define S98LOG_BUFSIZE (32 * 1024) |
| typedef struct { // UINT32は 常に 0fillされてる | typedef struct { |
| BYTE magic[3]; | UINT8 magic[3]; |
| BYTE formatversion; | UINT8 formatversion; |
| UINT32 timerinfo; | UINT8 timerinfo[4]; |
| UINT32 timerinfo2; | UINT8 timerinfo2[4]; |
| UINT32 compressing; | UINT8 compressing[4]; |
| UINT32 offset; | UINT8 offset[4]; |
| UINT32 dumpdata; | UINT8 dumpdata[4]; |
| UINT32 looppoint; | UINT8 looppoint[4]; |
| BYTE headerreserved[0x24]; | UINT8 headerreserved[0x24]; |
| BYTE title[0x40]; | UINT8 title[0x40]; |
| } S98HDR; | } S98HDR; |
| static const S98HDR s98hdr = | |
| {{'S','9','8'}, '1', 1, 0, 0, 0x40, 0x80, 0, {0}, {0}}; | |
| static struct { | static struct { |
| FILEH fh; | FILEH fh; |
| UINT32 intcount; | UINT32 intcount; |
| SINT32 clock; | SINT32 clock; |
| UINT p; | UINT p; |
| BYTE buf[S98LOG_BUFSIZE]; | UINT8 buf[S98LOG_BUFSIZE]; |
| } s98log; | } s98log; |
| Line 64 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 86 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 108 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; | |
| // ファイルのオープン | // ファイルのオープン |
| s98log.fh = file_create(filename); | s98log.fh = file_create(filename); |
| Line 119 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; |
| // ヘッダの保存 | // ヘッダの保存 |
| for (i=0; i<sizeof(s98hdr); i++) { | ZeroMemory(&hdr, sizeof(hdr)); |
| S98_putc(*(((BYTE *)&s98hdr) + i)); | hdr.magic[0] = 'S'; |
| hdr.magic[1] = '9'; | |
| hdr.magic[2] = '8'; | |
| hdr.formatversion = '1'; | |
| STOREINTELDWORD(hdr.timerinfo, 1); | |
| STOREINTELDWORD(hdr.offset, offsetof(S98HDR, title)); | |
| STOREINTELDWORD(hdr.dumpdata, sizeof(S98HDR)); | |
| for (i=0; i<sizeof(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 166 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 176 void S98_put(BYTE module, BYTE addr, BYT | Line 186 void S98_put(BYTE module, BYTE addr, BYT |
| } | } |
| } | } |
| void S98_sync(void) { | |
| } | |
| #endif | |