|
|
| version 1.13, 2003/10/25 09:08:24 | version 1.15, 2003/11/08 21:43:00 |
|---|---|
| Line 12 | Line 12 |
| #include "pc9861k.h" | #include "pc9861k.h" |
| #include "mpu98ii.h" | #include "mpu98ii.h" |
| #include "board14.h" | #include "board14.h" |
| #include "amd98.h" | |
| #include "bios.h" | #include "bios.h" |
| #include "vram.h" | #include "vram.h" |
| #include "palettes.h" | #include "palettes.h" |
| Line 654 enum { | Line 655 enum { |
| FLAG_FM2B = 0x0010, | FLAG_FM2B = 0x0010, |
| FLAG_PSG1 = 0x0020, | FLAG_PSG1 = 0x0020, |
| FLAG_PSG2 = 0x0040, | FLAG_PSG2 = 0x0040, |
| FLAG_RHYTHM = 0x0080, | FLAG_PSG3 = 0x0080, |
| FLAG_ADPCM = 0x0100, | FLAG_RHYTHM = 0x0100, |
| FLAG_PCM86 = 0x0200, | FLAG_ADPCM = 0x0200, |
| FLAG_CS4231 = 0x0400 | FLAG_PCM86 = 0x0400, |
| FLAG_CS4231 = 0x0800 | |
| }; | }; |
| typedef struct { | typedef struct { |
| Line 710 static int flagsave_fm(NP2FFILE f, const | Line 712 static int flagsave_fm(NP2FFILE f, const |
| FLAG_PSG1 | FLAG_RHYTHM | FLAG_ADPCM; | FLAG_PSG1 | FLAG_RHYTHM | FLAG_ADPCM; |
| break; | break; |
| case 0x80: | |
| saveflg = FLAG_PSG1 | FLAG_PSG2 | FLAG_PSG3; | |
| break; | |
| default: | default: |
| saveflg = 0; | saveflg = 0; |
| break; | break; |
| Line 738 static int flagsave_fm(NP2FFILE f, const | Line 744 static int flagsave_fm(NP2FFILE f, const |
| if (saveflg & FLAG_PSG2) { | if (saveflg & FLAG_PSG2) { |
| ret |= flagsave_save(f, &psg2.reg, sizeof(PSGREG)); | ret |= flagsave_save(f, &psg2.reg, sizeof(PSGREG)); |
| } | } |
| if (saveflg & FLAG_PSG3) { | |
| ret |= flagsave_save(f, &psg3.reg, sizeof(PSGREG)); | |
| } | |
| if (saveflg & FLAG_ADPCM) { | if (saveflg & FLAG_ADPCM) { |
| ret |= flagsave_save(f, &adpcm, sizeof(adpcm)); | ret |= flagsave_save(f, &adpcm, sizeof(adpcm)); |
| } | } |
| Line 752 static int flagsave_fm(NP2FFILE f, const | Line 761 static int flagsave_fm(NP2FFILE f, const |
| return(ret); | return(ret); |
| } | } |
| static void play_fmreg(BYTE num) { | static void play_fmreg(BYTE num, UINT reg) { |
| UINT chbase; | UINT chbase; |
| UINT reg; | |
| UINT i; | UINT i; |
| chbase = num * 3; | chbase = num * 3; |
| reg = num * 0x100; | |
| for (i=0x30; i<0xa0; i++) { | for (i=0x30; i<0xa0; i++) { |
| opngen_setreg((BYTE)chbase, (BYTE)i, opn.reg[reg + i]); | opngen_setreg((BYTE)chbase, (BYTE)i, opn.reg[reg + i]); |
| } | } |
| Line 785 static int flagload_fm(NP2FFILE f, const | Line 792 static int flagload_fm(NP2FFILE f, const |
| int ret; | int ret; |
| UINT saveflg; | UINT saveflg; |
| OPNKEY opnkey; | OPNKEY opnkey; |
| UINT fmreg1a; | |
| UINT fmreg1b; | |
| UINT fmreg2a; | |
| UINT fmreg2b; | |
| opngen_reset(); | opngen_reset(); |
| psggen_reset(&psg1); | psggen_reset(&psg1); |
| Line 798 static int flagload_fm(NP2FFILE f, const | Line 809 static int flagload_fm(NP2FFILE f, const |
| ret = flagload_load(f, &usesound, sizeof(usesound)); | ret = flagload_load(f, &usesound, sizeof(usesound)); |
| fmboard_reset((BYTE)usesound); | fmboard_reset((BYTE)usesound); |
| fmreg1a = 0x000; | |
| fmreg1b = 0x100; | |
| fmreg2a = 0x200; | |
| fmreg2b = 0x300; | |
| switch(usesound) { | switch(usesound) { |
| case 0x01: | case 0x01: |
| saveflg = FLAG_MG; | saveflg = FLAG_MG; |
| Line 815 static int flagload_fm(NP2FFILE f, const | Line 830 static int flagload_fm(NP2FFILE f, const |
| case 0x06: | case 0x06: |
| saveflg = FLAG_FM1A | FLAG_FM1B | FLAG_FM2A | FLAG_PSG1 | | saveflg = FLAG_FM1A | FLAG_FM1B | FLAG_FM2A | FLAG_PSG1 | |
| FLAG_PSG2 | FLAG_RHYTHM | FLAG_PCM86; | FLAG_PSG2 | FLAG_RHYTHM | FLAG_PCM86; |
| fmreg1a = 0x200; // 逆転してるのん… | |
| fmreg1b = 0x000; | |
| fmreg2a = 0x100; | |
| break; | break; |
| case 0x08: | case 0x08: |
| Line 837 static int flagload_fm(NP2FFILE f, const | Line 855 static int flagload_fm(NP2FFILE f, const |
| FLAG_PSG1 | FLAG_RHYTHM | FLAG_ADPCM; | FLAG_PSG1 | FLAG_RHYTHM | FLAG_ADPCM; |
| break; | break; |
| case 0x80: | |
| saveflg = FLAG_PSG1 | FLAG_PSG2 | FLAG_PSG3; | |
| break; | |
| default: | default: |
| saveflg = 0; | saveflg = 0; |
| break; | break; |
| Line 863 static int flagload_fm(NP2FFILE f, const | Line 885 static int flagload_fm(NP2FFILE f, const |
| if (saveflg & FLAG_PSG2) { | if (saveflg & FLAG_PSG2) { |
| ret |= flagload_load(f, &psg2.reg, sizeof(PSGREG)); | ret |= flagload_load(f, &psg2.reg, sizeof(PSGREG)); |
| } | } |
| if (saveflg & FLAG_PSG3) { | |
| ret |= flagload_load(f, &psg3.reg, sizeof(PSGREG)); | |
| } | |
| if (saveflg & FLAG_ADPCM) { | if (saveflg & FLAG_ADPCM) { |
| ret |= flagload_load(f, &adpcm, sizeof(adpcm)); | ret |= flagload_load(f, &adpcm, sizeof(adpcm)); |
| } | } |
| Line 886 static int flagload_fm(NP2FFILE f, const | Line 911 static int flagload_fm(NP2FFILE f, const |
| } | } |
| if (saveflg & FLAG_FM1A) { | if (saveflg & FLAG_FM1A) { |
| play_fmreg(0); | play_fmreg(0, fmreg1a); |
| } | } |
| if (saveflg & FLAG_FM1B) { | if (saveflg & FLAG_FM1B) { |
| play_fmreg(1); | play_fmreg(1, fmreg1b); |
| } | } |
| if (saveflg & FLAG_FM2A) { | if (saveflg & FLAG_FM2A) { |
| play_fmreg(2); | play_fmreg(2, fmreg2a); |
| } | } |
| if (saveflg & FLAG_FM2B) { | if (saveflg & FLAG_FM2B) { |
| play_fmreg(3); | play_fmreg(3, fmreg2b); |
| } | } |
| if (saveflg & FLAG_PSG1) { | if (saveflg & FLAG_PSG1) { |
| play_psgreg(&psg1); | play_psgreg(&psg1); |
| Line 903 static int flagload_fm(NP2FFILE f, const | Line 928 static int flagload_fm(NP2FFILE f, const |
| if (saveflg & FLAG_PSG2) { | if (saveflg & FLAG_PSG2) { |
| play_psgreg(&psg2); | play_psgreg(&psg2); |
| } | } |
| if (saveflg & FLAG_PSG3) { | |
| play_psgreg(&psg3); | |
| } | |
| (void)t; | (void)t; |
| return(ret); | return(ret); |
| } | } |