Previous 199869 Revisions Next

r19965 Monday 31st December, 2012 at 02:12:38 UTC by Carl
[mess] pc.c:convert mc1502 to use wd_fdc (nw)
will boot but changing disks doesn't currently work
[src/mess/drivers]pc.c
[src/mess/includes]pc.h
[src/mess/machine]pc.c

trunk/src/mess/includes/pc.h
r19964r19965
145145   void fdc_dma_drq(bool state);
146146   void pc_select_dma_channel(int channel, bool state);
147147   void pc_eop_w(int channel, bool state);
148   void mc1502_fdc_irq_drq(bool state);
148149   DECLARE_FLOPPY_FORMATS( floppy_formats );
149150};
150151
trunk/src/mess/drivers/pc.c
r19964r19965
9797#include "machine/am9517a.h"
9898#include "sound/sn76496.h"
9999
100#include "machine/wd17xx.h"
100#include "machine/wd_fdc.h"
101101#include "machine/kb_7007_3.h"
102102
103103#include "machine/ram.h"
r19964r19965
161161   AM_RANGE(0x0100, 0x0100) AM_READWRITE(mc1502_wd17xx_aux_r, mc1502_wd17xx_aux_w)
162162   AM_RANGE(0x0108, 0x0108) AM_READ(mc1502_wd17xx_drq_r)         // blocking read!
163163   AM_RANGE(0x010a, 0x010a) AM_READ(mc1502_wd17xx_motor_r)
164   AM_RANGE(0x010c, 0x010c) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_status_r, wd17xx_command_w)
165   AM_RANGE(0x010d, 0x010d) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_track_r, wd17xx_track_w)
166   AM_RANGE(0x010e, 0x010e) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_sector_r, wd17xx_sector_w)
167   AM_RANGE(0x010f, 0x010f) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_data_r, wd17xx_data_w)
164   AM_RANGE(0x010c, 0x010f) AM_DEVREADWRITE("vg93", fd1793_t, read, write)
168165ADDRESS_MAP_END
169166
170167static ADDRESS_MAP_START( zenith_map, AS_PROGRAM, 8, pc_state )
r19964r19965
867864   DEVCB_CPU_INPUT_LINE("maincpu", 0)
868865};
869866
870static const floppy_interface mc1502_floppy_interface =
871{
872   DEVCB_NULL,
873   DEVCB_NULL,
874   DEVCB_NULL,
875   DEVCB_NULL,
876   DEVCB_NULL,
877   FLOPPY_STANDARD_5_25_DSHD,
878   LEGACY_FLOPPY_OPTIONS_NAME(pc),
879   "floppy_5_25",
880   NULL
881};
882
883867FLOPPY_FORMATS_MEMBER( pc_state::floppy_formats )
884868   FLOPPY_PC_FORMAT
885869FLOPPY_FORMATS_END
r19964r19965
13981382   /* cassette */
13991383   MCFG_CASSETTE_ADD( CASSETTE_TAG, mc1502_cassette_interface )   // has no motor control
14001384
1401   MCFG_FD1793_ADD( "vg93", default_wd17xx_interface_2_drives )
1402   MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(mc1502_floppy_interface)
1385   MCFG_FD1793x_ADD("vg93", XTAL_8MHz / 8) // clock?
1386   MCFG_FLOPPY_DRIVE_ADD("fd0", ibmpc_floppies, "525dd", 0, pc_state::floppy_formats)
1387   MCFG_FLOPPY_DRIVE_ADD("fd1", ibmpc_floppies, "525dd", 0, pc_state::floppy_formats)
14031388
14041389   /* internal ram */
14051390   MCFG_RAM_ADD(RAM_TAG)
trunk/src/mess/machine/pc.c
r19964r19965
3737#include "sound/speaker.h"
3838
3939#include "machine/am9517a.h"
40#include "machine/wd17xx.h"
40#include "machine/wd_fdc.h"
4141
4242#include "machine/ram.h"
4343
r19964r19965
12801280
12811281WRITE8_MEMBER(pc_state::mc1502_wd17xx_aux_w)
12821282{
1283   fd1793_t *fdc = machine().device<fd1793_t>("vg93");
1284   floppy_image_device *floppy0 = machine().device<floppy_connector>("fd0")->get_device();
1285   floppy_image_device *floppy1 = machine().device<floppy_connector>("fd1")->get_device();
1286   floppy_image_device *floppy = ((data & 0x10)?floppy1:floppy0);
1287   fdc->set_floppy(floppy);
1288
12831289   // master reset
1284   wd17xx_mr_w(machine().device("vg93"), BIT(data, 0));
1290   if(data & 1)
1291      fdc->reset();
12851292
12861293   // SIDE ONE
1287   wd17xx_set_side(machine().device("vg93"), BIT(data, 1));
1294   floppy->ss_w((data & 2)?1:0);
12881295
12891296   // bits 2, 3 -- motor on (drive 0, 1)
1290
1291   // DRIVE SEL
1292   wd17xx_set_drive(machine().device("vg93"), BIT(data, 4));
1297   floppy0->mon_w(!(data & 4));
1298   floppy1->mon_w(!(data & 8));
12931299}
12941300
12951301/*
r19964r19965
12971303 */
12981304READ8_MEMBER(pc_state::mc1502_wd17xx_drq_r)
12991305{
1300   UINT8 data;
1301   UINT64 newpc;
1306   fd1793_t *fdc = machine().device<fd1793_t>("vg93");
13021307
1303   data = wd17xx_drq_r(machine().device("vg93"));
1304   if (!data && !wd17xx_intrq_r(machine().device("vg93"))) {
1305      /* fake cpu halt by resetting PC one insn back */
1306      newpc = machine().firstcpu->pc();
1307      machine().firstcpu->set_pc( newpc - 1 );
1308   if (!fdc->drq_r() && !fdc->intrq_r()) {
1309      /* fake cpu wait by resetting PC one insn back */
1310      m_maincpu->set_pc(m_maincpu->pc() - 1);
1311      m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
13081312   }
13091313
1310   return data;
1314   return fdc->drq_r();
13111315}
13121316
1317void pc_state::mc1502_fdc_irq_drq(bool state)
1318{
1319   if(state)
1320      m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
1321}
1322
13131323READ8_MEMBER(pc_state::mc1502_wd17xx_motor_r)
13141324{
13151325   UINT8 data;
r19964r19965
15161526   memset(&mc1502_keyb, 0, sizeof(mc1502_keyb));
15171527   mc1502_keyb.keyb_signal_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::mc1502_keyb_signal_callback),this));
15181528   mc1502_keyb.keyb_signal_timer->adjust( attotime::from_msec(20), 0, attotime::from_msec(20) );
1529
1530   fd1793_t *fdc = machine().device<fd1793_t>("vg93");
1531   fdc->setup_drq_cb(fd1793_t::line_cb(FUNC(pc_state::mc1502_fdc_irq_drq), this));
1532   fdc->setup_intrq_cb(fd1793_t::line_cb(FUNC(pc_state::mc1502_fdc_irq_drq), this));
15191533}
15201534
15211535

Previous 199869 Revisions Next


© 1997-2024 The MAME Team