src/mess/drivers/tutor.c
| r5840 | r5841 | |
| 165 | 165 | #include "devices/cartslot.h" |
| 166 | 166 | #include "devices/cassette.h" |
| 167 | 167 | #include "sound/sn76496.h" |
| 168 | #include "machine/ctronics.h" |
| 168 | 169 | |
| 169 | | |
| 170 | 170 | /* mapper state */ |
| 171 | 171 | static char cartridge_enable; |
| 172 | 172 | |
| r5840 | r5841 | |
| 225 | 225 | TMS9928A_interrupt(device->machine); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | | static const device_config *printer_fp(running_machine *machine) |
| 229 | | { |
| 230 | | return image_from_devtype_and_index(machine, IO_PARALLEL, 0); |
| 231 | | } |
| 232 | | |
| 233 | | |
| 234 | 228 | /* |
| 235 | 229 | Keyboard: |
| 236 | 230 | |
| r5840 | r5841 | |
| 410 | 404 | } |
| 411 | 405 | |
| 412 | 406 | /* memory handlers */ |
| 413 | | static READ8_HANDLER(tutor_printer_r) |
| 407 | static READ8_DEVICE_HANDLER(tutor_printer_r) |
| 414 | 408 | { |
| 415 | 409 | int reply; |
| 416 | 410 | |
| 417 | 411 | switch (offset) |
| 418 | 412 | { |
| 419 | 413 | case 0x20: |
| 420 | | /* busy */ |
| 421 | | reply = printer_fp(space->machine) ? 0xff : 0x00; |
| 414 | /* busy */ |
| 415 | reply = centronics_busy_r(device) ? 0x00 : 0xff; |
| 422 | 416 | break; |
| 423 | 417 | |
| 424 | 418 | default: |
| r5840 | r5841 | |
| 431 | 425 | return reply; |
| 432 | 426 | } |
| 433 | 427 | |
| 434 | | static WRITE8_HANDLER(tutor_printer_w) |
| 435 | | { |
| 428 | static WRITE8_DEVICE_HANDLER(tutor_printer_w) |
| 429 | { |
| 436 | 430 | switch (offset) |
| 437 | 431 | { |
| 438 | 432 | case 0x10: |
| 439 | 433 | /* data */ |
| 440 | | printer_data = data; |
| 434 | centronics_data_w(device, 0, data); |
| 441 | 435 | break; |
| 442 | 436 | |
| 443 | 437 | case 0x40: |
| 444 | 438 | /* strobe */ |
| 445 | | if (data && ! printer_strobe) |
| 446 | | { |
| 447 | | /* strobe is asserted: output data */ |
| 448 | | if (printer_fp(space->machine)) |
| 449 | | image_fwrite(printer_fp(space->machine), & printer_data, 1); |
| 450 | | } |
| 451 | | printer_strobe = data != 0; |
| 439 | centronics_strobe_w(device, BIT(data, 7)); |
| 452 | 440 | break; |
| 453 | 441 | |
| 454 | 442 | default: |
| r5840 | r5841 | |
| 511 | 499 | AM_RANGE(0xe002, 0xe002) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w)/*VDP status*/ |
| 512 | 500 | AM_RANGE(0xe100, 0xe1ff) AM_READWRITE(tutor_mapper_r, tutor_mapper_w) /*cartridge mapper*/ |
| 513 | 501 | AM_RANGE(0xe200, 0xe200) AM_DEVWRITE("sn76489a", sn76496_w) /*sound chip*/ |
| 514 | | AM_RANGE(0xe800, 0xe8ff) AM_READWRITE(tutor_printer_r, tutor_printer_w) /*printer*/ |
| 502 | AM_RANGE(0xe800, 0xe8ff) AM_DEVREADWRITE("printer",tutor_printer_r, tutor_printer_w) /*printer*/ |
| 515 | 503 | AM_RANGE(0xee00, 0xeeff) AM_READWRITE(SMH_NOP, tutor_cassette_w) /*cassette interface*/ |
| 516 | 504 | |
| 517 | 505 | AM_RANGE(0xf000, 0xffff) AM_NOP /*free for expansion (and internal processor RAM)*/ |
| r5840 | r5841 | |
| 689 | 677 | MDRV_CARTSLOT_NOT_MANDATORY |
| 690 | 678 | MDRV_CARTSLOT_LOAD(tutor_cart) |
| 691 | 679 | MDRV_CARTSLOT_UNLOAD(tutor_cart) |
| 680 | |
| 681 | MDRV_CENTRONICS_ADD("printer", standard_centronics) |
| 692 | 682 | MACHINE_DRIVER_END |
| 693 | 683 | |
| 694 | 684 | |
| r5840 | r5841 | |
| 702 | 692 | ROM_LOAD("tutor2.bin", 0x8000, 0x4000, CRC(05f228f5) SHA1(46a14a45f6f9e2c30663a2b87ce60c42768a78d0)) /* BASIC ROM */ |
| 703 | 693 | ROM_END |
| 704 | 694 | |
| 705 | | static void tutor_parallel_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 706 | | { |
| 707 | | /* parallel */ |
| 708 | | switch(state) |
| 709 | | { |
| 710 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 711 | | case MESS_DEVINFO_INT_TYPE: info->i = IO_PARALLEL; break; |
| 712 | | case MESS_DEVINFO_INT_READABLE: info->i = 0; break; |
| 713 | | case MESS_DEVINFO_INT_WRITEABLE: info->i = 1; break; |
| 714 | | case MESS_DEVINFO_INT_CREATABLE: info->i = 1; break; |
| 715 | | case MESS_DEVINFO_INT_COUNT: info->i = 1; break; |
| 716 | | |
| 717 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 718 | | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), ""); break; |
| 719 | | } |
| 720 | | } |
| 721 | | |
| 722 | | static SYSTEM_CONFIG_START(tutor) |
| 723 | | /* cartridge port is not emulated */ |
| 724 | | CONFIG_DEVICE(tutor_parallel_getinfo) |
| 725 | | SYSTEM_CONFIG_END |
| 726 | | |
| 727 | 695 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 728 | | COMP( 1983?, tutor, 0, 0, tutor, tutor, tutor, tutor, "Tomy", "Tomy Tutor" , 0) |
| 696 | COMP( 1983?, tutor, 0, 0, tutor, tutor, tutor, 0, "Tomy", "Tomy Tutor" , 0) |