src/mess/layout/x68000.lay
| r0 | r2965 | |
| 1 | <!-- Basic display of disk drive LEDs for the Sharp X680x0 -->
|
| 2 | |
| 3 | <mamelayout version="2">
|
| 4 | |
| 5 | <element name="access_led">
|
| 6 | <disk>
|
| 7 | <color red="1.0" green="0.0" blue="0.0" />
|
| 8 | </disk>
|
| 9 | </element>
|
| 10 | <element name="ctrl_led">
|
| 11 | <disk>
|
| 12 | <color red="0.0" green="1.0" blue="0.0" />
|
| 13 | </disk>
|
| 14 | </element>
|
| 15 | <element name="eject_led">
|
| 16 | <disk>
|
| 17 | <color red="0.5" green="0.0" blue="0.0" />
|
| 18 | </disk>
|
| 19 | </element>
|
| 20 | <element name="drv0">
|
| 21 | <text string="Drv0:">
|
| 22 | <color red="1.0" green="1.0" blue="1.0" />
|
| 23 | </text>
|
| 24 | </element>
|
| 25 | <element name="drv1">
|
| 26 | <text string="Drv1:">
|
| 27 | <color red="1.0" green="1.0" blue="1.0" />
|
| 28 | </text>
|
| 29 | </element>
|
| 30 | <element name="drv2">
|
| 31 | <text string="Drv2:">
|
| 32 | <color red="1.0" green="1.0" blue="1.0" />
|
| 33 | </text>
|
| 34 | </element>
|
| 35 | <element name="drv3">
|
| 36 | <text string="Drv3:">
|
| 37 | <color red="1.0" green="1.0" blue="1.0" />
|
| 38 | </text>
|
| 39 | </element>
|
| 40 | |
| 41 | <view name="Disk Drive LEDs">
|
| 42 | <bezel name="drv0text" element="drv0">
|
| 43 | <bounds left="0" right="59" top="0" bottom="30" />
|
| 44 | </bezel>
|
| 45 | <bezel name="ctrl_drv0" element="ctrl_led">
|
| 46 | <bounds left="40" right="54" top="31" bottom="45" />
|
| 47 | </bezel>
|
| 48 | <bezel name="access_drv0" element="access_led">
|
| 49 | <bounds left="0" right="14" top="31" bottom="45" />
|
| 50 | </bezel>
|
| 51 | <bezel name="eject_drv0" element="eject_led">
|
| 52 | <bounds left="20" right="34" top="31" bottom="45" />
|
| 53 | </bezel>
|
| 54 | <bezel name="drv1text" element="drv1">
|
| 55 | <bounds left="0" right="59" top="70" bottom="100" />
|
| 56 | </bezel>
|
| 57 | <bezel name="ctrl_drv1" element="ctrl_led">
|
| 58 | <bounds left="40" right="54" top="101" bottom="115" />
|
| 59 | </bezel>
|
| 60 | <bezel name="access_drv1" element="access_led">
|
| 61 | <bounds left="0" right="14" top="101" bottom="115" />
|
| 62 | </bezel>
|
| 63 | <bezel name="eject_drv1" element="eject_led">
|
| 64 | <bounds left="20" right="34" top="101" bottom="115" />
|
| 65 | </bezel>
|
| 66 | <bezel name="drv2text" element="drv2">
|
| 67 | <bounds left="0" right="59" top="140" bottom="170" />
|
| 68 | </bezel>
|
| 69 | <bezel name="ctrl_drv2" element="ctrl_led">
|
| 70 | <bounds left="40" right="54" top="171" bottom="185" />
|
| 71 | </bezel>
|
| 72 | <bezel name="access_drv2" element="access_led">
|
| 73 | <bounds left="0" right="14" top="171" bottom="185" />
|
| 74 | </bezel>
|
| 75 | <bezel name="eject_drv2" element="eject_led">
|
| 76 | <bounds left="20" right="34" top="171" bottom="185" />
|
| 77 | </bezel>
|
| 78 | <bezel name="drv3text" element="drv3">
|
| 79 | <bounds left="0" right="59" top="210" bottom="240" />
|
| 80 | </bezel>
|
| 81 | <bezel name="ctrl_drv3" element="ctrl_led">
|
| 82 | <bounds left="40" right="54" top="241" bottom="255" />
|
| 83 | </bezel>
|
| 84 | <bezel name="access_drv3" element="access_led">
|
| 85 | <bounds left="0" right="14" top="241" bottom="255" />
|
| 86 | </bezel>
|
| 87 | <bezel name="eject_drv3" element="eject_led">
|
| 88 | <bounds left="20" right="34" top="241" bottom="255" />
|
| 89 | </bezel>
|
| 90 | <screen index="0">
|
| 91 | <bounds left="61" right="1084" top="0" bottom="1023" />
|
| 92 | </screen>
|
| 93 | </view>
|
| 94 | |
| 95 | </mamelayout> |
src/mess/drivers/x68k.c
| r2964 | r2965 | |
| 123 | 123 | */ |
| 124 | 124 | |
| 125 | 125 | #include "driver.h" |
| 126 | | #include "render.h" |
| 127 | 126 | #include "deprecat.h" |
| 128 | 127 | #include "cpu/m68000/m68000.h" |
| 129 | 128 | #include "machine/68901mfp.h" |
| r2964 | r2965 | |
| 138 | 137 | #include "devices/harddriv.h" |
| 139 | 138 | #include "machine/x68k_hdc.h" |
| 140 | 139 | #include "includes/x68k.h" |
| 140 | #include "x68000.lh" |
| 141 | 141 | |
| 142 | 142 | struct x68k_system sys; |
| 143 | 143 | |
| r2964 | r2965 | |
| 146 | 146 | static int current_vector[8]; |
| 147 | 147 | static UINT8 current_irq_line; |
| 148 | 148 | static unsigned int x68k_scanline; |
| 149 | static int led_state; |
| 149 | 150 | |
| 150 | 151 | static UINT8 mfp_key; |
| 151 | 152 | |
| r2964 | r2965 | |
| 156 | 157 | emu_timer* raster_irq; |
| 157 | 158 | emu_timer* vblank_irq; |
| 158 | 159 | static emu_timer* mouse_timer; // to set off the mouse interrupts via the SCC |
| 160 | static emu_timer* led_timer; // to make disk drive control LEDs blink |
| 159 | 161 | |
| 160 | 162 | // MFP is clocked at 4MHz, so at /4 prescaler the timer is triggered after 1us (4 cycles) |
| 161 | 163 | // No longer necessary with the new MFP core |
| r2964 | r2965 | |
| 326 | 328 | } |
| 327 | 329 | #endif |
| 328 | 330 | |
| 331 | // LED timer callback |
| 332 | static TIMER_CALLBACK( x68k_led_callback ) |
| 333 | { |
| 334 | int drive; |
| 335 | if(led_state == 0) |
| 336 | led_state = 1; |
| 337 | else |
| 338 | led_state = 0; |
| 339 | if(led_state == 1) |
| 340 | { |
| 341 | for(drive=0;drive<4;drive++) |
| 342 | output_set_indexed_value("ctrl_drv",drive,sys.fdc.led_ctrl[drive] ? 0 : 1); |
| 343 | } |
| 344 | else |
| 345 | { |
| 346 | for(drive=0;drive<4;drive++) |
| 347 | output_set_indexed_value("ctrl_drv",drive,1); |
| 348 | } |
| 349 | |
| 350 | } |
| 351 | |
| 329 | 352 | // 4 channel DMA controller (Hitachi HD63450) |
| 330 | 353 | static WRITE16_HANDLER( x68k_dmac_w ) |
| 331 | 354 | { |
| r2964 | r2965 | |
| 375 | 398 | |
| 376 | 399 | if(data & 0x80) // LED status |
| 377 | 400 | { |
| 378 | | output_set_value("key_led_kana",data & 0x01); |
| 379 | | output_set_value("key_led_romaji",data & 0x02); |
| 380 | | output_set_value("key_led_code",data & 0x04); |
| 381 | | output_set_value("key_led_caps",data & 0x08); |
| 382 | | output_set_value("key_led_insert",data & 0x10); |
| 383 | | output_set_value("key_led_hiragana",data & 0x20); |
| 384 | | output_set_value("key_led_fullsize",data & 0x40); |
| 401 | output_set_value("key_led_kana",(data & 0x01) ? 0 : 1); |
| 402 | output_set_value("key_led_romaji",(data & 0x02) ? 0 : 1); |
| 403 | output_set_value("key_led_code",(data & 0x04) ? 0 : 1); |
| 404 | output_set_value("key_led_caps",(data & 0x08) ? 0 : 1); |
| 405 | output_set_value("key_led_insert",(data & 0x10) ? 0 : 1); |
| 406 | output_set_value("key_led_hiragana",(data & 0x20) ? 0 : 1); |
| 407 | output_set_value("key_led_fullsize",(data & 0x40) ? 0 : 1); |
| 385 | 408 | logerror("KB: LED status set to %02x\n",data & 0x7f); |
| 386 | 409 | } |
| 387 | 410 | |
| r2964 | r2965 | |
| 705 | 728 | if(x & (1 << drive)) |
| 706 | 729 | { |
| 707 | 730 | sys.fdc.led_ctrl[drive] = data & 0x80; // blinking drive LED if no disk inserted |
| 708 | | sys.fdc.led_eject[drive] = data & 0x40; // eject button LED |
| 709 | | output_set_indexed_value("ctrl_drv",drive,data & 0x80); |
| 710 | | output_set_indexed_value("eject_drv",drive,data & 0x40); |
| 731 | sys.fdc.led_eject[drive] = data & 0x40; // eject button LED (on when set to 0) |
| 732 | output_set_indexed_value("eject_drv",drive,(data & 0x40) ? 1 : 0); |
| 711 | 733 | if(data & 0x20) // ejects disk |
| 712 | 734 | { |
| 713 | 735 | image_unload(image_from_devtype_and_index(IO_FLOPPY, drive)); |
| r2964 | r2965 | |
| 722 | 744 | sys.fdc.media_density[data & 0x03] = data & 0x10; |
| 723 | 745 | sys.fdc.motor[data & 0x03] = data & 0x80; |
| 724 | 746 | floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, data & 0x03), (data & 0x80)); |
| 725 | | /* set drive access LED outputs */ |
| 726 | | output_set_indexed_value("access_drv",data & 0x03,data & 0x80); |
| 747 | if(data & 0x80) |
| 748 | { |
| 749 | for(drive=0;drive<4;drive++) // enable motor for this drive, disable all the others. |
| 750 | { |
| 751 | if(drive == (data & 0x03)) |
| 752 | floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, drive), 1); |
| 753 | else |
| 754 | floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, drive), 0); |
| 755 | } |
| 756 | } |
| 757 | else // BIOS code suggests that setting bit 7 of this port to 0 disables the motor of all floppy drives |
| 758 | { |
| 759 | for(drive=0;drive<4;drive++) |
| 760 | floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, drive), 0); |
| 761 | } |
| 727 | 762 | floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0),1,1); |
| 728 | 763 | floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 1),1,1); |
| 729 | 764 | floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 2),1,1); |
| 730 | 765 | floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 3),1,1); |
| 766 | for(drive=0;drive<4;drive++) |
| 767 | { |
| 768 | if(floppy_drive_get_flag_state(image_from_devtype_and_index(IO_FLOPPY, drive),FLOPPY_DRIVE_MOTOR_ON)) |
| 769 | output_set_indexed_value("access_drv",drive,0); |
| 770 | else |
| 771 | output_set_indexed_value("access_drv",drive,1); |
| 772 | } |
| 731 | 773 | logerror("FDC: Drive #%i: Drive selection set to %02x\n",data & 0x03,data); |
| 732 | 774 | break; |
| 733 | 775 | default: |
| r2964 | r2965 | |
| 917 | 959 | */ |
| 918 | 960 | static WRITE16_HANDLER( x68k_sysport_w ) |
| 919 | 961 | { |
| 920 | | //render_container* container; |
| 921 | 962 | switch(offset) |
| 922 | 963 | { |
| 923 | 964 | case 0x00: |
| 924 | 965 | sys.sysport.contrast = data & 0x0f; // often used for screen fades / blanking |
| 925 | | //container = render_container_get_screen(machine->primary_screen); |
| 926 | | //render_container_set_brightness(container,(float)(sys.sysport.contrast) / 14.0); |
| 966 | // TODO: implement a decent, not slow, brightness control |
| 927 | 967 | break; |
| 928 | 968 | case 0x01: |
| 929 | 969 | sys.sysport.monitor = data & 0x08; |
| r2964 | r2965 | |
| 1957 | 1997 | timer_adjust_oneshot(scanline_timer, video_screen_get_scan_period(machine->primary_screen), 1); |
| 1958 | 1998 | |
| 1959 | 1999 | sys.mfp.gpio = 0xfb; |
| 2000 | |
| 2001 | // reset output values |
| 2002 | output_set_value("key_led_kana",1); |
| 2003 | output_set_value("key_led_romaji",1); |
| 2004 | output_set_value("key_led_code",1); |
| 2005 | output_set_value("key_led_caps",1); |
| 2006 | output_set_value("key_led_insert",1); |
| 2007 | output_set_value("key_led_hiragana",1); |
| 2008 | output_set_value("key_led_fullsize",1); |
| 2009 | for(drive=0;drive<4;drive++) |
| 2010 | { |
| 2011 | output_set_indexed_value("eject_drv",drive,1); |
| 2012 | output_set_indexed_value("ctrl_drv",drive,1); |
| 2013 | output_set_indexed_value("access_drv",drive,1); |
| 2014 | } |
| 1960 | 2015 | } |
| 1961 | 2016 | |
| 1962 | 2017 | static MACHINE_START( x68000 ) |
| r2964 | r2965 | |
| 1983 | 2038 | timer_adjust_periodic(mouse_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(1)); // a guess for now |
| 1984 | 2039 | sys.mouse.inputtype = 0; |
| 1985 | 2040 | |
| 2041 | // start LED timer |
| 2042 | timer_adjust_periodic(led_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(400)); |
| 2043 | |
| 1986 | 2044 | nec765_init(machine, &fdc_interface,NEC72065,NEC765_RDY_PIN_CONNECTED); |
| 1987 | 2045 | nec765_reset(machine, 0); |
| 1988 | 2046 | } |
| r2964 | r2965 | |
| 2026 | 2084 | raster_irq = timer_alloc(x68k_crtc_raster_irq,NULL); |
| 2027 | 2085 | vblank_irq = timer_alloc(x68k_crtc_vblank_irq,NULL); |
| 2028 | 2086 | mouse_timer = timer_alloc(x68k_scc_ack,NULL); |
| 2087 | led_timer = timer_alloc(x68k_led_callback,NULL); |
| 2029 | 2088 | } |
| 2030 | 2089 | |
| 2031 | 2090 | |
| r2964 | r2965 | |
| 2067 | 2126 | MDRV_VIDEO_START( x68000 ) |
| 2068 | 2127 | MDRV_VIDEO_UPDATE( x68000 ) |
| 2069 | 2128 | |
| 2129 | MDRV_DEFAULT_LAYOUT( layout_x68000 ) |
| 2130 | |
| 2070 | 2131 | /* sound hardware */ |
| 2071 | 2132 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 2072 | 2133 | MDRV_SOUND_ADD(YM2151, 4000000) |