src/mess/drivers/osi.c
| r3376 | r3377 | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | #include "driver.h" |
| 15 | | #include "image.h" |
| 16 | 15 | #include "machine/6850acia.h" |
| 17 | 16 | #include "sound/discrete.h" |
| 17 | #include "devices/cassette.h" |
| 18 | 18 | |
| 19 | 19 | /* Video */ |
| 20 | 20 | |
| r3376 | r3377 | |
| 308 | 308 | |
| 309 | 309 | /* Machine Start */ |
| 310 | 310 | |
| 311 | static UINT8 rx_cassette; |
| 311 | 312 | static UINT8 rx, tx; |
| 312 | 313 | |
| 313 | 314 | static const struct acia6850_interface sb2m600_acia_intf = |
| 314 | 315 | { |
| 315 | 316 | 500000, // |
| 316 | 317 | 500000, // |
| 317 | | &rx, |
| 318 | &rx_cassette, |
| 318 | 319 | &tx, |
| 319 | 320 | NULL, |
| 320 | 321 | NULL, |
| r3376 | r3377 | |
| 338 | 339 | { |
| 339 | 340 | 500000, // |
| 340 | 341 | 500000, // |
| 341 | | &rx, |
| 342 | &rx_cassette, |
| 342 | 343 | &tx, |
| 343 | 344 | NULL, |
| 344 | 345 | NULL, |
| r3376 | r3377 | |
| 346 | 347 | NULL |
| 347 | 348 | }; |
| 348 | 349 | |
| 350 | |
| 351 | static TIMER_CALLBACK( sb2m600_cassette_callback ) |
| 352 | { |
| 353 | rx_cassette = (cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )) > 0.0) ? 1 : 0; |
| 354 | } |
| 355 | |
| 356 | |
| 349 | 357 | static MACHINE_START( sb2m600 ) |
| 350 | 358 | { |
| 351 | 359 | // TODO: save states |
| 352 | 360 | acia6850_config(0, &sb2m600_acia_intf); |
| 353 | 361 | acia6850_config(1, &osi470_acia_intf); |
| 362 | timer_pulse( ATTOTIME_IN_HZ(4800), NULL, 0, sb2m600_cassette_callback ); |
| 354 | 363 | } |
| 355 | 364 | |
| 356 | 365 | static MACHINE_START( uk101 ) |
| 357 | 366 | { |
| 358 | 367 | // TODO: save states |
| 359 | 368 | acia6850_config(0, &uk101_acia_intf); |
| 369 | timer_pulse( ATTOTIME_IN_HZ(4800), NULL, 0, sb2m600_cassette_callback ); |
| 360 | 370 | } |
| 361 | 371 | |
| 362 | 372 | /* Machine Drivers */ |
| r3376 | r3377 | |
| 388 | 398 | MDRV_SOUND_ADD("discrete", DISCRETE, 0) |
| 389 | 399 | MDRV_SOUND_CONFIG_DISCRETE(sb2m600_discrete_interface) |
| 390 | 400 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 401 | |
| 402 | MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) |
| 391 | 403 | MACHINE_DRIVER_END |
| 392 | 404 | |
| 393 | 405 | #define UK101_X1 XTAL_8MHz |
| r3376 | r3377 | |
| 411 | 423 | MDRV_PALETTE_INIT(black_and_white) |
| 412 | 424 | MDRV_VIDEO_START(uk101) |
| 413 | 425 | MDRV_VIDEO_UPDATE(sb2m600) |
| 426 | |
| 427 | MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) |
| 414 | 428 | MACHINE_DRIVER_END |
| 415 | 429 | |
| 416 | 430 | /* ROMs */ |
| r3376 | r3377 | |
| 441 | 455 | |
| 442 | 456 | /* System Configuration */ |
| 443 | 457 | |
| 444 | | static UINT8 *sb2m600_tape_image; |
| 445 | | static int sb2m600_tape_size; |
| 446 | | static int sb2m600_tape_index; |
| 447 | | |
| 448 | | static DEVICE_IMAGE_LOAD( sb2m600_cassette ) |
| 449 | | { |
| 450 | | sb2m600_tape_image = (UINT8 *)image_malloc(image, sb2m600_tape_size); |
| 451 | | sb2m600_tape_size = image_length(image); |
| 452 | | |
| 453 | | if (!sb2m600_tape_image || (image_fread(image, sb2m600_tape_image, sb2m600_tape_size) != sb2m600_tape_size)) |
| 454 | | { |
| 455 | | return INIT_FAIL; |
| 456 | | } |
| 457 | | |
| 458 | | sb2m600_tape_index = 0; |
| 459 | | |
| 460 | | return INIT_PASS; |
| 461 | | } |
| 462 | | |
| 463 | | static DEVICE_IMAGE_UNLOAD( sb2m600_cassette ) |
| 464 | | { |
| 465 | | sb2m600_tape_image = NULL; |
| 466 | | sb2m600_tape_size = 0; |
| 467 | | sb2m600_tape_index = 0; |
| 468 | | } |
| 469 | | |
| 470 | | static void sb2m600_cassette_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 471 | | { |
| 472 | | switch(state) |
| 473 | | { |
| 474 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 475 | | case MESS_DEVINFO_INT_TYPE: info->i = IO_CASSETTE; break; |
| 476 | | case MESS_DEVINFO_INT_READABLE: info->i = 1; break; |
| 477 | | case MESS_DEVINFO_INT_WRITEABLE: info->i = 0; break; |
| 478 | | case MESS_DEVINFO_INT_CREATABLE: info->i = 0; break; |
| 479 | | case MESS_DEVINFO_INT_COUNT: info->i = 1; break; |
| 480 | | |
| 481 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 482 | | case MESS_DEVINFO_PTR_LOAD: info->load = DEVICE_IMAGE_LOAD_NAME(sb2m600_cassette); break; |
| 483 | | case MESS_DEVINFO_PTR_UNLOAD: info->unload = DEVICE_IMAGE_UNLOAD_NAME(sb2m600_cassette); break; |
| 484 | | |
| 485 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 486 | | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "bas"); break; |
| 487 | | } |
| 488 | | } |
| 489 | | |
| 490 | 458 | static SYSTEM_CONFIG_START(sb2m600) |
| 491 | | CONFIG_DEVICE(sb2m600_cassette_getinfo) |
| 492 | 459 | CONFIG_RAM_DEFAULT(4 * 1024) |
| 493 | 460 | CONFIG_RAM(8 * 1024) |
| 494 | 461 | SYSTEM_CONFIG_END |