Previous 199869 Revisions Next

r20153 Wednesday 9th January, 2013 at 17:56:14 UTC by Curt Coder
(MESS) bw12, xerox820, wangpc: Fixed floppy. [Curt Coder]
[src/emu/machine]upd765.c z80dart.c
[src/lib/formats]upd765_dsk.c
[src/mess/drivers]bw12.c wangpc.c xerox820.c
[src/mess/includes]bw12.h wangpc.h xerox820.h

trunk/src/emu/machine/z80dart.c
r20152r20153
639639   // disable transmitter
640640   m_wr[5] &= ~WR5_TX_ENABLE;
641641   m_tx_state = STATE_START;
642   m_rr[0] |= RR0_TX_BUFFER_EMPTY;
642643
643644   // reset external lines
644645   RTS(1);
trunk/src/emu/machine/upd765.c
r20152r20153
387387         main_phase = PHASE_RESULT;
388388         result[0] = ST0_UNK;
389389         result_pos = 1;
390         command_pos = 0;
390391         return;
391392      }
392393      start_command(cmd);
trunk/src/lib/formats/upd765_dsk.c
r20152r20153
108108
109109floppy_image_format_t::desc_e* upd765_format::get_desc_fm(const format &f, int &current_size, int &end_gap_index)
110110{
111   static floppy_image_format_t::desc_e desc[29] = {
111   static floppy_image_format_t::desc_e desc[26] = {
112112      /* 00 */ { FM, 0xff, f.gap_4a },
113113      /* 01 */ { FM, 0x00, 6 },
114114      /* 02 */ { RAW, 0xf77a, 1 },
trunk/src/mess/includes/bw12.h
r20152r20153
4444        m_crtc(*this, MC6845_TAG),
4545        m_centronics(*this, CENTRONICS_TAG),
4646        m_ram(*this, RAM_TAG),
47        m_floppy0(*this, UPD765_TAG ":0:525dd"),
48        m_floppy1(*this, UPD765_TAG ":1:525dd"),
47        m_floppy0(*this, UPD765_TAG ":1:525dd"),
48        m_floppy1(*this, UPD765_TAG ":2:525dd"),
4949        m_floppy_timer(*this, FLOPPY_TIMER_TAG),
5050        m_video_ram(*this, "video_ram")
5151   { }
trunk/src/mess/includes/wangpc.h
r20152r20153
1010#include "machine/ctronics.h"
1111#include "machine/i8255.h"
1212#include "machine/im6402.h"
13#include "machine/pic8259.h"
13#include "machine/mc2661.h"
1414#include "machine/pit8253.h"
15#include "machine/pic8259.h"
1516#include "machine/ram.h"
16#include "machine/mc2661.h"
1717#include "machine/upd765.h"
1818#include "machine/wangpcbus.h"
1919#include "machine/wangpckb.h"
r20152r20153
7171        m_fdc_dd0(0),
7272        m_fdc_dd1(0),
7373        m_fdc_tc(0),
74        m_ds1(1),
75        m_ds2(1)
74        m_ds1(false),
75        m_ds2(false)
7676   { }
7777
7878   required_device<cpu_device> m_maincpu;
r20152r20153
9393   virtual void machine_start();
9494   virtual void machine_reset();
9595
96   void select_drive(int drive, bool select);
97   void set_motor(int drive, bool motor);
98   void fdc_reset();
99   void fdc_tc();
96   void select_drive();
10097   void check_level1_interrupts();
10198   void check_level2_interrupts();
10299   void update_fdc_drq();
r20152r20153
165162   DECLARE_WRITE_LINE_MEMBER( busy_w );
166163   DECLARE_WRITE_LINE_MEMBER( bus_irq2_w );
167164
165   DECLARE_FLOPPY_FORMATS( floppy_formats );
166
168167   void fdc_irq(bool state);
169168   void fdc_drq(bool state);
170169
r20152r20153
195194   int m_ds1;
196195   int m_ds2;
197196
198   int m_led[6]; // HACK until keyboard works
197   int m_led[6];
199198};
200199
201200
trunk/src/mess/includes/xerox820.h
r20152r20153
4747        m_ram(*this, RAM_TAG),
4848        m_floppy0(*this, FD1771_TAG":0"),
4949        m_floppy1(*this, FD1771_TAG":1"),
50        m_video_ram(*this, "video_ram")
50        m_video_ram(*this, "video_ram"),
51        m_fdc_irq(0),
52        m_fdc_drq(0),
53        m_8n5(0),
54        m_400_460(0)
5155   { }
5256
5357   virtual void machine_start();
r20152r20153
6468   required_device<floppy_connector> m_floppy0;
6569   required_device<floppy_connector> m_floppy1;
6670
71   DECLARE_READ8_MEMBER( fdc_r );
72   DECLARE_WRITE8_MEMBER( fdc_w );
6773   DECLARE_WRITE8_MEMBER( scroll_w );
6874   //DECLARE_WRITE8_MEMBER( x120_system_w );
6975   DECLARE_READ8_MEMBER( kbpio_pa_r );
r20152r20153
7480
7581   void scan_keyboard();
7682   void bankswitch(int bank);
83   void update_nmi();
7784   void fdc_intrq_w(bool state);
7885   void fdc_drq_w(bool state);
7986
trunk/src/mess/drivers/bw12.c
r20152r20153
2929
3030    TODO:
3131
32   - floppy is broken
3332    - floppy motor off timer
3433
3534*/
r20152r20153
126125
127126   case 5: /* MOTOR 0 */
128127      m_motor0 = data;
129
130      if (data)
131      {
132         m_floppy0->mon_w(0);
133      }
134
135      set_floppy_motor_off_timer();
136128      break;
137129
138130   case 6: /* MOTOR 1 */
139131      m_motor1 = data;
140
141      if (data)
142      {
143         m_floppy1->mon_w(0);
144      }
145
146      set_floppy_motor_off_timer();
147132      break;
148133
149134   case 7: /* FDC TC */
150135      m_fdc->tc_w(data);
151136      break;
152137   }
138
139   m_motor_on = m_motor0 || m_motor1;
140
141   m_floppy0->mon_w(!m_motor_on);
142   m_floppy1->mon_w(!m_motor_on);
153143}
154144
155145WRITE8_MEMBER( bw12_state::ls259_w )
r20152r20153
664654
665655   /* devices */
666656   MCFG_TIMER_DRIVER_ADD(FLOPPY_TIMER_TAG, bw12_state, floppy_motor_off_tick)
667   MCFG_UPD765A_ADD(UPD765_TAG, true, true)
657   MCFG_UPD765A_ADD(UPD765_TAG, false, true)
668658   MCFG_PIA6821_ADD(PIA6821_TAG, pia_intf)
669659   MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_16MHz/4, sio_intf)
670660   MCFG_PIT8253_ADD(PIT8253_TAG, pit_intf)
r20152r20153
676666
677667static MACHINE_CONFIG_DERIVED( bw12, common )
678668   /* floppy drives */
679   MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", bw12_floppies, "525dd", 0, bw12_state::bw12_floppy_formats)
680669   MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", bw12_floppies, "525dd", 0, bw12_state::bw12_floppy_formats)
670   MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":2", bw12_floppies, "525dd", 0, bw12_state::bw12_floppy_formats)
681671
682672   // software lists
683673   MCFG_SOFTWARE_LIST_ADD("flop_list", "bw12")
r20152r20153
689679
690680static MACHINE_CONFIG_DERIVED( bw14, common )
691681   /* floppy drives */
692   MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", bw14_floppies, "525dd", 0, bw12_state::bw14_floppy_formats)
693682   MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", bw14_floppies, "525dd", 0, bw12_state::bw14_floppy_formats)
683   MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":2", bw14_floppies, "525dd", 0, bw12_state::bw14_floppy_formats)
694684
695685   /* internal ram */
696686   MCFG_RAM_ADD(RAM_TAG)
r20152r20153
712702/* System Drivers */
713703
714704/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    COMPANY               FULLNAME        FLAGS */
715COMP( 1984,   bw12,   0,      0,      bw12,   bw12, driver_device,   0,      "Bondwell Holding",   "Bondwell 12",   GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
716COMP( 1984,   bw14,   bw12,   0,      bw14,   bw12, driver_device,   0,      "Bondwell Holding",   "Bondwell 14",   GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
705COMP( 1984,   bw12,   0,      0,      bw12,   bw12, driver_device,   0,      "Bondwell Holding",   "Bondwell 12",   GAME_SUPPORTS_SAVE )
706COMP( 1984,   bw14,   bw12,   0,      bw14,   bw12, driver_device,   0,      "Bondwell Holding",   "Bondwell 14",   GAME_SUPPORTS_SAVE )
trunk/src/mess/drivers/xerox820.c
r20152r20153
170170   }
171171}
172172
173READ8_MEMBER( xerox820_state::fdc_r )
174{
175   return m_fdc->gen_r(offset) ^ 0xff;
176}
177
178WRITE8_MEMBER( xerox820_state::fdc_w )
179{
180   m_fdc->gen_w(offset, data ^ 0xff);
181}
182
173183WRITE8_MEMBER( xerox820_state::scroll_w )
174184{
175185   m_scroll = (offset >> 8) & 0x1f;
r20152r20153
241251   AM_RANGE(0x05, 0x05) AM_MIRROR(0xff02) AM_DEVREADWRITE_LEGACY(Z80SIO_TAG, z80dart_c_r, z80dart_c_w)
242252   AM_RANGE(0x08, 0x0b) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80PIO_GP_TAG, z80pio_device, read_alt, write_alt)
243253   AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff03) AM_DEVWRITE(COM8116_TAG, com8116_device, stt_w)
244   AM_RANGE(0x10, 0x13) AM_MIRROR(0xff00) AM_DEVREADWRITE(FD1771_TAG, wd_fdc_t, read, write)
254   AM_RANGE(0x10, 0x13) AM_MIRROR(0xff00) AM_READWRITE(fdc_r, fdc_w)
245255   AM_RANGE(0x14, 0x14) AM_MIRROR(0xff03) AM_MASK(0xff00) AM_WRITE(scroll_w)
246256   AM_RANGE(0x18, 0x1b) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_device, read, write)
247257   AM_RANGE(0x1c, 0x1f) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80PIO_KB_TAG, z80pio_device, read_alt, write_alt)
r20152r20153
652662   SLOT_INTERFACE( "sa850", FLOPPY_8_DSDD ) // Shugart SA-850
653663SLOT_INTERFACE_END
654664
665void xerox820_state::update_nmi()
666{
667   int halt = m_maincpu->state_int(Z80_HALT);
668   int state = (halt && (m_fdc_irq || m_fdc_drq)) ? ASSERT_LINE : CLEAR_LINE;
669
670   m_maincpu->set_input_line(INPUT_LINE_NMI, state);
671}
672
655673void xerox820_state::fdc_intrq_w(bool state)
656674{
657675   m_fdc_irq = state;
658676
659   int halt = m_maincpu->state_int(Z80_HALT);
660
661   if (halt && (m_fdc_irq || m_fdc_drq))
662      m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
663   else
664      m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
677   update_nmi();
665678}
666679
667680void xerox820_state::fdc_drq_w(bool state)
668681{
669682   m_fdc_drq = state;
670683
671   int halt = m_maincpu->state_int(Z80_HALT);
672
673   if (halt && (m_fdc_irq || m_fdc_drq))
674      m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
675   else
676      m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
684   update_nmi();
677685}
678686
679687/* COM8116 Interface */
r20152r20153
749757   // floppy callbacks
750758   m_fdc->setup_intrq_cb(wd_fdc_t::line_cb(FUNC(xerox820_state::fdc_intrq_w), this));
751759   m_fdc->setup_drq_cb(wd_fdc_t::line_cb(FUNC(xerox820_state::fdc_drq_w), this));
752   m_fdc->dden_w(1);
753760
754761   // state saving
755762   save_item(NAME(m_keydata));
trunk/src/mess/drivers/wangpc.c
r20152r20153
1212
1313    TODO:
1414
15   - with quantum perfect cpu gets stuck @ 49c3 mov ss,cs:[52ah]
1516    - hard disk
1617
1718*/
r20152r20153
3334
3435
3536//**************************************************************************
36//  DIRECT MEMORY ACCESS
37//  IMPLEMENTATION
3738//**************************************************************************
3839
39void wangpc_state::select_drive(int drive, bool select)
40void wangpc_state::select_drive()
4041{
41   if (LOG) logerror("%s: %sselect drive %u\n", machine().describe_context(), select ? "" : "De", drive + 1);
42   floppy_image_device *floppy = NULL;
4243
43   int state = select ? 0 : 1;
44   if (m_ds1) floppy = m_floppy0;
45   if (m_ds2) floppy = m_floppy1;
4446
45   if (!drive)
46   {
47      m_ds1 = state;
48      if(state)
49         m_fdc->set_floppy(m_floppy0);
50   }
51   else
52   {
53      m_ds2 = state;
54      if(state)
55         m_fdc->set_floppy(m_floppy1);
56   }
57   if(!m_ds1 && !m_ds2)
58      m_fdc->set_floppy(NULL);
47   m_fdc->set_floppy(floppy);
5948}
6049
61void wangpc_state::set_motor(int drive, bool motor)
62{
63   if (LOG) logerror("%s: Motor %u %s\n", machine().describe_context(), drive + 1, motor ? "on" : "off");
64
65   int state = motor ? 0 : 1;
66
67   if (!drive)
68   {
69      m_floppy0->mon_w(state);
70   }
71   else
72   {
73      m_floppy1->mon_w(state);
74   }
75}
76
77void wangpc_state::fdc_reset()
78{
79    if (LOG) logerror("%s: FDC reset\n", machine().describe_context());
80
81   m_fdc->reset();
82}
83
84void wangpc_state::fdc_tc()
85{
86    if (LOG) logerror("%s: FDC TC\n", machine().describe_context());
87
88   m_fdc->tc_w(true);
89   m_fdc->tc_w(false);
90}
91
9250WRITE8_MEMBER( wangpc_state::fdc_ctrl_w )
9351{
9452   /*
r20152r20153
12583
12684READ8_MEMBER( wangpc_state::deselect_drive1_r )
12785{
128   select_drive(0, false);
86   m_ds1 = false;
87   select_drive();
12988
13089   return 0xff;
13190}
13291
133
13492WRITE8_MEMBER( wangpc_state::deselect_drive1_w )
13593{
136   select_drive(0, false);
94   deselect_drive1_r(space, offset);
13795}
13896
139
14097READ8_MEMBER( wangpc_state::select_drive1_r )
14198{
142   select_drive(0, true);
99   m_ds1 = true;
100   select_drive();
143101
144102   return 0xff;
145103}
146104
147
148105WRITE8_MEMBER( wangpc_state::select_drive1_w )
149106{
150   select_drive(0, true);
107   select_drive1_r(space, offset);
151108}
152109
153
154110READ8_MEMBER( wangpc_state::deselect_drive2_r )
155111{
156   select_drive(1, false);
112   m_ds2 = false;
113   select_drive();
157114
158115   return 0xff;
159116}
160117
161
162118WRITE8_MEMBER( wangpc_state::deselect_drive2_w )
163119{
164   select_drive(1, false);
120   deselect_drive2_r(space, offset);
165121}
166122
167
168123READ8_MEMBER( wangpc_state::select_drive2_r )
169124{
170   select_drive(1, true);
125   m_ds2 = true;
126   select_drive();
171127
172128   return 0xff;
173129}
174130
175
176131WRITE8_MEMBER( wangpc_state::select_drive2_w )
177132{
178   select_drive(1, true);
133   select_drive2_r(space, offset);
179134}
180135
181
182136READ8_MEMBER( wangpc_state::motor1_off_r )
183137{
184   set_motor(0, false);
138   if (LOG) logerror("%s: Drive 1 motor OFF\n", machine().describe_context());
185139
140   m_floppy0->mon_w(1);
141
186142   return 0xff;
187143}
188144
189
190145WRITE8_MEMBER( wangpc_state::motor1_off_w )
191146{
192   set_motor(0, false);
147   motor1_off_r(space, offset);
193148}
194149
195
196150READ8_MEMBER( wangpc_state::motor1_on_r )
197151{
198   set_motor(0, true);
152   if (LOG) logerror("%s: Drive 1 motor ON\n", machine().describe_context());
199153
154   m_floppy0->mon_w(0);
155
200156   return 0xff;
201157}
202158
203
204159WRITE8_MEMBER( wangpc_state::motor1_on_w )
205160{
206   set_motor(0, true);
161   motor1_on_r(space, offset);
207162}
208163
209
210164READ8_MEMBER( wangpc_state::motor2_off_r )
211165{
212   set_motor(1, false);
166   if (LOG) logerror("%s: Drive 2 motor OFF\n", machine().describe_context());
213167
168   m_floppy1->mon_w(1);
169
214170   return 0xff;
215171}
216172
217
218173WRITE8_MEMBER( wangpc_state::motor2_off_w )
219174{
220   set_motor(1, false);
175   motor2_off_r(space, offset);
221176}
222177
223
224178READ8_MEMBER( wangpc_state::motor2_on_r )
225179{
226   set_motor(1, true);
180   if (LOG) logerror("%s: Drive 2 motor ON\n", machine().describe_context());
227181
182   m_floppy1->mon_w(0);
183
228184   return 0xff;
229185}
230186
231
232187WRITE8_MEMBER( wangpc_state::motor2_on_w )
233188{
234   set_motor(1, true);
189   motor2_on_r(space, offset);
235190}
236191
237
238192READ8_MEMBER( wangpc_state::fdc_reset_r )
239193{
240   fdc_reset();
194    if (LOG) logerror("%s: FDC reset\n", machine().describe_context());
241195
196   m_fdc->reset();
197
242198   return 0xff;
243199}
244200
245
246201WRITE8_MEMBER( wangpc_state::fdc_reset_w )
247202{
248   fdc_reset();
203   fdc_reset_r(space, offset);
249204}
250205
251
252206READ8_MEMBER( wangpc_state::fdc_tc_r )
253207{
254   fdc_tc();
208    if (LOG) logerror("%s: FDC TC\n", machine().describe_context());
255209
210   m_fdc->tc_w(1);
211   m_fdc->tc_w(0);
212
256213   return 0xff;
257214}
258215
259
260216WRITE8_MEMBER( wangpc_state::fdc_tc_w )
261217{
262   fdc_tc();
218   fdc_tc_r(space, offset);
263219}
264220
265221
266
267222//-------------------------------------------------
268223//  dma_page_w -
269224//-------------------------------------------------
r20152r20153
559514   UINT8 data = 0;
560515
561516   // FDC interrupt
562   data |= (m_fdc_dd0 | m_fdc_dd1 | (int) m_fdc->get_irq()) << 7;
517   data |= (m_fdc_dd0 || m_fdc_dd1 || (int) m_fdc->get_irq()) << 7;
563518
564519   return data;
565520}
r20152r20153
668623   if (m_enable_eop)
669624      m_fdc->tc_w(m_fdc_tc);
670625   else
671      m_fdc->tc_w(false);
626      m_fdc->tc_w(0);
672627}
673628
674629WRITE_LINE_MEMBER( wangpc_state::hrq_w )
r20152r20153
682637{
683638   if (m_dack == 2)
684639   {
685      m_fdc_tc = !state;
640      m_fdc_tc = state;
686641      update_fdc_tc();
687642   }
688643
689   if (!state)
644   if (state)
690645   {
691646      if (LOG) logerror("EOP set\n");
692647
r20152r20153
1035990   SLOT_INTERFACE( "525dd", FLOPPY_525_DD )
1036991SLOT_INTERFACE_END
1037992
993FLOPPY_FORMATS_MEMBER( wangpc_state::floppy_formats )
994   FLOPPY_PC_FORMAT
995FLOPPY_FORMATS_END
996
1038997void wangpc_state::fdc_irq(bool state)
1039998{
1040999    if (LOG) logerror("FDC INT %u\n", state);
r20152r20153
12421201   MCFG_CPU_ADD(I8086_TAG, I8086, 8000000)
12431202   MCFG_CPU_PROGRAM_MAP(wangpc_mem)
12441203   MCFG_CPU_IO_MAP(wangpc_io)
1204   //MCFG_QUANTUM_PERFECT_CPU(I8086_TAG)
12451205
12461206   // devices
12471207   MCFG_AM9517A_ADD(AM9517A_TAG, 4000000, dmac_intf)
r20152r20153
12511211   MCFG_IM6402_ADD(IM6402_TAG, uart_intf)
12521212   MCFG_MC2661_ADD(SCN2661_TAG, 0, epci_intf)
12531213   MCFG_UPD765A_ADD(UPD765_TAG, false, false)
1254   MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", wangpc_floppies, "525dd", 0, floppy_image_device::default_floppy_formats)
1255   MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", wangpc_floppies, "525dd", 0, floppy_image_device::default_floppy_formats)
1214   MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", wangpc_floppies, "525dd", 0, wangpc_state::floppy_formats)
1215   MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", wangpc_floppies, "525dd", 0, wangpc_state::floppy_formats)
12561216   MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, centronics_intf)
12571217   MCFG_WANGPC_KEYBOARD_ADD()
12581218

Previous 199869 Revisions Next


© 1997-2024 The MAME Team