trunk/src/mame/drivers/4enlinea.c
| r29399 | r29400 | |
| 214 | 214 | |
| 215 | 215 | required_device<ay8910_device> m_ay; |
| 216 | 216 | |
| 217 | | DECLARE_READ8_MEMBER(unk_e000_r); |
| 218 | | DECLARE_READ8_MEMBER(unk_e001_r); |
| 217 | DECLARE_READ8_MEMBER(serial_r); |
| 218 | DECLARE_READ8_MEMBER(serial_status_r); |
| 219 | DECLARE_WRITE8_MEMBER(serial_w); |
| 220 | DECLARE_WRITE8_MEMBER(serial_status_w); |
| 221 | DECLARE_READ8_MEMBER(hack_r); |
| 219 | 222 | INTERRUPT_GEN_MEMBER(_4enlinea_irq); |
| 223 | INTERRUPT_GEN_MEMBER(_4enlinea_audio_irq); |
| 224 | |
| 220 | 225 | UINT8 m_irq_count; |
| 226 | UINT8 m_serial_flags; |
| 227 | UINT8 m_serial_data[2]; |
| 221 | 228 | |
| 222 | 229 | virtual void machine_start(); |
| 223 | 230 | virtual void machine_reset(); |
| 224 | 231 | required_device<cpu_device> m_maincpu; |
| 232 | |
| 225 | 233 | }; |
| 226 | 234 | |
| 227 | 235 | |
| r29399 | r29400 | |
| 237 | 245 | isa8_cga_4enlinea_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 238 | 246 | |
| 239 | 247 | DECLARE_READ8_MEMBER( _4enlinea_io_read ); |
| 248 | DECLARE_WRITE8_MEMBER( _4enlinea_mode_control_w ); |
| 240 | 249 | virtual void device_start(); |
| 241 | 250 | virtual const rom_entry *device_rom_region() const; |
| 242 | 251 | }; |
| r29399 | r29400 | |
| 272 | 281 | return data; |
| 273 | 282 | } |
| 274 | 283 | |
| 284 | WRITE8_MEMBER( isa8_cga_4enlinea_device::_4enlinea_mode_control_w ) |
| 285 | { |
| 286 | // TODO |
| 287 | } |
| 275 | 288 | |
| 276 | 289 | void isa8_cga_4enlinea_device::device_start() |
| 277 | 290 | { |
| r29399 | r29400 | |
| 283 | 296 | m_vram.resize(m_vram_size); |
| 284 | 297 | |
| 285 | 298 | m_update_row = NULL; |
| 299 | //m_isa->install_device(0x3bf, 0x3bf, 0, 0, NULL, write8_delegate( FUNC(isa8_cga_4enlinea_device::_4enlinea_mode_control_w), this ) ); |
| 286 | 300 | m_isa->install_device(0x3d0, 0x3df, 0, 0, read8_delegate( FUNC(isa8_cga_4enlinea_device::_4enlinea_io_read), this ), write8_delegate( FUNC(isa8_cga_device::io_write), this ) ); |
| 287 | 301 | m_isa->install_bank(0x8000, 0xbfff, 0, 0, "bank1", m_vram); |
| 288 | 302 | |
| r29399 | r29400 | |
| 313 | 327 | } |
| 314 | 328 | |
| 315 | 329 | |
| 316 | | READ8_MEMBER(_4enlinea_state::unk_e000_r) |
| 330 | READ8_MEMBER(_4enlinea_state::serial_r) |
| 317 | 331 | { |
| 318 | | logerror("read e000\n"); |
| 319 | | // return (machine().rand() & 0xff); |
| 320 | | return 0xff; |
| 321 | | } |
| 332 | if(offset == 0) |
| 333 | { |
| 334 | m_maincpu->set_input_line(INPUT_LINE_NMI,CLEAR_LINE); |
| 335 | m_serial_flags |= 0x20; |
| 336 | } |
| 322 | 337 | |
| 323 | | READ8_MEMBER(_4enlinea_state::unk_e001_r) |
| 324 | | { |
| 325 | | logerror("read e001\n"); |
| 326 | | return (machine().rand() & 0xff); // after 30 seconds, random strings and gfx appear on the screen. |
| 327 | | // return (machine().rand() & 0x0f); // after 30 seconds, random gfx appear on the screen. |
| 338 | return m_serial_data[offset]; |
| 328 | 339 | } |
| 329 | 340 | |
| 341 | |
| 342 | |
| 330 | 343 | /*********************************** |
| 331 | 344 | * Memory Map Information * |
| 332 | 345 | ***********************************/ |
| r29399 | r29400 | |
| 336 | 349 | // AM_RANGE(0x8000, 0xbfff) AM_RAM // CGA VRAM |
| 337 | 350 | AM_RANGE(0xc000, 0xdfff) AM_RAM |
| 338 | 351 | |
| 339 | | AM_RANGE(0xe000, 0xe000) AM_READ(unk_e000_r) |
| 340 | | AM_RANGE(0xe001, 0xe001) AM_READ(unk_e001_r) |
| 341 | | |
| 342 | | AM_RANGE(0xe002, 0xe3ff) AM_RAM // bad... just temporary to allow writes for debug purposes. |
| 343 | | |
| 352 | AM_RANGE(0xe000, 0xe001) AM_READ(serial_r) |
| 344 | 353 | ADDRESS_MAP_END |
| 345 | 354 | |
| 346 | | |
| 347 | 355 | static ADDRESS_MAP_START( main_portmap, AS_IO, 8, _4enlinea_state ) |
| 348 | 356 | ADDRESS_MAP_GLOBAL_MASK(0x3ff) |
| 349 | 357 | |
| 350 | 358 | // AM_RANGE(0x3d4, 0x3df) CGA regs |
| 359 | AM_RANGE(0x3bf, 0x3bf) AM_WRITENOP // CGA mode control, TODO |
| 351 | 360 | ADDRESS_MAP_END |
| 352 | 361 | |
| 362 | READ8_MEMBER(_4enlinea_state::serial_status_r) |
| 363 | { |
| 364 | return m_serial_flags; |
| 365 | } |
| 353 | 366 | |
| 367 | WRITE8_MEMBER(_4enlinea_state::serial_status_w) |
| 368 | { |
| 369 | m_serial_flags = data; // probably just clears |
| 370 | } |
| 354 | 371 | |
| 372 | /* TODO: do this really routes to 0xe000-0xe001 of Main CPU? */ |
| 373 | WRITE8_MEMBER(_4enlinea_state::serial_w) |
| 374 | { |
| 375 | m_serial_data[offset] = data; |
| 376 | if(offset == 0) |
| 377 | m_maincpu->set_input_line(INPUT_LINE_NMI,ASSERT_LINE); |
| 378 | } |
| 379 | |
| 380 | READ8_MEMBER(_4enlinea_state::hack_r) |
| 381 | { |
| 382 | return machine().rand(); |
| 383 | } |
| 384 | |
| 355 | 385 | static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, _4enlinea_state ) |
| 356 | 386 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 357 | | AM_RANGE(0xe000, 0xffff) AM_RAM |
| 387 | AM_RANGE(0xf800, 0xfbff) AM_RAM |
| 388 | AM_RANGE(0xfc24, 0xfc24) AM_READ(hack_r) |
| 389 | AM_RANGE(0xfc28, 0xfc28) AM_READ(hack_r) |
| 390 | AM_RANGE(0xfc30, 0xfc31) AM_WRITE(serial_w) |
| 391 | AM_RANGE(0xfc32, 0xfc32) AM_READWRITE(serial_status_r,serial_status_w) |
| 392 | AM_RANGE(0xfc48, 0xfc49) AM_DEVREADWRITE("aysnd", ay8910_device, data_r, address_data_w) |
| 393 | |
| 358 | 394 | ADDRESS_MAP_END |
| 359 | 395 | |
| 360 | 396 | |
| r29399 | r29400 | |
| 477 | 513 | INTERRUPT_GEN_MEMBER(_4enlinea_state::_4enlinea_irq) |
| 478 | 514 | { |
| 479 | 515 | if(m_irq_count == 0) |
| 480 | | device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 516 | { |
| 517 | //device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 518 | } |
| 481 | 519 | else |
| 482 | 520 | device.execute().set_input_line(0, HOLD_LINE); |
| 483 | 521 | |
| r29399 | r29400 | |
| 485 | 523 | m_irq_count&=3; |
| 486 | 524 | } |
| 487 | 525 | |
| 526 | INTERRUPT_GEN_MEMBER(_4enlinea_state::_4enlinea_audio_irq) |
| 527 | { |
| 528 | device.execute().set_input_line(0, HOLD_LINE); |
| 529 | } |
| 530 | |
| 488 | 531 | static MACHINE_CONFIG_START( 4enlinea, _4enlinea_state ) |
| 489 | 532 | |
| 490 | 533 | /* basic machine hardware */ |
| r29399 | r29400 | |
| 497 | 540 | MCFG_CPU_ADD("audiocpu", Z80, SND_CPU_CLOCK) |
| 498 | 541 | MCFG_CPU_PROGRAM_MAP(audio_map) |
| 499 | 542 | MCFG_CPU_IO_MAP(audio_portmap) |
| 543 | MCFG_CPU_PERIODIC_INT_DRIVER(_4enlinea_state, _4enlinea_audio_irq, 60) //TODO |
| 500 | 544 | |
| 501 | 545 | MCFG_ISA8_BUS_ADD("isa", ":maincpu", _4enlinea_isabus_intf) |
| 502 | 546 | MCFG_ISA8_SLOT_ADD("isa", "isa1", 4enlinea_isa8_cards, "4enlinea", true) |