trunk/src/mess/drivers/mekd2.c
| r32359 | r32360 | |
| 78 | 78 | #include "machine/6850acia.h" |
| 79 | 79 | #include "machine/clock.h" |
| 80 | 80 | #include "imagedev/cassette.h" |
| 81 | #include "imagedev/snapquik.h" |
| 81 | 82 | #include "sound/wave.h" |
| 82 | | #include "imagedev/cartslot.h" |
| 83 | 83 | #include "mekd2.lh" |
| 84 | 84 | |
| 85 | 85 | #define XTAL_MEKD2 1228800 |
| r32359 | r32360 | |
| 106 | 106 | DECLARE_WRITE_LINE_MEMBER(mekd2_nmi_w); |
| 107 | 107 | DECLARE_WRITE8_MEMBER(mekd2_digit_w); |
| 108 | 108 | DECLARE_WRITE8_MEMBER(mekd2_segment_w); |
| 109 | | DECLARE_DEVICE_IMAGE_LOAD_MEMBER(mekd2_cart); |
| 109 | DECLARE_QUICKLOAD_LOAD_MEMBER(mekd2_quik); |
| 110 | 110 | DECLARE_WRITE_LINE_MEMBER(cass_w); |
| 111 | 111 | TIMER_DEVICE_CALLBACK_MEMBER(mekd2_c); |
| 112 | 112 | TIMER_DEVICE_CALLBACK_MEMBER(mekd2_p); |
| r32359 | r32360 | |
| 301 | 301 | m_cass_state = state; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | | DEVICE_IMAGE_LOAD_MEMBER( mekd2_state,mekd2_cart ) |
| 304 | QUICKLOAD_LOAD_MEMBER( mekd2_state, mekd2_quik ) |
| 305 | 305 | { |
| 306 | 306 | static const char magic[] = "MEK6800D2"; |
| 307 | 307 | char buff[9]; |
| 308 | 308 | UINT16 addr, size; |
| 309 | 309 | UINT8 ident, *RAM = memregion("maincpu")->base(); |
| 310 | 310 | |
| 311 | | image.fread( buff, sizeof (buff)); |
| 311 | image.fread(buff, sizeof (buff)); |
| 312 | 312 | if (memcmp(buff, magic, sizeof (buff))) |
| 313 | 313 | { |
| 314 | | logerror( "mekd2_rom_load: magic '%s' not found\n", magic); |
| 314 | logerror("mekd2 rom load: magic '%s' not found\n", magic); |
| 315 | 315 | return IMAGE_INIT_FAIL; |
| 316 | 316 | } |
| 317 | | image.fread( &addr, 2); |
| 317 | image.fread(&addr, 2); |
| 318 | 318 | addr = LITTLE_ENDIANIZE_INT16(addr); |
| 319 | | image.fread( &size, 2); |
| 319 | image.fread(&size, 2); |
| 320 | 320 | size = LITTLE_ENDIANIZE_INT16(size); |
| 321 | | image.fread( &ident, 1); |
| 322 | | logerror("mekd2_rom_load: $%04X $%04X $%02X\n", addr, size, ident); |
| 321 | image.fread(&ident, 1); |
| 322 | logerror("mekd2 rom load: $%04X $%04X $%02X\n", addr, size, ident); |
| 323 | 323 | while (size-- > 0) |
| 324 | | image.fread( &RAM[addr++], 1); |
| 324 | image.fread(&RAM[addr++], 1); |
| 325 | 325 | |
| 326 | 326 | return IMAGE_INIT_PASS; |
| 327 | 327 | } |
| r32359 | r32360 | |
| 374 | 374 | MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") |
| 375 | 375 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 376 | 376 | |
| 377 | | MCFG_CASSETTE_ADD( "cassette" ) |
| 377 | MCFG_CASSETTE_ADD("cassette") |
| 378 | 378 | |
| 379 | | /* Cartslot ?? does not come with one.. */ |
| 380 | | MCFG_CARTSLOT_ADD("cart") |
| 381 | | MCFG_CARTSLOT_EXTENSION_LIST("d2") |
| 382 | | MCFG_CARTSLOT_NOT_MANDATORY |
| 383 | | MCFG_CARTSLOT_LOAD(mekd2_state,mekd2_cart) |
| 384 | | |
| 385 | 379 | /* Devices */ |
| 386 | 380 | MCFG_DEVICE_ADD("pia_s", PIA6821, 0) |
| 387 | 381 | MCFG_PIA_READPA_HANDLER(READ8(mekd2_state, mekd2_key_r)) |
| r32359 | r32360 | |
| 407 | 401 | |
| 408 | 402 | MCFG_TIMER_DRIVER_ADD_PERIODIC("mekd2_c", mekd2_state, mekd2_c, attotime::from_hz(4800)) |
| 409 | 403 | MCFG_TIMER_DRIVER_ADD_PERIODIC("mekd2_p", mekd2_state, mekd2_p, attotime::from_hz(40000)) |
| 404 | |
| 405 | MCFG_QUICKLOAD_ADD("quickload", mekd2_state, mekd2_quik, "d2", 1) |
| 410 | 406 | MACHINE_CONFIG_END |
| 411 | 407 | |
| 412 | 408 | /*********************************************************** |