Previous 199869 Revisions Next

r22647 Thursday 2nd May, 2013 at 19:55:39 UTC by David Haywood
a little more silence (nw)
[src/mame/drivers]bfm_sc5.c
[src/mame/includes]bfm_sc5.h

trunk/src/mame/includes/bfm_sc5.h
r22646r22647
66public:
77   bfm_sc5_state(const machine_config &mconfig, device_type type, const char *tag)
88      : driver_device(mconfig, type, tag),
9         m_maincpu(*this, "maincpu")
9         m_maincpu(*this, "maincpu"),
10         m_vfd0(*this, "vfd0")
1011   { }
1112
1213protected:
1314
15
16public:
17
18
1419   // devices
1520   required_device<cpu_device> m_maincpu;
16public:
21   optional_device<bfm_bda_t> m_vfd0;
22
23   // serial vfd
24   int vfd_enabled;
25   bool vfd_old_clock;
26
27   UINT8 vfd_ser_value;
28   int vfd_ser_count;
29
1730   DECLARE_DRIVER_INIT(sc5);
1831   DECLARE_WRITE_LINE_MEMBER(bfm_sc5_ym_irqhandler);
1932   DECLARE_READ8_MEMBER( sc5_10202F0_r );
trunk/src/mame/drivers/bfm_sc5.c
r22646r22647
1515#include "bfm_sc5.lh"
1616#include "video/awpvid.h"
1717
18
19
20void bfm_sc5_reset_serial_vfd(running_machine &machine)
21{
22   bfm_sc5_state *state = machine.driver_data<bfm_sc5_state>();
23
24   state->m_vfd0->reset();
25   state->vfd_old_clock = false;
26}
27
28void bfm_sc5_write_serial_vfd(running_machine &machine, bool cs, bool clock, bool data)
29{
30   bfm_sc5_state *state = machine.driver_data<bfm_sc5_state>();
31
32   // if we're turned on
33   if ( cs )
34   {
35      if ( !state->vfd_enabled )
36      {
37         bfm_sc5_reset_serial_vfd(machine);
38         state->vfd_old_clock = clock;
39         state->vfd_enabled = true;
40      }
41      else
42      {
43         // if the clock line changes
44         if ( clock != state->vfd_old_clock )
45         {
46            if ( !clock )
47            {
48            //Should move to the internal serial process when DM01 is device-ified
49//                  m_vfd0->shift_data(!data);
50               state->vfd_ser_value <<= 1;
51               if (data) state->vfd_ser_value |= 1;
52
53               state->vfd_ser_count++;
54               if ( state->vfd_ser_count == 8 )
55               {
56                  state->vfd_ser_count = 0;
57               //   if (machine.device("matrix"))
58               //   {
59               //      BFM_dm01_writedata(machine,state->vfd_ser_value);
60               //   }
61               //   else
62                  {
63                     state->m_vfd0->write_char(state->vfd_ser_value);
64                  }
65               }
66            }
67            state->vfd_old_clock = clock;
68         }
69      }
70   }
71   else
72   {
73      state->vfd_enabled = false;
74   }
75}
76
77
1878static ADDRESS_MAP_START( sc5_map, AS_PROGRAM, 32, bfm_sc5_state )
1979   // ROM (max size?)
2080   AM_RANGE(0x00000000, 0x002fffff) AM_ROM
r22646r22647
159219   switch (offset)
160220   {
161221      case 0x0:
222         bfm_sc5_write_serial_vfd(machine(), (data &0x4)?1:0, (data &0x1)?1:0, (data&0x2) ? 0:1);
223         if (data&0xf8) printf("%s: sc5_10202F0_w %d - %02x\n", machine().describe_context(), offset, data);
224         break;
162225      case 0x1:
163226      case 0x2:
164227      case 0x3:

Previous 199869 Revisions Next


© 1997-2024 The MAME Team