Previous 15994 Revisions Next

r2965 Saturday 19th July, 2008 at 09:27:51 UTC by Barry Rodewald
[X68000] Corrected LED output, and added layout file to display them.
[src/mess]mess.mak
[src/mess/drivers]x68k.c
[src/mess/layout]x68000.lay*

src/mess/mess.mak
r2964r2965
13051305$(MESS_DRIVERS)/svision.o:   $(MESS_LAYOUT)/svision.lh
13061306$(MESS_DRIVERS)/sym1.o:      $(MESS_LAYOUT)/sym1.lh
13071307$(MESS_DRIVERS)/ut88.o:      $(MESS_LAYOUT)/ut88mini.lh
1308$(MESS_DRIVERS)/x68k.o:      $(MESS_LAYOUT)/x68000.lh
13081309
13091310
1310
13111311#-------------------------------------------------
13121312# MESS-specific tools
13131313#-------------------------------------------------
src/mess/layout/x68000.lay
r0r2965
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
r2964r2965
123123*/
124124
125125#include "driver.h"
126#include "render.h"
127126#include "deprecat.h"
128127#include "cpu/m68000/m68000.h"
129128#include "machine/68901mfp.h"
r2964r2965
138137#include "devices/harddriv.h"
139138#include "machine/x68k_hdc.h"
140139#include "includes/x68k.h"
140#include "x68000.lh"
141141
142142struct x68k_system sys;
143143
r2964r2965
146146static int current_vector[8];
147147static UINT8 current_irq_line;
148148static unsigned int x68k_scanline;
149static int led_state;
149150
150151static UINT8 mfp_key;
151152
r2964r2965
156157emu_timer* raster_irq;
157158emu_timer* vblank_irq;
158159static emu_timer* mouse_timer;  // to set off the mouse interrupts via the SCC
160static emu_timer* led_timer;  // to make disk drive control LEDs blink
159161
160162// MFP is clocked at 4MHz, so at /4 prescaler the timer is triggered after 1us (4 cycles)
161163// No longer necessary with the new MFP core
r2964r2965
326328}
327329#endif
328330
331// LED timer callback
332static 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
329352// 4 channel DMA controller (Hitachi HD63450)
330353static WRITE16_HANDLER( x68k_dmac_w )
331354{
r2964r2965
375398
376399   if(data & 0x80)  // LED status
377400   {
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);
385408      logerror("KB: LED status set to %02x\n",data & 0x7f);
386409   }
387410
r2964r2965
705728         if(x & (1 << drive))
706729         {
707730            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);
711733            if(data & 0x20)  // ejects disk
712734            {
713735               image_unload(image_from_devtype_and_index(IO_FLOPPY, drive));
r2964r2965
722744      sys.fdc.media_density[data & 0x03] = data & 0x10;
723745      sys.fdc.motor[data & 0x03] = data & 0x80;
724746      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      }
727762      floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0),1,1);
728763      floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 1),1,1);
729764      floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 2),1,1);
730765      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      }
731773      logerror("FDC: Drive #%i: Drive selection set to %02x\n",data & 0x03,data);
732774      break;
733775   default:
r2964r2965
917959*/
918960static WRITE16_HANDLER( x68k_sysport_w )
919961{
920   //render_container* container;
921962   switch(offset)
922963   {
923964   case 0x00:
924965      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
927967      break;
928968   case 0x01:
929969      sys.sysport.monitor = data & 0x08;
r2964r2965
19571997   timer_adjust_oneshot(scanline_timer, video_screen_get_scan_period(machine->primary_screen), 1);
19581998
19591999   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   }
19602015}
19612016
19622017static MACHINE_START( x68000 )
r2964r2965
19832038   timer_adjust_periodic(mouse_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(1));  // a guess for now
19842039   sys.mouse.inputtype = 0;
19852040
2041   // start LED timer
2042   timer_adjust_periodic(led_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(400));
2043
19862044   nec765_init(machine, &fdc_interface,NEC72065,NEC765_RDY_PIN_CONNECTED);
19872045   nec765_reset(machine, 0);
19882046}
r2964r2965
20262084   raster_irq = timer_alloc(x68k_crtc_raster_irq,NULL);
20272085   vblank_irq = timer_alloc(x68k_crtc_vblank_irq,NULL);
20282086   mouse_timer = timer_alloc(x68k_scc_ack,NULL);
2087   led_timer = timer_alloc(x68k_led_callback,NULL);
20292088}
20302089
20312090
r2964r2965
20672126   MDRV_VIDEO_START( x68000 )
20682127   MDRV_VIDEO_UPDATE( x68000 )
20692128
2129   MDRV_DEFAULT_LAYOUT( layout_x68000 )
2130
20702131   /* sound hardware */
20712132   MDRV_SPEAKER_STANDARD_MONO("mono")
20722133   MDRV_SOUND_ADD(YM2151, 4000000)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team