static READ16_HANDLER( oki_r ) { if(offset) return OKIM6295_status_0_r(machine, 0); else return 0; }
static unsigned int read_memory_8(unsigned int address) { /* Mirror of C00000 - C03FFFF */ if (address < 0x004000) return workram[address]; /* Read only? mirror of FE4000 - FE7FFFF */ else if ((address >= 0x4000) && (address < 0x8000)) return workram[0x10000 + (address & 0x3fff)]; else if (address == 0x400003) return YM2151ReadStatus(0); else if (address == 0x40005) return OKIM6295_status_0_r(0); else if ((address >= 0xc00000) && (address < 0xc08000)) return workram[address & 0x7fff]; else if ((address >= 0xfe0000) && (address < 0xffffff)) return workram[0x10000 + (address & 0x1ffff)]; printf("R8 @ %x\n", address); return 0xff; }
static READ16_HANDLER( ioc_r ) { /* 20 (only once), 76, a0 are read in log */ switch (offset) { case 0x80/2: return input_port_0_word_r(0,mem_mask); /* DSW */ case 0x84/2: return input_port_1_word_r(0,mem_mask); /* IN0 */ case 0x86/2: return input_port_2_word_r(0,mem_mask); /* IN1 */ case 0x50: case 0x51: return OKIM6295_status_0_r(0)<<8; break; } /*logerror("CPU #0 PC %06x: warning - read unmapped ioc offset %06x\n",activecpu_get_pc(),offset); */ return gcpinbal_ioc_ram[offset]; }
static void sslam_play(int melody, int data) { int status = OKIM6295_status_0_r(0); logerror("Playing sample %01x:%02x from command %02x\n",sslam_snd_bank,sslam_sound,data); if (sslam_sound == 0) ui_popup("Unknown sound command %02x",sslam_sound); if (melody) { if (sslam_melody != sslam_sound) { sslam_melody = sslam_sound; sslam_melody_loop = sslam_sound; if (status & 0x08) OKIM6295_data_0_w(0,0x40); OKIM6295_data_0_w(0,(0x80 | sslam_melody)); OKIM6295_data_0_w(0,0x81); } } else { if ((status & 0x01) == 0) { OKIM6295_data_0_w(0,(0x80 | sslam_sound)); OKIM6295_data_0_w(0,0x11); } else if ((status & 0x02) == 0) { OKIM6295_data_0_w(0,(0x80 | sslam_sound)); OKIM6295_data_0_w(0,0x21); } else if ((status & 0x04) == 0) { OKIM6295_data_0_w(0,(0x80 | sslam_sound)); OKIM6295_data_0_w(0,0x41); } } }
static READ16_HANDLER( ioc_r ) { /* 20 (only once), 76, a0 are read in log */ switch (offset) { case 0x80/2: return input_port_read_indexed(machine,0); /* DSW */ case 0x84/2: return input_port_read_indexed(machine,1); /* IN0 */ case 0x86/2: return input_port_read_indexed(machine,2); /* IN1 */ case 0x50: case 0x51: return OKIM6295_status_0_r(machine,0)<<8; break; } //logerror("CPU #0 PC %06x: warning - read unmapped ioc offset %06x\n",activecpu_get_pc(),offset); return gcpinbal_ioc_ram[offset]; }
static void music_playback(int param) { int pattern = 0; if ((OKIM6295_status_0_r(0) & 0x08) == 0) { if (sslam_bar != 0) { sslam_bar += 1; if (sslam_bar >= (sslam_snd_loop[sslam_melody][0] + 1)) sslam_bar = 1; } pattern = sslam_snd_loop[sslam_melody][sslam_bar]; if (pattern == 0xff) { /* Restart track from first bar */ sslam_bar = 1; pattern = sslam_snd_loop[sslam_melody][sslam_bar]; } if (pattern == 0x00) { /* Non-looped track. Stop playing it */ sslam_track = 0; sslam_melody = 0; sslam_bar = 0; timer_enable(music_timer,0); } if (pattern) { logerror("Changing bar in music track to pattern %02x\n",pattern); OKIM6295_data_0_w(0,(0x80 | pattern)); OKIM6295_data_0_w(0,0x81); } } // { // pattern = sslam_snd_loop[sslam_melody][sslam_bar]; // popmessage("Music track: %02x, Melody: %02x, Pattern: %02x, Bar:%02d",sslam_track,sslam_melody,pattern,sslam_bar); // } }
static void play_oki_sound(int game_sound, int data) { int status = OKIM6295_status_0_r(0); logerror("Playing sample %02x from command %02x\n",game_sound,data); if (game_sound != 0) { if ((status & 0x01) == 0) { OKIM6295_data_0_w(0,(0x80 | game_sound)); OKIM6295_data_0_w(0,0x11); } else if ((status & 0x02) == 0) { OKIM6295_data_0_w(0,(0x80 | game_sound)); OKIM6295_data_0_w(0,0x21); } else if ((status & 0x04) == 0) { OKIM6295_data_0_w(0,(0x80 | game_sound)); OKIM6295_data_0_w(0,0x41); } else if ((status & 0x08) == 0) { OKIM6295_data_0_w(0,(0x80 | game_sound)); OKIM6295_data_0_w(0,0x81); } } }
static void sslam_play(int track, int data) { int status = OKIM6295_status_0_r(0); if (data < 0x80) { if (track) { if (sslam_track != data) { sslam_track = data; sslam_bar = 1; if (status & 0x08) OKIM6295_data_0_w(0,0x40); OKIM6295_data_0_w(0,(0x80 | data)); OKIM6295_data_0_w(0,0x81); timer_adjust(music_timer, TIME_IN_MSEC(4), 0, TIME_IN_HZ(250)); /* 250Hz for smooth sequencing */ } } else { if ((status & 0x01) == 0) { OKIM6295_data_0_w(0,(0x80 | data)); OKIM6295_data_0_w(0,0x11); } else if ((status & 0x02) == 0) { OKIM6295_data_0_w(0,(0x80 | data)); OKIM6295_data_0_w(0,0x21); } else if ((status & 0x04) == 0) { OKIM6295_data_0_w(0,(0x80 | data)); OKIM6295_data_0_w(0,0x41); } } } else { /* use above 0x80 to turn off channels */ if (track) { timer_enable(music_timer,0); sslam_track = 0; sslam_melody = 0; sslam_bar = 0; } data &= 0x7f; OKIM6295_data_0_w(0,data); } }
AM_RANGE(0xff0000, 0xffffff) AM_RAM /* Main RAM */ ADDRESS_MAP_END /* Sound MCU mapping */ static READ8_HANDLER( playmark_snd_command_r ) { UINT8 data = 0; if ((playmark_oki_control & 0x38) == 0x30) { data = soundlatch_r(0); } else if ((playmark_oki_control & 0x38) == 0x28) { data = (OKIM6295_status_0_r(0) & 0x0f); } return data; }
static INTERRUPT_GEN( sslam_interrupt ) { if ((OKIM6295_status_0_r(0) & 0x08) == 0) { switch(sslam_melody_loop) { case 0x060: sslam_melody_loop = 0x061; break; case 0x061: sslam_melody_loop = 0x062; break; case 0x062: sslam_melody_loop = 0x060; break; case 0x065: sslam_melody_loop = 0x165; break; case 0x165: sslam_melody_loop = 0x265; break; case 0x265: sslam_melody_loop = 0x365; break; case 0x365: sslam_melody_loop = 0x066; break; case 0x066: sslam_melody_loop = 0x067; break; case 0x067: sslam_melody_loop = 0x068; break; case 0x068: sslam_melody_loop = 0x065; break; case 0x063: sslam_melody_loop = 0x063; break; case 0x064: sslam_melody_loop = 0x064; break; case 0x069: sslam_melody_loop = 0x069; break; case 0x06a: sslam_melody_loop = 0x06a; break; case 0x06b: sslam_melody_loop = 0x06b; break; case 0x06c: sslam_melody_loop = 0x06c; break; default: sslam_melody_loop = 0x00; break; } if (sslam_melody_loop) { /* logerror("Changing to sample %02x\n",sslam_melody_loop); */ OKIM6295_data_0_w(0,((0x80 | sslam_melody_loop) & 0xff)); OKIM6295_data_0_w(0,0x81); } } }
static READ16_HANDLER( adpcm_r ) { return OKIM6295_status_0_r(offset) | 0xff00; }
static READ32_HANDLER( oki32_r ) { return OKIM6295_status_0_r(machine, 0) << 8; }
static READ32_HANDLER( oki_32bit_r ) { return OKIM6295_status_0_r(0); }
static READ32_HANDLER(silk_6295_0_r) { return OKIM6295_status_0_r(0)<<16; }
static READ32_HANDLER(dreamwld_6295_0_r) { return OKIM6295_status_0_r(0)<<24; }
static int adpcm_r(int offset) { return OKIM6295_status_0_r(offset) | 0xff00; }
static READ8_HANDLER( aquarium_oki_r ) { return (aquarium_snd_bitswap(OKIM6295_status_0_r(0)) ); }