src/mess/drivers/tm990189.c
| r6729 | r6730 | |
| 45 | 45 | #include "devices/cassette.h" |
| 46 | 46 | #include "sound/speaker.h" |
| 47 | 47 | #include "sound/wave.h" |
| 48 | #include "machine/serial.h" |
| 48 | 49 | |
| 49 | | |
| 50 | 50 | static int load_state; |
| 51 | 51 | static int ic_state; |
| 52 | 52 | |
| r6729 | r6730 | |
| 88 | 88 | |
| 89 | 89 | static MACHINE_RESET( tm990_189 ) |
| 90 | 90 | { |
| 91 | | displayena_timer = timer_alloc(machine, NULL, NULL); |
| 92 | | |
| 93 | 91 | hold_load(machine); |
| 94 | 92 | } |
| 95 | 93 | |
| 94 | static MACHINE_START( tm990_189 ) |
| 95 | { |
| 96 | displayena_timer = timer_alloc(machine, NULL, NULL); |
| 97 | } |
| 96 | 98 | static const TMS9928a_interface tms9918_interface = |
| 97 | 99 | { |
| 98 | 100 | TMS99x8, |
| r6729 | r6730 | |
| 104 | 106 | static MACHINE_START( tm990_189_v ) |
| 105 | 107 | { |
| 106 | 108 | TMS9928A_configure(&tms9918_interface); |
| 107 | | } |
| 108 | | |
| 109 | | static MACHINE_RESET( tm990_189_v ) |
| 110 | | { |
| 109 | |
| 111 | 110 | displayena_timer = timer_alloc(machine, NULL, NULL); |
| 112 | 111 | |
| 113 | 112 | joy1x_timer = timer_alloc(machine, NULL, NULL); |
| 114 | 113 | joy1y_timer = timer_alloc(machine, NULL, NULL); |
| 115 | 114 | joy2x_timer = timer_alloc(machine, NULL, NULL); |
| 116 | 115 | joy2y_timer = timer_alloc(machine, NULL, NULL); |
| 116 | } |
| 117 | 117 | |
| 118 | static MACHINE_RESET( tm990_189_v ) |
| 119 | { |
| 118 | 120 | hold_load(machine); |
| 119 | 121 | |
| 120 | 122 | TMS9928A_reset(); |
| r6729 | r6730 | |
| 361 | 363 | |
| 362 | 364 | if (/*rs232_rts &&*/ /*(mame_ftell(rs232_fp) < mame_fsize(rs232_fp))*/1) |
| 363 | 365 | { |
| 364 | | if (image_fread(rs232_fp, &buf, 1) == 1) |
| 366 | if (image_fread(ptr, &buf, 1) == 1) |
| 365 | 367 | tms9902_push_data(devtag_get_device(machine, "tms9902"), buf); |
| 366 | 368 | } |
| 367 | 369 | } |
| r6729 | r6730 | |
| 371 | 373 | */ |
| 372 | 374 | static DEVICE_IMAGE_LOAD( tm990_189_rs232 ) |
| 373 | 375 | { |
| 374 | | int id = image_index_in_device(image); |
| 375 | | |
| 376 | | if (id != 0) |
| 377 | | return INIT_FAIL; |
| 378 | | |
| 379 | | rs232_fp = image; |
| 380 | | |
| 381 | 376 | tms9902_set_dsr(devtag_get_device(image->machine, "tms9902"), 1); |
| 382 | | rs232_input_timer = timer_alloc(image->machine, rs232_input_callback, NULL); |
| 377 | rs232_input_timer = timer_alloc(image->machine, rs232_input_callback, (void*)image); |
| 383 | 378 | timer_adjust_periodic(rs232_input_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(10)); |
| 384 | 379 | |
| 385 | 380 | return INIT_PASS; |
| r6729 | r6730 | |
| 390 | 385 | */ |
| 391 | 386 | static DEVICE_IMAGE_UNLOAD( tm990_189_rs232 ) |
| 392 | 387 | { |
| 393 | | int id = image_index_in_device(image); |
| 394 | | |
| 395 | | if (id != 0) |
| 396 | | return; |
| 397 | | |
| 398 | | rs232_fp = NULL; |
| 399 | | |
| 400 | 388 | tms9902_set_dsr(devtag_get_device(image->machine, "tms9902"), 0); |
| 401 | 389 | |
| 402 | 390 | timer_reset(rs232_input_timer, attotime_never); /* FIXME - timers should only be allocated once */ |
| 403 | 391 | } |
| 404 | 392 | |
| 393 | static DEVICE_GET_INFO( tm990_189_rs232 ) |
| 394 | { |
| 395 | switch ( state ) |
| 396 | { |
| 397 | case DEVINFO_FCT_IMAGE_LOAD: info->f = (genf *) DEVICE_IMAGE_LOAD_NAME( tm990_189_rs232 ); break; |
| 398 | case DEVINFO_FCT_IMAGE_UNLOAD: info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME( tm990_189_rs232 ); break; |
| 399 | case DEVINFO_STR_NAME: strcpy(info->s, "TM990/189 RS232 port"); break; |
| 400 | case DEVINFO_STR_IMAGE_FILE_EXTENSIONS: strcpy(info->s, ""); break; |
| 401 | case DEVINFO_INT_IMAGE_READABLE: info->i = 1; break; |
| 402 | case DEVINFO_INT_IMAGE_WRITEABLE: info->i = 1; break; |
| 403 | case DEVINFO_INT_IMAGE_CREATABLE: info->i = 1; break; |
| 404 | default: DEVICE_GET_INFO_CALL(serial); break; |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | #define TM990_189_RS232 DEVICE_GET_INFO_NAME(tm990_189_rs232) |
| 409 | |
| 410 | #define MDRV_TM990_189_RS232_ADD(_tag) \ |
| 411 | MDRV_DEVICE_ADD(_tag, TM990_189_RS232, 0) |
| 412 | |
| 413 | |
| 405 | 414 | static TMS9902_RST_CALLBACK( rts_callback ) |
| 406 | 415 | { |
| 407 | 416 | rs232_rts = RTS; |
| r6729 | r6730 | |
| 752 | 761 | MDRV_CPU_PROGRAM_MAP(tm990_189_memmap) |
| 753 | 762 | MDRV_CPU_IO_MAP(tm990_189_cru_map) |
| 754 | 763 | |
| 764 | MDRV_MACHINE_START( tm990_189 ) |
| 755 | 765 | MDRV_MACHINE_RESET( tm990_189 ) |
| 756 | 766 | |
| 757 | 767 | /* video hardware - we emulate a 8-segment LED display */ |
| r6729 | r6730 | |
| 785 | 795 | MDRV_TMS9901_ADD("tms9901_1", sys9901reset_param) |
| 786 | 796 | /* tms9902 */ |
| 787 | 797 | MDRV_TMS9902_ADD("tms9902", tms9902_params) |
| 798 | |
| 799 | MDRV_TM990_189_RS232_ADD("rs232") |
| 788 | 800 | MACHINE_DRIVER_END |
| 789 | 801 | |
| 790 | 802 | #define LEFT_BORDER 15 |
| r6729 | r6730 | |
| 829 | 841 | MDRV_TMS9901_ADD("tms9901_1", sys9901reset_param) |
| 830 | 842 | /* tms9902 */ |
| 831 | 843 | MDRV_TMS9902_ADD("tms9902", tms9902_params) |
| 844 | |
| 845 | MDRV_TM990_189_RS232_ADD("rs232") |
| 832 | 846 | MACHINE_DRIVER_END |
| 833 | 847 | |
| 834 | 848 | |
| r6729 | r6730 | |
| 955 | 969 | PORT_BIT( 0x3ff, 0x1aa, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0xd2,0x282 ) PORT_PLAYER(2) PORT_REVERSE |
| 956 | 970 | INPUT_PORTS_END |
| 957 | 971 | |
| 958 | | static void tm990_189_serial_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 959 | | { |
| 960 | | /* serial */ |
| 961 | | switch(state) |
| 962 | | { |
| 963 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 964 | | case MESS_DEVINFO_INT_TYPE: info->i = IO_SERIAL; break; |
| 965 | | case MESS_DEVINFO_INT_READABLE: info->i = 1; break; |
| 966 | | case MESS_DEVINFO_INT_WRITEABLE: info->i = 1; break; |
| 967 | | case MESS_DEVINFO_INT_CREATABLE: info->i = 1; break; |
| 968 | | case MESS_DEVINFO_INT_COUNT: info->i = 1; break; |
| 969 | | |
| 970 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 971 | | case MESS_DEVINFO_PTR_LOAD: info->load = DEVICE_IMAGE_LOAD_NAME(tm990_189_rs232); break; |
| 972 | | case MESS_DEVINFO_PTR_UNLOAD: info->unload = DEVICE_IMAGE_UNLOAD_NAME(tm990_189_rs232); break; |
| 973 | | |
| 974 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 975 | | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), ""); break; |
| 976 | | } |
| 977 | | } |
| 978 | | |
| 979 | | static SYSTEM_CONFIG_START(tm990_189) |
| 980 | | /* a tape interface and a rs232 interface... */ |
| 981 | | CONFIG_DEVICE(tm990_189_serial_getinfo) |
| 982 | | SYSTEM_CONFIG_END |
| 983 | | |
| 984 | 972 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 985 | | COMP( 1978, 990189, 0, 0, tm990_189, tm990_189, 0, tm990_189, "Texas Instruments", "TM 990/189 University Board microcomputer with University Basic" , 0) |
| 986 | | COMP( 1980, 990189v, 990189, 0, tm990_189_v,tm990_189, 0, tm990_189, "Texas Instruments", "TM 990/189 University Board microcomputer with University Basic and Video Board Interface" , 0) |
| 973 | COMP( 1978, 990189, 0, 0, tm990_189, tm990_189, 0, 0, "Texas Instruments", "TM 990/189 University Board microcomputer with University Basic" , 0) |
| 974 | COMP( 1980, 990189v, 990189, 0, tm990_189_v,tm990_189, 0, 0, "Texas Instruments", "TM 990/189 University Board microcomputer with University Basic and Video Board Interface" , 0) |