Previous 199869 Revisions Next

r23523 Friday 7th June, 2013 at 18:00:31 UTC by Curt Coder
(MESS) victor9k: Fixed regression. (nw)
[src/mess/drivers]victor9k.c
[src/mess/includes]victor9k.h
[src/mess/machine]victor9kb.c victor9kb.h

trunk/src/mess/machine/victor9kb.c
r23522r23523
251251      m_ya(*this, "YA"),
252252      m_yb(*this, "YB"),
253253      m_yc(*this, "YC"),
254      m_write_kbrdy(*this),
254255      m_y(0),
255256      m_kbrdy(1),
256257      m_kbdata(1),
r23522r23523
258259{
259260}
260261
261//-------------------------------------------------
262//  device_config_complete - perform any
263//  operations now that the configuration is
264//  complete
265//-------------------------------------------------
266262
267void victor9k_keyboard_device::device_config_complete()
268{
269   // inherit a copy of the static data
270   const victor9k_keyboard_interface *intf = reinterpret_cast<const victor9k_keyboard_interface *>(static_config());
271   if (intf != NULL)
272      *static_cast<victor9k_keyboard_interface *>(this) = *intf;
273
274   // or initialize to defaults if none provided
275   else
276   {
277      memset(&m_out_kbrdy_cb, 0, sizeof(m_out_kbrdy_cb));
278   }
279}
280
281263//-------------------------------------------------
282264//  device_start - device-specific startup
283265//-------------------------------------------------
r23522r23523
285267void victor9k_keyboard_device::device_start()
286268{
287269   // resolve callbacks
288   m_out_kbrdy_func.resolve(m_out_kbrdy_cb, *this);
270   m_write_kbrdy.resolve_safe();
289271
290272   // state saving
291273   save_item(NAME(m_y));
r23522r23523
400382   if (m_kbrdy != kbrdy)
401383   {
402384      m_kbrdy = kbrdy;
403      m_out_kbrdy_func(m_kbrdy);
385      m_write_kbrdy(m_kbrdy);
404386   }
405387
406388   m_kbdata = BIT(data, 3);
trunk/src/mess/machine/victor9kb.h
r23522r23523
3030//  INTERFACE CONFIGURATION MACROS
3131//**************************************************************************
3232
33#define MCFG_VICTOR9K_KEYBOARD_ADD(_config) \
33#define MCFG_VICTOR9K_KEYBOARD_ADD(_kbrdy) \
3434   MCFG_DEVICE_ADD(VICTOR9K_KEYBOARD_TAG, VICTOR9K_KEYBOARD, 0) \
35   MCFG_DEVICE_CONFIG(_config)
35   downcast<victor9k_keyboard_device *>(device)->set_kbrdy_callback(DEVCB2_##_kbrdy); \
3636
3737
38#define VICTOR9K_KEYBOARD_INTERFACE(_name) \
39   const victor9k_keyboard_interface (_name) =
4038
41
42
4339//**************************************************************************
4440//  TYPE DEFINITIONS
4541//**************************************************************************
4642
47// ======================> victor9k_keyboard_interface
48
49struct victor9k_keyboard_interface
50{
51   devcb_write_line    m_out_kbrdy_cb;
52};
53
54
5543// ======================> victor9k_keyboard_device
5644
57class victor9k_keyboard_device :  public device_t,
58                           public victor9k_keyboard_interface
45class victor9k_keyboard_device :  public device_t
5946{
6047public:
6148   // construction/destruction
6249   victor9k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
6350
51   template<class _kbrdy> void set_kbrdy_callback(_kbrdy kbrdy) { m_write_kbrdy.set_callback(kbrdy); }
52
6453   // optional information overrides
6554   virtual const rom_entry *device_rom_region() const;
6655   virtual machine_config_constructor device_mconfig_additions() const;
r23522r23523
8069   // device-level overrides
8170   virtual void device_start();
8271   virtual void device_reset();
83   virtual void device_config_complete();
8472
8573private:
86   devcb_resolved_write_line   m_out_kbrdy_func;
87
8874   required_device<cpu_device> m_maincpu;
8975   required_ioport m_y0;
9076   required_ioport m_y1;
r23522r23523
10086   required_ioport m_yb;
10187   required_ioport m_yc;
10288
89   devcb2_write_line   m_write_kbrdy;
90
10391   UINT8 m_y;
10492   int m_kbrdy;
10593   int m_kbdata;
trunk/src/mess/includes/victor9k.h
r23522r23523
7474         m_kb(*this, VICTOR9K_KEYBOARD_TAG),
7575         m_rs232a(*this, RS232_A_TAG),
7676         m_rs232b(*this, RS232_B_TAG),
77         m_video_ram(*this, "video_ram")
77         m_video_ram(*this, "video_ram"),
78         m_da(0),
79         m_da0(0),
80         m_da1(0),
81         m_sel0(0),
82         m_sel1(0),
83         m_tach0(0),
84         m_tach1(0),
85         m_rdy0(0),
86         m_rdy1(0),
87         m_ds0(1),
88         m_ds1(1),
89         m_lms(0),
90         m_brdy(1),
91         m_sync(1),
92         m_gcrerr(0)
7893   { }
7994
8095   required_device<cpu_device> m_maincpu;
r23522r23523
125140
126141   DECLARE_WRITE8_MEMBER( via4_pa_w );
127142   DECLARE_WRITE8_MEMBER( via4_pb_w );
143   DECLARE_READ_LINE_MEMBER( ds0_r );
144   DECLARE_READ_LINE_MEMBER( ds1_r );
128145   DECLARE_WRITE_LINE_MEMBER( mode_w );
129146   DECLARE_WRITE_LINE_MEMBER( via4_irq_w );
130147
r23522r23523
147164
148165   DECLARE_WRITE_LINE_MEMBER( ssda_irq_w );
149166
167   void ready0_cb(floppy_image_device *, int device);
168   int load0_cb(floppy_image_device *device);
169   void unload0_cb(floppy_image_device *device);
170   void ready1_cb(floppy_image_device *, int device);
171   int load1_cb(floppy_image_device *device);
172   void unload1_cb(floppy_image_device *device);
173
150174   enum
151175   {
152176      LED_A = 0,
r23522r23523
177201   int m_tach1;
178202   int m_rdy0;
179203   int m_rdy1;
204   int m_ds0;
205   int m_ds1;
180206   UINT8 m_lms;                          /* motor speed */
181207   int m_st[2];                        /* stepper phase */
182208   int m_stp[2];                        /* stepper enable */
trunk/src/mess/drivers/victor9k.c
r23522r23523
8686
8787
8888//-------------------------------------------------
89//  floppy_p2_r -
90//-------------------------------------------------
91
92READ8_MEMBER( victor9k_state::floppy_p2_r )
93{
94   /*
95   
96       bit     description
97   
98       0       
99       1       
100       2       
101       3       
102       4       
103       5       
104       6       RDY0
105       7       RDY1
106   
107   */
108
109   UINT8 data = 0;
110
111   data |= m_rdy0 << 6;
112   data |= m_rdy1 << 7;
113
114   return data;
115}
116
117
118//-------------------------------------------------
89119//  floppy_p2_w -
90120//-------------------------------------------------
91121
r23522r23523
101131       3       STOP1
102132       4       SEL1
103133       5       SEL0
104       6       RDY0
105       7       RDY1
134       6       
135       7       
106136   
107137   */
108138
r23522r23523
130160   }
131161
132162   m_sel1 = sel1;
133
134   m_rdy0 = BIT(data, 6);
135   m_via5->write_ca2(m_rdy0);
136
137   m_rdy1 = BIT(data, 7);
138   m_via5->write_cb2(m_rdy1);
139163}
140164
141165
r23522r23523
202226//-------------------------------------------------
203227
204228static ADDRESS_MAP_START( floppy_io, AS_IO, 8, victor9k_state )
205   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(floppy_p1_r)
206   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(floppy_p2_w)
229   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(floppy_p1_r) AM_WRITENOP
230   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(floppy_p2_r, floppy_p2_w)
207231   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(tach0_r)
208232   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(tach1_r)
209233   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(da_w)
r23522r23523
784808   m_st[1] = data >> 4;
785809}
786810
811READ_LINE_MEMBER( victor9k_state::ds0_r )
812{
813   return m_ds0;
814}
815
816READ_LINE_MEMBER( victor9k_state::ds1_r )
817{
818   return m_ds1;
819}
820
787821WRITE_LINE_MEMBER( victor9k_state::mode_w )
788822{
789823}
r23522r23523
799833{
800834   DEVCB_NULL,
801835   DEVCB_NULL,
802   DEVCB_NULL, // DS0
803   DEVCB_NULL, // DS1
836   DEVCB_DRIVER_LINE_MEMBER(victor9k_state, ds0_r),
837   DEVCB_DRIVER_LINE_MEMBER(victor9k_state, ds1_r),
804838   DEVCB_NULL,
805839   DEVCB_NULL,
806840
r23522r23523
9931027   data |= m_rdy1 << 1;
9941028
9951029   // door B sense
1030   data |= m_ds1 << 3;
9961031
9971032   // door A sense
1033   data |= m_ds0 << 4;
9981034
9991035   // single/double sided
10001036   data |= (m_drive ? m_floppy1->twosid_r() : m_floppy0->twosid_r()) << 5;
r23522r23523
10701106};
10711107
10721108
1073
10741109//-------------------------------------------------
10751110//  VICTOR9K_KEYBOARD_INTERFACE( kb_intf )
10761111//-------------------------------------------------
r23522r23523
10821117   m_pic->ir6_w(state ? CLEAR_LINE : ASSERT_LINE);
10831118}
10841119
1085static VICTOR9K_KEYBOARD_INTERFACE( kb_intf )
1086{
1087   DEVCB_DRIVER_LINE_MEMBER(victor9k_state, kbrdy_w)
1088};
10891120
1090
10911121//-------------------------------------------------
10921122//  SLOT_INTERFACE( victor9k_floppies )
10931123//-------------------------------------------------
10941124
1125void victor9k_state::ready0_cb(floppy_image_device *device, int state)
1126{
1127   m_rdy0 = state;
1128
1129   m_via5->write_ca2(m_rdy0);
1130}
1131
1132int victor9k_state::load0_cb(floppy_image_device *device)
1133{
1134   m_ds0 = 0;
1135
1136   m_via4->write_ca1(m_ds0);
1137
1138   return IMAGE_INIT_PASS;
1139}
1140
1141void victor9k_state::unload0_cb(floppy_image_device *device)
1142{
1143   m_ds0 = 1;
1144
1145   m_via4->write_ca1(m_ds0);
1146}
1147
1148void victor9k_state::ready1_cb(floppy_image_device *device, int state)
1149{
1150   m_rdy1 = state;
1151   
1152   m_via5->write_cb2(m_rdy1);
1153}
1154
1155int victor9k_state::load1_cb(floppy_image_device *device)
1156{
1157   m_ds1 = 0;
1158
1159   m_via4->write_cb1(m_ds1);
1160
1161   return IMAGE_INIT_PASS;
1162}
1163
1164void victor9k_state::unload1_cb(floppy_image_device *device)
1165{
1166   m_ds1 = 1;
1167
1168   m_via4->write_cb1(m_ds1);
1169}
1170
10951171static SLOT_INTERFACE_START( victor9k_floppies )
10961172   SLOT_INTERFACE( "525qd", FLOPPY_525_QD )
10971173SLOT_INTERFACE_END
r23522r23523
11391215   // set interrupt callback
11401216   m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(victor9k_state::victor9k_irq_callback),this));
11411217
1218   // set floppy callbacks
1219   m_floppy0->setup_ready_cb(floppy_image_device::ready_cb(FUNC(victor9k_state::ready0_cb), this));
1220   m_floppy0->setup_load_cb(floppy_image_device::load_cb(FUNC(victor9k_state::load0_cb), this));
1221   m_floppy0->setup_unload_cb(floppy_image_device::unload_cb(FUNC(victor9k_state::unload0_cb), this));
1222   m_floppy1->setup_ready_cb(floppy_image_device::ready_cb(FUNC(victor9k_state::ready1_cb), this));
1223   m_floppy1->setup_load_cb(floppy_image_device::load_cb(FUNC(victor9k_state::load1_cb), this));
1224   m_floppy1->setup_unload_cb(floppy_image_device::unload_cb(FUNC(victor9k_state::unload1_cb), this));
1225
11421226   // memory banking
11431227   address_space &program = m_maincpu->space(AS_PROGRAM);
11441228   program.install_ram(0x00000, m_ram->size() - 1, m_ram->pointer());
11451229}
11461230
11471231
1232
11481233//**************************************************************************
11491234//  MACHINE CONFIGURATION
11501235//**************************************************************************
r23522r23523
11971282   MCFG_FLOPPY_DRIVE_ADD(I8048_TAG":1", victor9k_floppies, "525qd", floppy_image_device::default_floppy_formats)
11981283   MCFG_RS232_PORT_ADD(RS232_A_TAG, rs232a_intf, default_rs232_devices, NULL)
11991284   MCFG_RS232_PORT_ADD(RS232_B_TAG, rs232b_intf, default_rs232_devices, NULL)
1200   MCFG_VICTOR9K_KEYBOARD_ADD(kb_intf)
1285   MCFG_VICTOR9K_KEYBOARD_ADD(WRITELINE(victor9k_state, kbrdy_w))
12011286
12021287   // internal ram
12031288   MCFG_RAM_ADD(RAM_TAG)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team