trunk/src/mame/drivers/chinagat.c
| r21062 | r21063 | |
| 83 | 83 | #define MAIN_CLOCK XTAL_12MHz |
| 84 | 84 | #define PIXEL_CLOCK MAIN_CLOCK / 2 |
| 85 | 85 | |
| 86 | class chinagat_state : public ddragon_state |
| 87 | { |
| 88 | public: |
| 89 | chinagat_state(const machine_config &mconfig, device_type type, const char *tag) |
| 90 | : ddragon_state(mconfig, type, tag) {}; |
| 86 | 91 | |
| 92 | TIMER_DEVICE_CALLBACK_MEMBER(chinagat_scanline); |
| 93 | DECLARE_DRIVER_INIT(chinagat); |
| 94 | DECLARE_MACHINE_START(chinagat); |
| 95 | DECLARE_MACHINE_RESET(chinagat); |
| 96 | DECLARE_VIDEO_START(chinagat); |
| 97 | DECLARE_WRITE8_MEMBER( chinagat_interrupt_w ); |
| 98 | DECLARE_WRITE8_MEMBER( chinagat_video_ctrl_w ); |
| 99 | DECLARE_WRITE8_MEMBER( chinagat_bankswitch_w ); |
| 100 | DECLARE_WRITE8_MEMBER( chinagat_sub_bankswitch_w ); |
| 101 | DECLARE_READ8_MEMBER( saiyugoub1_mcu_command_r ); |
| 102 | DECLARE_WRITE8_MEMBER( saiyugoub1_mcu_command_w ); |
| 103 | DECLARE_WRITE8_MEMBER( saiyugoub1_adpcm_rom_addr_w ); |
| 104 | DECLARE_WRITE8_MEMBER( saiyugoub1_adpcm_control_w ); |
| 105 | DECLARE_WRITE8_MEMBER( saiyugoub1_m5205_clk_w ); |
| 106 | DECLARE_READ8_MEMBER( saiyugoub1_m5205_irq_r ); |
| 107 | }; |
| 108 | |
| 109 | |
| 110 | VIDEO_START_MEMBER(chinagat_state,chinagat) |
| 111 | { |
| 112 | m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(chinagat_state::get_bg_tile_info),this),tilemap_mapper_delegate(FUNC(chinagat_state::background_scan),this), 16, 16, 32, 32); |
| 113 | m_fg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(chinagat_state::get_fg_16color_tile_info),this),TILEMAP_SCAN_ROWS, 8, 8, 32, 32); |
| 114 | |
| 115 | m_fg_tilemap->set_transparent_pen(0); |
| 116 | m_fg_tilemap->set_scrolldy(-8, -8); |
| 117 | m_bg_tilemap->set_scrolldy(-8, -8); |
| 118 | } |
| 87 | 119 | /* |
| 88 | 120 | Based on the Solar Warrior schematics, vertical timing counts as follows: |
| 89 | 121 | |
| r21062 | r21063 | |
| 99 | 131 | Since MAME's video timing is 0-based, we need to convert this. |
| 100 | 132 | */ |
| 101 | 133 | |
| 102 | | TIMER_DEVICE_CALLBACK_MEMBER(ddragon_state::chinagat_scanline) |
| 134 | TIMER_DEVICE_CALLBACK_MEMBER(chinagat_state::chinagat_scanline) |
| 103 | 135 | { |
| 104 | 136 | int scanline = param; |
| 105 | 137 | int screen_height = machine().primary_screen->height(); |
| r21062 | r21063 | |
| 123 | 155 | scanline = 0; |
| 124 | 156 | } |
| 125 | 157 | |
| 126 | | static WRITE8_HANDLER( chinagat_interrupt_w ) |
| 127 | | { |
| 128 | | ddragon_state *state = space.machine().driver_data<ddragon_state>(); |
| 129 | | |
| 158 | WRITE8_MEMBER(chinagat_state::chinagat_interrupt_w ) |
| 159 | { |
| 130 | 160 | switch (offset) |
| 131 | 161 | { |
| 132 | 162 | case 0: /* 3e00 - SND irq */ |
| 133 | | state->soundlatch_byte_w(space, 0, data); |
| 134 | | state->m_snd_cpu->execute().set_input_line(state->m_sound_irq, (state->m_sound_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE ); |
| 163 | soundlatch_byte_w(space, 0, data); |
| 164 | m_snd_cpu->execute().set_input_line(m_sound_irq, (m_sound_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE ); |
| 135 | 165 | break; |
| 136 | 166 | |
| 137 | 167 | case 1: /* 3e01 - NMI ack */ |
| 138 | | state->m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); |
| 168 | m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); |
| 139 | 169 | break; |
| 140 | 170 | |
| 141 | 171 | case 2: /* 3e02 - FIRQ ack */ |
| 142 | | state->m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); |
| 172 | m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); |
| 143 | 173 | break; |
| 144 | 174 | |
| 145 | 175 | case 3: /* 3e03 - IRQ ack */ |
| 146 | | state->m_maincpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE); |
| 176 | m_maincpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE); |
| 147 | 177 | break; |
| 148 | 178 | |
| 149 | 179 | case 4: /* 3e04 - sub CPU IRQ ack */ |
| 150 | | state->m_sub_cpu->execute().set_input_line(state->m_sprite_irq, (state->m_sprite_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE ); |
| 180 | m_sub_cpu->execute().set_input_line(m_sprite_irq, (m_sprite_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE ); |
| 151 | 181 | break; |
| 152 | 182 | } |
| 153 | 183 | } |
| 154 | 184 | |
| 155 | | static WRITE8_HANDLER( chinagat_video_ctrl_w ) |
| 185 | WRITE8_MEMBER(chinagat_state::chinagat_video_ctrl_w ) |
| 156 | 186 | { |
| 157 | 187 | /*************************** |
| 158 | 188 | ---- ---x X Scroll MSB |
| r21062 | r21063 | |
| 160 | 190 | ---- -x-- Flip screen |
| 161 | 191 | --x- ---- Enable video ??? |
| 162 | 192 | ****************************/ |
| 163 | | ddragon_state *state = space.machine().driver_data<ddragon_state>(); |
| 193 | m_scrolly_hi = ((data & 0x02) >> 1); |
| 194 | m_scrollx_hi = data & 0x01; |
| 164 | 195 | |
| 165 | | state->m_scrolly_hi = ((data & 0x02) >> 1); |
| 166 | | state->m_scrollx_hi = data & 0x01; |
| 167 | | |
| 168 | | state->flip_screen_set(~data & 0x04); |
| 196 | flip_screen_set(~data & 0x04); |
| 169 | 197 | } |
| 170 | 198 | |
| 171 | | static WRITE8_HANDLER( chinagat_bankswitch_w ) |
| 199 | WRITE8_MEMBER(chinagat_state::chinagat_bankswitch_w ) |
| 172 | 200 | { |
| 173 | 201 | space.machine().root_device().membank("bank1")->set_entry(data & 0x07); // shall we check (data & 7) < 6 (# of banks)? |
| 174 | 202 | } |
| 175 | 203 | |
| 176 | | static WRITE8_HANDLER( chinagat_sub_bankswitch_w ) |
| 204 | WRITE8_MEMBER(chinagat_state::chinagat_sub_bankswitch_w ) |
| 177 | 205 | { |
| 178 | 206 | space.machine().root_device().membank("bank4")->set_entry(data & 0x07); // shall we check (data & 7) < 6 (# of banks)? |
| 179 | 207 | } |
| 180 | 208 | |
| 181 | | static READ8_HANDLER( saiyugoub1_mcu_command_r ) |
| 209 | READ8_MEMBER(chinagat_state::saiyugoub1_mcu_command_r ) |
| 182 | 210 | { |
| 183 | | ddragon_state *state = space.machine().driver_data<ddragon_state>(); |
| 184 | 211 | #if 0 |
| 185 | | if (state->m_mcu_command == 0x78) |
| 212 | if (m_mcu_command == 0x78) |
| 186 | 213 | { |
| 187 | 214 | space.machine().device<cpu_device>("mcu")->suspend(SUSPEND_REASON_HALT, 1); /* Suspend (speed up) */ |
| 188 | 215 | } |
| 189 | 216 | #endif |
| 190 | | return state->m_mcu_command; |
| 217 | return m_mcu_command; |
| 191 | 218 | } |
| 192 | 219 | |
| 193 | | static WRITE8_HANDLER( saiyugoub1_mcu_command_w ) |
| 220 | WRITE8_MEMBER(chinagat_state::saiyugoub1_mcu_command_w ) |
| 194 | 221 | { |
| 195 | | ddragon_state *state = space.machine().driver_data<ddragon_state>(); |
| 196 | | state->m_mcu_command = data; |
| 222 | m_mcu_command = data; |
| 197 | 223 | #if 0 |
| 198 | 224 | if (data != 0x78) |
| 199 | 225 | { |
| r21062 | r21063 | |
| 202 | 228 | #endif |
| 203 | 229 | } |
| 204 | 230 | |
| 205 | | static WRITE8_HANDLER( saiyugoub1_adpcm_rom_addr_w ) |
| 231 | WRITE8_MEMBER(chinagat_state::saiyugoub1_adpcm_rom_addr_w ) |
| 206 | 232 | { |
| 207 | | ddragon_state *state = space.machine().driver_data<ddragon_state>(); |
| 208 | 233 | /* i8748 Port 1 write */ |
| 209 | | state->m_i8748_P1 = data; |
| 234 | m_i8748_P1 = data; |
| 210 | 235 | } |
| 211 | 236 | |
| 212 | | static WRITE8_DEVICE_HANDLER( saiyugoub1_adpcm_control_w ) |
| 237 | WRITE8_MEMBER(chinagat_state::saiyugoub1_adpcm_control_w ) |
| 213 | 238 | { |
| 214 | | ddragon_state *state = space.machine().driver_data<ddragon_state>(); |
| 215 | | |
| 239 | device_t *device = machine().device("adpcm"); |
| 216 | 240 | /* i8748 Port 2 write */ |
| 217 | | UINT8 *saiyugoub1_adpcm_rom = state->memregion("adpcm")->base(); |
| 241 | UINT8 *saiyugoub1_adpcm_rom = memregion("adpcm")->base(); |
| 218 | 242 | |
| 219 | 243 | if (data & 0x80) /* Reset m5205 and disable ADPCM ROM outputs */ |
| 220 | 244 | { |
| 221 | 245 | logerror("ADPCM output disabled\n"); |
| 222 | | state->m_pcm_nibble = 0x0f; |
| 246 | m_pcm_nibble = 0x0f; |
| 223 | 247 | msm5205_reset_w(device, 1); |
| 224 | 248 | } |
| 225 | 249 | else |
| 226 | 250 | { |
| 227 | | if ((state->m_i8748_P2 & 0xc) != (data & 0xc)) |
| 251 | if ((m_i8748_P2 & 0xc) != (data & 0xc)) |
| 228 | 252 | { |
| 229 | | if ((state->m_i8748_P2 & 0xc) == 0) /* Latch MSB Address */ |
| 253 | if ((m_i8748_P2 & 0xc) == 0) /* Latch MSB Address */ |
| 230 | 254 | { |
| 231 | 255 | /// logerror("Latching MSB\n"); |
| 232 | | state->m_adpcm_addr = (state->m_adpcm_addr & 0x3807f) | (state->m_i8748_P1 << 7); |
| 256 | m_adpcm_addr = (m_adpcm_addr & 0x3807f) | (m_i8748_P1 << 7); |
| 233 | 257 | } |
| 234 | | if ((state->m_i8748_P2 & 0xc) == 4) /* Latch LSB Address */ |
| 258 | if ((m_i8748_P2 & 0xc) == 4) /* Latch LSB Address */ |
| 235 | 259 | { |
| 236 | 260 | /// logerror("Latching LSB\n"); |
| 237 | | state->m_adpcm_addr = (state->m_adpcm_addr & 0x3ff80) | (state->m_i8748_P1 >> 1); |
| 238 | | state->m_pcm_shift = (state->m_i8748_P1 & 1) * 4; |
| 261 | m_adpcm_addr = (m_adpcm_addr & 0x3ff80) | (m_i8748_P1 >> 1); |
| 262 | m_pcm_shift = (m_i8748_P1 & 1) * 4; |
| 239 | 263 | } |
| 240 | 264 | } |
| 241 | 265 | |
| 242 | | state->m_adpcm_addr = ((state->m_adpcm_addr & 0x07fff) | (data & 0x70 << 11)); |
| 266 | m_adpcm_addr = ((m_adpcm_addr & 0x07fff) | (data & 0x70 << 11)); |
| 243 | 267 | |
| 244 | | state->m_pcm_nibble = saiyugoub1_adpcm_rom[state->m_adpcm_addr & 0x3ffff]; |
| 268 | m_pcm_nibble = saiyugoub1_adpcm_rom[m_adpcm_addr & 0x3ffff]; |
| 245 | 269 | |
| 246 | | state->m_pcm_nibble = (state->m_pcm_nibble >> state->m_pcm_shift) & 0x0f; |
| 270 | m_pcm_nibble = (m_pcm_nibble >> m_pcm_shift) & 0x0f; |
| 247 | 271 | |
| 248 | | /// logerror("Writing %02x to m5205. $ROM=%08x P1=%02x P2=%02x Prev_P2=%02x Nibble=%08x\n", state->m_pcm_nibble, state->m_adpcm_addr, state->m_i8748_P1, data, state->m_i8748_P2, state->m_pcm_shift); |
| 272 | /// logerror("Writing %02x to m5205. $ROM=%08x P1=%02x P2=%02x Prev_P2=%02x Nibble=%08x\n", m_pcm_nibble, m_adpcm_addr, m_i8748_P1, data, m_i8748_P2, m_pcm_shift); |
| 249 | 273 | |
| 250 | | if (((state->m_i8748_P2 & 0xc) >= 8) && ((data & 0xc) == 4)) |
| 274 | if (((m_i8748_P2 & 0xc) >= 8) && ((data & 0xc) == 4)) |
| 251 | 275 | { |
| 252 | | msm5205_data_w (device, state->m_pcm_nibble); |
| 253 | | logerror("Writing %02x to m5205\n", state->m_pcm_nibble); |
| 276 | msm5205_data_w (device, m_pcm_nibble); |
| 277 | logerror("Writing %02x to m5205\n", m_pcm_nibble); |
| 254 | 278 | } |
| 255 | | logerror("$ROM=%08x P1=%02x P2=%02x Prev_P2=%02x Nibble=%1x PCM_data=%02x\n", state->m_adpcm_addr, state->m_i8748_P1, data, state->m_i8748_P2, state->m_pcm_shift, state->m_pcm_nibble); |
| 279 | logerror("$ROM=%08x P1=%02x P2=%02x Prev_P2=%02x Nibble=%1x PCM_data=%02x\n", m_adpcm_addr, m_i8748_P1, data, m_i8748_P2, m_pcm_shift, m_pcm_nibble); |
| 256 | 280 | } |
| 257 | | state->m_i8748_P2 = data; |
| 281 | m_i8748_P2 = data; |
| 258 | 282 | } |
| 259 | 283 | |
| 260 | | static WRITE8_DEVICE_HANDLER( saiyugoub1_m5205_clk_w ) |
| 284 | WRITE8_MEMBER(chinagat_state::saiyugoub1_m5205_clk_w ) |
| 261 | 285 | { |
| 262 | 286 | /* i8748 T0 output clk mode */ |
| 263 | 287 | /* This signal goes through a divide by 8 counter */ |
| r21062 | r21063 | |
| 265 | 289 | |
| 266 | 290 | /* Actually, T0 output clk mode is not supported by the i8048 core */ |
| 267 | 291 | #if 0 |
| 268 | | ddragon_state *state = space.machine().driver_data<ddragon_state>(); |
| 269 | | |
| 270 | | state->m_m5205_clk++; |
| 271 | | if (state->m_m5205_clk == 8) |
| 292 | device_t *device = machine().device("adpcm"); |
| 293 | m_m5205_clk++; |
| 294 | if (m_m5205_clk == 8) |
| 272 | 295 | { |
| 273 | 296 | msm5205_vclk_w(device, 1); /* ??? */ |
| 274 | | state->m_m5205_clk = 0; |
| 297 | m_m5205_clk = 0; |
| 275 | 298 | } |
| 276 | 299 | else |
| 277 | 300 | msm5205_vclk_w(device, 0); /* ??? */ |
| 278 | 301 | #endif |
| 279 | 302 | } |
| 280 | 303 | |
| 281 | | static READ8_HANDLER( saiyugoub1_m5205_irq_r ) |
| 304 | READ8_MEMBER(chinagat_state::saiyugoub1_m5205_irq_r ) |
| 282 | 305 | { |
| 283 | | ddragon_state *state = space.machine().driver_data<ddragon_state>(); |
| 284 | | if (state->m_adpcm_sound_irq) |
| 306 | if (m_adpcm_sound_irq) |
| 285 | 307 | { |
| 286 | | state->m_adpcm_sound_irq = 0; |
| 308 | m_adpcm_sound_irq = 0; |
| 287 | 309 | return 1; |
| 288 | 310 | } |
| 289 | 311 | return 0; |
| r21062 | r21063 | |
| 291 | 313 | |
| 292 | 314 | static void saiyugoub1_m5205_irq_w( device_t *device ) |
| 293 | 315 | { |
| 294 | | ddragon_state *state = device->machine().driver_data<ddragon_state>(); |
| 316 | chinagat_state *state = device->machine().driver_data<chinagat_state>(); |
| 295 | 317 | state->m_adpcm_sound_irq = 1; |
| 296 | 318 | } |
| 297 | 319 | |
| 298 | | static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, ddragon_state ) |
| 320 | static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, chinagat_state ) |
| 299 | 321 | AM_RANGE(0x0000, 0x1fff) AM_RAM AM_SHARE("share1") |
| 300 | 322 | AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(ddragon_fgvideoram_w) AM_SHARE("fgvideoram") |
| 301 | 323 | AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(ddragon_bgvideoram_w) AM_SHARE("bgvideoram") |
| 302 | 324 | AM_RANGE(0x3000, 0x317f) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("paletteram") |
| 303 | 325 | AM_RANGE(0x3400, 0x357f) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("paletteram2") |
| 304 | 326 | AM_RANGE(0x3800, 0x397f) AM_WRITE_BANK("bank3") AM_SHARE("spriteram") |
| 305 | | AM_RANGE(0x3e00, 0x3e04) AM_WRITE_LEGACY(chinagat_interrupt_w) |
| 327 | AM_RANGE(0x3e00, 0x3e04) AM_WRITE(chinagat_interrupt_w) |
| 306 | 328 | AM_RANGE(0x3e06, 0x3e06) AM_WRITEONLY AM_SHARE("scrolly_lo") |
| 307 | 329 | AM_RANGE(0x3e07, 0x3e07) AM_WRITEONLY AM_SHARE("scrollx_lo") |
| 308 | | AM_RANGE(0x3f00, 0x3f00) AM_WRITE_LEGACY(chinagat_video_ctrl_w) |
| 309 | | AM_RANGE(0x3f01, 0x3f01) AM_WRITE_LEGACY(chinagat_bankswitch_w) |
| 330 | AM_RANGE(0x3f00, 0x3f00) AM_WRITE(chinagat_video_ctrl_w) |
| 331 | AM_RANGE(0x3f01, 0x3f01) AM_WRITE(chinagat_bankswitch_w) |
| 310 | 332 | AM_RANGE(0x3f00, 0x3f00) AM_READ_PORT("SYSTEM") |
| 311 | 333 | AM_RANGE(0x3f01, 0x3f01) AM_READ_PORT("DSW1") |
| 312 | 334 | AM_RANGE(0x3f02, 0x3f02) AM_READ_PORT("DSW2") |
| r21062 | r21063 | |
| 316 | 338 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| 317 | 339 | ADDRESS_MAP_END |
| 318 | 340 | |
| 319 | | static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8, ddragon_state ) |
| 341 | static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8, chinagat_state ) |
| 320 | 342 | AM_RANGE(0x0000, 0x1fff) AM_RAM AM_SHARE("share1") |
| 321 | | AM_RANGE(0x2000, 0x2000) AM_WRITE_LEGACY(chinagat_sub_bankswitch_w) |
| 343 | AM_RANGE(0x2000, 0x2000) AM_WRITE(chinagat_sub_bankswitch_w) |
| 322 | 344 | AM_RANGE(0x2800, 0x2800) AM_WRITEONLY /* Called on CPU start and after return from jump table */ |
| 323 | 345 | // AM_RANGE(0x2a2b, 0x2a2b) AM_READNOP /* What lives here? */ |
| 324 | 346 | // AM_RANGE(0x2a30, 0x2a30) AM_READNOP /* What lives here? */ |
| r21062 | r21063 | |
| 326 | 348 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| 327 | 349 | ADDRESS_MAP_END |
| 328 | 350 | |
| 329 | | static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, ddragon_state ) |
| 351 | static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, chinagat_state ) |
| 330 | 352 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 331 | 353 | AM_RANGE(0x8000, 0x87ff) AM_RAM |
| 332 | 354 | AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) |
| r21062 | r21063 | |
| 334 | 356 | AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_byte_r) |
| 335 | 357 | ADDRESS_MAP_END |
| 336 | 358 | |
| 337 | | static ADDRESS_MAP_START( ym2203c_sound_map, AS_PROGRAM, 8, ddragon_state ) |
| 359 | static ADDRESS_MAP_START( ym2203c_sound_map, AS_PROGRAM, 8, chinagat_state ) |
| 338 | 360 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 339 | 361 | AM_RANGE(0x8000, 0x87ff) AM_RAM |
| 340 | 362 | // 8804 and/or 8805 make a gong sound when the coin goes in |
| r21062 | r21063 | |
| 352 | 374 | AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_byte_r) |
| 353 | 375 | ADDRESS_MAP_END |
| 354 | 376 | |
| 355 | | static ADDRESS_MAP_START( saiyugoub1_sound_map, AS_PROGRAM, 8, ddragon_state ) |
| 377 | static ADDRESS_MAP_START( saiyugoub1_sound_map, AS_PROGRAM, 8, chinagat_state ) |
| 356 | 378 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 357 | 379 | AM_RANGE(0x8000, 0x87ff) AM_RAM |
| 358 | 380 | AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) |
| 359 | | AM_RANGE(0x9800, 0x9800) AM_WRITE_LEGACY(saiyugoub1_mcu_command_w) |
| 381 | AM_RANGE(0x9800, 0x9800) AM_WRITE(saiyugoub1_mcu_command_w) |
| 360 | 382 | AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_byte_r) |
| 361 | 383 | ADDRESS_MAP_END |
| 362 | 384 | |
| 363 | | static ADDRESS_MAP_START( i8748_map, AS_PROGRAM, 8, ddragon_state ) |
| 385 | static ADDRESS_MAP_START( i8748_map, AS_PROGRAM, 8, chinagat_state ) |
| 364 | 386 | AM_RANGE(0x0000, 0x03ff) AM_ROM |
| 365 | 387 | AM_RANGE(0x0400, 0x07ff) AM_ROM /* i8749 version */ |
| 366 | 388 | ADDRESS_MAP_END |
| 367 | 389 | |
| 368 | | static ADDRESS_MAP_START( i8748_portmap, AS_IO, 8, ddragon_state ) |
| 369 | | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ_LEGACY(saiyugoub1_mcu_command_r) |
| 370 | | AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_DEVWRITE_LEGACY("adpcm", saiyugoub1_m5205_clk_w) /* Drives the clock on the m5205 at 1/8 of this frequency */ |
| 371 | | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ_LEGACY(saiyugoub1_m5205_irq_r) |
| 372 | | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE_LEGACY(saiyugoub1_adpcm_rom_addr_w) |
| 373 | | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_DEVWRITE_LEGACY("adpcm", saiyugoub1_adpcm_control_w) |
| 390 | static ADDRESS_MAP_START( i8748_portmap, AS_IO, 8, chinagat_state ) |
| 391 | AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(saiyugoub1_mcu_command_r) |
| 392 | AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_WRITE(saiyugoub1_m5205_clk_w) /* Drives the clock on the m5205 at 1/8 of this frequency */ |
| 393 | AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(saiyugoub1_m5205_irq_r) |
| 394 | AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(saiyugoub1_adpcm_rom_addr_w) |
| 395 | AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(saiyugoub1_adpcm_control_w) |
| 374 | 396 | ADDRESS_MAP_END |
| 375 | 397 | |
| 376 | 398 | |
| r21062 | r21063 | |
| 482 | 504 | GFXDECODE_END |
| 483 | 505 | |
| 484 | 506 | |
| 485 | | static void chinagat_irq_handler( device_t *device, int irq ) |
| 507 | static void chinagat_irq_handler(device_t *device, int irq ) |
| 486 | 508 | { |
| 487 | | ddragon_state *state = device->machine().driver_data<ddragon_state>(); |
| 509 | chinagat_state *state = device->machine().driver_data<chinagat_state>(); |
| 488 | 510 | state->m_snd_cpu->execute().set_input_line(0, irq ? ASSERT_LINE : CLEAR_LINE ); |
| 489 | 511 | } |
| 490 | 512 | |
| r21062 | r21063 | |
| 507 | 529 | }; |
| 508 | 530 | |
| 509 | 531 | |
| 510 | | MACHINE_START_MEMBER(ddragon_state,chinagat) |
| 532 | MACHINE_START_MEMBER(chinagat_state,chinagat) |
| 511 | 533 | { |
| 512 | 534 | m_maincpu = machine().device<cpu_device>("maincpu"); |
| 513 | 535 | m_sub_cpu = machine().device("sub"); |
| r21062 | r21063 | |
| 532 | 554 | } |
| 533 | 555 | |
| 534 | 556 | |
| 535 | | MACHINE_RESET_MEMBER(ddragon_state,chinagat) |
| 557 | MACHINE_RESET_MEMBER(chinagat_state,chinagat) |
| 536 | 558 | { |
| 537 | 559 | m_scrollx_hi = 0; |
| 538 | 560 | m_scrolly_hi = 0; |
| r21062 | r21063 | |
| 549 | 571 | } |
| 550 | 572 | |
| 551 | 573 | |
| 552 | | static MACHINE_CONFIG_START( chinagat, ddragon_state ) |
| 574 | static MACHINE_CONFIG_START( chinagat, chinagat_state ) |
| 553 | 575 | |
| 554 | 576 | /* basic machine hardware */ |
| 555 | 577 | MCFG_CPU_ADD("maincpu", HD6309, MAIN_CLOCK / 2) /* 1.5 MHz (12MHz oscillator / 4 internally) */ |
| 556 | 578 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 557 | | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", ddragon_state, chinagat_scanline, "screen", 0, 1) |
| 579 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", chinagat_state, chinagat_scanline, "screen", 0, 1) |
| 558 | 580 | |
| 559 | 581 | MCFG_CPU_ADD("sub", HD6309, MAIN_CLOCK / 2) /* 1.5 MHz (12MHz oscillator / 4 internally) */ |
| 560 | 582 | MCFG_CPU_PROGRAM_MAP(sub_map) |
| r21062 | r21063 | |
| 564 | 586 | |
| 565 | 587 | MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* heavy interleaving to sync up sprite<->main cpu's */ |
| 566 | 588 | |
| 567 | | MCFG_MACHINE_START_OVERRIDE(ddragon_state,chinagat) |
| 568 | | MCFG_MACHINE_RESET_OVERRIDE(ddragon_state,chinagat) |
| 589 | MCFG_MACHINE_START_OVERRIDE(chinagat_state,chinagat) |
| 590 | MCFG_MACHINE_RESET_OVERRIDE(chinagat_state,chinagat) |
| 569 | 591 | |
| 570 | 592 | /* video hardware */ |
| 571 | 593 | MCFG_SCREEN_ADD("screen", RASTER) |
| 572 | 594 | MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 384, 0, 256, 272, 0, 240) /* based on ddragon driver */ |
| 573 | | MCFG_SCREEN_UPDATE_DRIVER(ddragon_state, screen_update_ddragon) |
| 595 | MCFG_SCREEN_UPDATE_DRIVER(chinagat_state, screen_update_ddragon) |
| 574 | 596 | |
| 575 | 597 | MCFG_GFXDECODE(chinagat) |
| 576 | 598 | MCFG_PALETTE_LENGTH(384) |
| 577 | 599 | |
| 578 | | MCFG_VIDEO_START_OVERRIDE(ddragon_state,chinagat) |
| 600 | MCFG_VIDEO_START_OVERRIDE(chinagat_state,chinagat) |
| 579 | 601 | |
| 580 | 602 | /* sound hardware */ |
| 581 | 603 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| r21062 | r21063 | |
| 589 | 611 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 590 | 612 | MACHINE_CONFIG_END |
| 591 | 613 | |
| 592 | | static MACHINE_CONFIG_START( saiyugoub1, ddragon_state ) |
| 614 | static MACHINE_CONFIG_START( saiyugoub1, chinagat_state ) |
| 593 | 615 | |
| 594 | 616 | /* basic machine hardware */ |
| 595 | 617 | MCFG_CPU_ADD("maincpu", M6809, MAIN_CLOCK / 8) /* 68B09EP 1.5 MHz (12MHz oscillator) */ |
| 596 | 618 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 597 | | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", ddragon_state, chinagat_scanline, "screen", 0, 1) |
| 619 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", chinagat_state, chinagat_scanline, "screen", 0, 1) |
| 598 | 620 | |
| 599 | 621 | MCFG_CPU_ADD("sub", M6809, MAIN_CLOCK / 8) /* 68B09EP 1.5 MHz (12MHz oscillator) */ |
| 600 | 622 | MCFG_CPU_PROGRAM_MAP(sub_map) |
| r21062 | r21063 | |
| 608 | 630 | |
| 609 | 631 | MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* heavy interleaving to sync up sprite<->main cpu's */ |
| 610 | 632 | |
| 611 | | MCFG_MACHINE_START_OVERRIDE(ddragon_state,chinagat) |
| 612 | | MCFG_MACHINE_RESET_OVERRIDE(ddragon_state,chinagat) |
| 633 | MCFG_MACHINE_START_OVERRIDE(chinagat_state,chinagat) |
| 634 | MCFG_MACHINE_RESET_OVERRIDE(chinagat_state,chinagat) |
| 613 | 635 | |
| 614 | 636 | /* video hardware */ |
| 615 | 637 | MCFG_SCREEN_ADD("screen", RASTER) |
| 616 | 638 | MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 384, 0, 256, 272, 0, 240) /* based on ddragon driver */ |
| 617 | | MCFG_SCREEN_UPDATE_DRIVER(ddragon_state, screen_update_ddragon) |
| 639 | MCFG_SCREEN_UPDATE_DRIVER(chinagat_state, screen_update_ddragon) |
| 618 | 640 | |
| 619 | 641 | MCFG_GFXDECODE(chinagat) |
| 620 | 642 | MCFG_PALETTE_LENGTH(384) |
| 621 | 643 | |
| 622 | | MCFG_VIDEO_START_OVERRIDE(ddragon_state,chinagat) |
| 644 | MCFG_VIDEO_START_OVERRIDE(chinagat_state,chinagat) |
| 623 | 645 | |
| 624 | 646 | /* sound hardware */ |
| 625 | 647 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| r21062 | r21063 | |
| 634 | 656 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60) |
| 635 | 657 | MACHINE_CONFIG_END |
| 636 | 658 | |
| 637 | | static MACHINE_CONFIG_START( saiyugoub2, ddragon_state ) |
| 659 | static MACHINE_CONFIG_START( saiyugoub2, chinagat_state ) |
| 638 | 660 | |
| 639 | 661 | /* basic machine hardware */ |
| 640 | 662 | MCFG_CPU_ADD("maincpu", M6809, MAIN_CLOCK / 8) /* 1.5 MHz (12MHz oscillator) */ |
| 641 | 663 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 642 | | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", ddragon_state, chinagat_scanline, "screen", 0, 1) |
| 664 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", chinagat_state, chinagat_scanline, "screen", 0, 1) |
| 643 | 665 | |
| 644 | 666 | MCFG_CPU_ADD("sub", M6809, MAIN_CLOCK / 8) /* 1.5 MHz (12MHz oscillator) */ |
| 645 | 667 | MCFG_CPU_PROGRAM_MAP(sub_map) |
| r21062 | r21063 | |
| 649 | 671 | |
| 650 | 672 | MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* heavy interleaving to sync up sprite<->main cpu's */ |
| 651 | 673 | |
| 652 | | MCFG_MACHINE_START_OVERRIDE(ddragon_state,chinagat) |
| 653 | | MCFG_MACHINE_RESET_OVERRIDE(ddragon_state,chinagat) |
| 674 | MCFG_MACHINE_START_OVERRIDE(chinagat_state,chinagat) |
| 675 | MCFG_MACHINE_RESET_OVERRIDE(chinagat_state,chinagat) |
| 654 | 676 | |
| 655 | 677 | /* video hardware */ |
| 656 | 678 | MCFG_SCREEN_ADD("screen", RASTER) |
| 657 | 679 | MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 384, 0, 256, 272, 0, 240) /* based on ddragon driver */ |
| 658 | | MCFG_SCREEN_UPDATE_DRIVER(ddragon_state, screen_update_ddragon) |
| 680 | MCFG_SCREEN_UPDATE_DRIVER(chinagat_state, screen_update_ddragon) |
| 659 | 681 | |
| 660 | 682 | MCFG_GFXDECODE(chinagat) |
| 661 | 683 | MCFG_PALETTE_LENGTH(384) |
| 662 | 684 | |
| 663 | | MCFG_VIDEO_START_OVERRIDE(ddragon_state,chinagat) |
| 685 | MCFG_VIDEO_START_OVERRIDE(chinagat_state,chinagat) |
| 664 | 686 | |
| 665 | 687 | /* sound hardware */ |
| 666 | 688 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| r21062 | r21063 | |
| 890 | 912 | ROM_END |
| 891 | 913 | |
| 892 | 914 | |
| 893 | | DRIVER_INIT_MEMBER(ddragon_state,chinagat) |
| 915 | DRIVER_INIT_MEMBER(chinagat_state,chinagat) |
| 894 | 916 | { |
| 895 | 917 | UINT8 *MAIN = memregion("maincpu")->base(); |
| 896 | 918 | UINT8 *SUB = memregion("sub")->base(); |
| r21062 | r21063 | |
| 905 | 927 | |
| 906 | 928 | |
| 907 | 929 | /* ( YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME FLAGS ) */ |
| 908 | | GAME( 1988, chinagat, 0, chinagat, chinagat, ddragon_state, chinagat, ROT0, "Technos Japan (Taito / Romstar license)", "China Gate (US)", GAME_SUPPORTS_SAVE ) |
| 909 | | GAME( 1988, saiyugou, chinagat, chinagat, chinagat, ddragon_state, chinagat, ROT0, "Technos Japan", "Sai Yu Gou Ma Roku (Japan)", GAME_SUPPORTS_SAVE ) |
| 910 | | GAME( 1988, saiyugoub1, chinagat, saiyugoub1, chinagat, ddragon_state, chinagat, ROT0, "bootleg", "Sai Yu Gou Ma Roku (Japan bootleg 1)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 911 | | GAME( 1988, saiyugoub2, chinagat, saiyugoub2, chinagat, ddragon_state, chinagat, ROT0, "bootleg", "Sai Yu Gou Ma Roku (Japan bootleg 2)", GAME_SUPPORTS_SAVE ) |
| 930 | GAME( 1988, chinagat, 0, chinagat, chinagat, chinagat_state, chinagat, ROT0, "Technos Japan (Taito / Romstar license)", "China Gate (US)", GAME_SUPPORTS_SAVE ) |
| 931 | GAME( 1988, saiyugou, chinagat, chinagat, chinagat, chinagat_state, chinagat, ROT0, "Technos Japan", "Sai Yu Gou Ma Roku (Japan)", GAME_SUPPORTS_SAVE ) |
| 932 | GAME( 1988, saiyugoub1, chinagat, saiyugoub1, chinagat, chinagat_state, chinagat, ROT0, "bootleg", "Sai Yu Gou Ma Roku (Japan bootleg 1)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 933 | GAME( 1988, saiyugoub2, chinagat, saiyugoub2, chinagat, chinagat_state, chinagat, ROT0, "bootleg", "Sai Yu Gou Ma Roku (Japan bootleg 2)", GAME_SUPPORTS_SAVE ) |