(MESS) super80 : starting to add fdc support

This commit is contained in:
Robbbert 2014-04-26 08:08:12 +00:00
parent cf3d95315f
commit 473f022573
4 changed files with 186 additions and 71 deletions

View File

@ -1,6 +1,6 @@
// license:MAME
// copyright-holders:Robbbert
/*
/*****************************************************************************
Super80.c written by Robbbert, 2005-2010.
@ -181,6 +181,32 @@ points to the ROMs. When a machine reset occurs, bank 1 is switched in. A timer
after 4 bytes are read, bank 0 is selected. The timer is as close as can be to real operation of the
hardware.
Super80 disk WD2793, Z80DMA:
Port(hex) Role Comment
--------- ----- --------
30 DMA I/O Z80A DMA Controller Command Register
38 WDSTCM WD2793 Command Status
39 WDTRK WD2793 Track Register
3A WDSEC WD2793 Sector Register
3B WDDATA WD2793 Data Register
3E UFDSTAT FDD and WD2793 Status input
Bit0 INTRQ 1 = WD2793 Interrupt Request
Bit1 DATARQ 1 = Data Ready to Receive or Send
Bit2 MOTOR ON 1 = FDD Motor On
3F UFDCOM WD2793 Command Register output
Bit0 5/8 1 = 8" Drive Selected
Bit1 ENMF* 0 = 1MHz, 1 = 2MHz (for 8" double density)
Bit2 DR0SEL 1 = Drive 0 (Drive A) selected
Bit3 DR1SEL 1 = Drive 1 (Drive B) selected
Bit4 DR2SEL 1 = Drive 2 (Drive C) selected
Bit5 DR3SEL 1 = Drive 3 (Drive D) selected
Bit6 SIDESEL 0 = Select Disk side 0, 1 = Select Disk side 1
Bit7 DDEN* 0 = MFM (Double Density), 1 = FM (Single Density)
***********************************************************************************************************/
#include "super80.lh"
@ -256,6 +282,10 @@ static ADDRESS_MAP_START( super80r_io, AS_IO, 8, super80_state )
AM_RANGE(0x10, 0x10) AM_WRITE(super80v_10_w)
AM_RANGE(0x11, 0x11) AM_DEVREAD("crtc", mc6845_device, register_r)
AM_RANGE(0x11, 0x11) AM_WRITE(super80v_11_w)
AM_RANGE(0x30, 0x30) AM_DEVREADWRITE("dma", z80dma_device, read, write)
AM_RANGE(0x38, 0x3b) AM_DEVREADWRITE("fdc", wd2793_t, read, write)
AM_RANGE(0x3e, 0x3e) AM_READ(port3e_r)
AM_RANGE(0x3f, 0x3f) AM_WRITE(port3f_w)
AM_RANGE(0xdc, 0xdc) AM_DEVREAD("cent_status_in", input_buffer_device, read)
AM_RANGE(0xdc, 0xdc) AM_WRITE(super80_dc_w)
AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x14) AM_WRITE(super80r_f0_w)
@ -634,6 +664,59 @@ static MC6845_INTERFACE( super80v_crtc )
NULL
};
//-------------------------------------------------
// Z80DMA_INTERFACE( dma_intf )
//-------------------------------------------------
WRITE_LINE_MEMBER( super80_state::busreq_w )
{
// since our Z80 has no support for BUSACK, we assume it is granted immediately
m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state);
m_maincpu->set_input_line(INPUT_LINE_HALT, state); // do we need this?
m_dma->bai_w(state); // tell dma that bus has been granted
}
READ8_MEMBER(super80_state::memory_read_byte)
{
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
return prog_space.read_byte(offset);
}
WRITE8_MEMBER(super80_state::memory_write_byte)
{
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
prog_space.write_byte(offset, data);
}
READ8_MEMBER(super80_state::io_read_byte)
{
address_space& prog_space = m_maincpu->space(AS_IO);
return prog_space.read_byte(offset);
}
WRITE8_MEMBER(super80_state::io_write_byte)
{
address_space& prog_space = m_maincpu->space(AS_IO);
prog_space.write_byte(offset, data);
}
// busack on cpu connects to bai pin
static Z80DMA_INTERFACE( dma_intf )
{
//DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_HALT), //busreq - connects to busreq on cpu
DEVCB_DRIVER_LINE_MEMBER(super80_state, busreq_w), //busreq - connects to busreq on cpu
DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0), //int/pulse - connects to IRQ0 on cpu
DEVCB_NULL, //ba0 - not connected
DEVCB_DRIVER_MEMBER(super80_state, memory_read_byte),
DEVCB_DRIVER_MEMBER(super80_state, memory_write_byte),
DEVCB_DRIVER_MEMBER(super80_state, io_read_byte),
DEVCB_DRIVER_MEMBER(super80_state, io_write_byte),
};
static SLOT_INTERFACE_START( super80_floppies )
SLOT_INTERFACE( "525dd", FLOPPY_525_DD )
SLOT_INTERFACE_END
static MACHINE_CONFIG_START( super80, super80_state )
/* basic machine hardware */
@ -757,6 +840,10 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( super80r, super80v )
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_IO_MAP(super80r_io)
MCFG_Z80DMA_ADD("dma", MASTER_CLOCK/6, dma_intf)
MCFG_WD2793x_ADD("fdc", XTAL_2MHz)
MCFG_FLOPPY_DRIVE_ADD("fdc:0", super80_floppies, "525dd", floppy_image_device::default_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("fdc:1", super80_floppies, "525dd", floppy_image_device::default_floppy_formats)
MACHINE_CONFIG_END
/**************************** ROMS *****************************************************************/

View File

@ -10,6 +10,9 @@
#include "bus/centronics/ctronics.h"
#include "video/mc6845.h"
#include "machine/z80pio.h"
#include "machine/z80dma.h"
#include "machine/wd_fdc.h"
/* Bits in shared variable:
d5 cassette LED
@ -23,71 +26,60 @@ class super80_state : public driver_device
{
public:
super80_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_pio(*this, "z80pio"),
m_cassette(*this, "cassette"),
m_wave(*this, WAVE_TAG),
m_speaker(*this, "speaker"),
m_centronics(*this, "centronics"),
m_cent_data_out(*this, "cent_data_out"),
m_6845(*this, "crtc"),
m_io_dsw(*this, "DSW"),
m_io_x0(*this, "X0"),
m_io_x1(*this, "X1"),
m_io_x2(*this, "X2"),
m_io_x3(*this, "X3"),
m_io_x4(*this, "X4"),
m_io_x5(*this, "X5"),
m_io_x6(*this, "X6"),
m_io_x7(*this, "X7"),
m_io_config(*this, "CONFIG"),
m_palette(*this, "palette")
: driver_device(mconfig, type, tag)
, m_palette(*this, "palette")
, m_maincpu(*this, "maincpu")
, m_pio(*this, "z80pio")
, m_dma(*this, "dma")
, m_cassette(*this, "cassette")
, m_wave(*this, WAVE_TAG)
, m_speaker(*this, "speaker")
, m_centronics(*this, "centronics")
, m_cent_data_out(*this, "cent_data_out")
, m_crtc(*this, "crtc")
, m_io_dsw(*this, "DSW")
, m_io_x0(*this, "X0")
, m_io_x1(*this, "X1")
, m_io_x2(*this, "X2")
, m_io_x3(*this, "X3")
, m_io_x4(*this, "X4")
, m_io_x5(*this, "X5")
, m_io_x6(*this, "X6")
, m_io_x7(*this, "X7")
, m_io_config(*this, "CONFIG")
, m_fdc (*this, "fdc")
, m_floppy0(*this, "fdc:0")
, m_floppy1(*this, "fdc:1")
{ }
DECLARE_READ8_MEMBER( super80v_low_r );
DECLARE_READ8_MEMBER( super80v_high_r );
DECLARE_WRITE8_MEMBER( super80v_low_w );
DECLARE_WRITE8_MEMBER( super80v_high_w );
DECLARE_WRITE8_MEMBER( super80v_10_w );
DECLARE_WRITE8_MEMBER( super80v_11_w );
DECLARE_WRITE8_MEMBER( super80_f1_w );
DECLARE_READ8_MEMBER( super80_dc_r );
DECLARE_READ8_MEMBER( super80_f2_r );
DECLARE_WRITE8_MEMBER( super80_dc_w );
DECLARE_WRITE8_MEMBER( super80_f0_w );
DECLARE_WRITE8_MEMBER( super80r_f0_w );
DECLARE_READ8_MEMBER( super80_read_ff );
DECLARE_WRITE8_MEMBER( pio_port_a_w );
DECLARE_READ8_MEMBER( pio_port_b_r );
virtual void machine_reset();
UINT8 m_shared;
UINT8 m_keylatch;
UINT8 m_cass_data[4];
UINT8 m_int_sw;
UINT8 m_last_data;
UINT16 m_vidpg;
UINT8 m_current_palette;
UINT8 m_current_charset;
const UINT8 *m_p_chargen;
UINT8 m_s_options;
UINT8 m_mc6845_cursor[16];
UINT8 m_mc6845_reg[32];
UINT8 m_mc6845_ind;
UINT8 m_framecnt;
UINT8 m_speed;
UINT8 m_flash;
UINT16 m_cursor;
UINT8 *m_p_videoram;
UINT8 *m_p_colorram;
UINT8 *m_p_pcgram;
UINT8 *m_p_ram;
void mc6845_cursor_configure();
DECLARE_READ8_MEMBER(super80v_low_r);
DECLARE_READ8_MEMBER(super80v_high_r);
DECLARE_WRITE8_MEMBER(super80v_low_w);
DECLARE_WRITE8_MEMBER(super80v_high_w);
DECLARE_WRITE8_MEMBER(super80v_10_w);
DECLARE_WRITE8_MEMBER(super80v_11_w);
DECLARE_READ8_MEMBER(port3e_r);
DECLARE_WRITE8_MEMBER(port3f_w);
DECLARE_WRITE8_MEMBER(super80_f1_w);
DECLARE_READ8_MEMBER(super80_dc_r);
DECLARE_READ8_MEMBER(super80_f2_r);
DECLARE_WRITE8_MEMBER(super80_dc_w);
DECLARE_WRITE8_MEMBER(super80_f0_w);
DECLARE_WRITE8_MEMBER(super80r_f0_w);
DECLARE_READ8_MEMBER(super80_read_ff);
DECLARE_WRITE_LINE_MEMBER(busreq_w);
DECLARE_READ8_MEMBER(memory_read_byte);
DECLARE_WRITE8_MEMBER(memory_write_byte);
DECLARE_READ8_MEMBER(io_read_byte);
DECLARE_WRITE8_MEMBER(io_write_byte);
DECLARE_WRITE8_MEMBER(pio_port_a_w);
DECLARE_READ8_MEMBER(pio_port_b_r);
DECLARE_DRIVER_INIT(super80);
DECLARE_DRIVER_INIT(super80v);
DECLARE_VIDEO_START(super80);
DECLARE_VIDEO_START(super80v);
DECLARE_PALETTE_INIT(super80m);
DECLARE_QUICKLOAD_LOAD_MEMBER(super80);
UINT32 screen_update_super80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_super80v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
UINT32 screen_update_super80d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@ -97,14 +89,43 @@ public:
TIMER_CALLBACK_MEMBER(super80_timer);
TIMER_CALLBACK_MEMBER(super80_reset);
TIMER_CALLBACK_MEMBER(super80_halfspeed);
UINT8 m_s_options;
UINT8 m_shared;
UINT8 *m_p_videoram;
UINT8 *m_p_colorram;
UINT8 *m_p_pcgram;
UINT8 m_framecnt;
UINT8 m_speed;
UINT8 m_flash;
UINT16 m_cursor;
UINT8 m_mc6845_cursor[16];
required_device<palette_device> m_palette;
private:
virtual void machine_reset();
UINT8 m_keylatch;
UINT8 m_cass_data[4];
UINT8 m_int_sw;
UINT8 m_last_data;
UINT16 m_vidpg;
UINT8 m_current_palette;
UINT8 m_current_charset;
const UINT8 *m_p_chargen;
UINT8 m_mc6845_reg[32];
UINT8 m_mc6845_ind;
UINT8 *m_p_ram;
void mc6845_cursor_configure();
void palette_set_colors_rgb(const UINT8 *colors);
void super80_cassette_motor(UINT8 data);
void driver_init_common();
required_device<cpu_device> m_maincpu;
required_device<z80pio_device> m_pio;
optional_device<z80dma_device> m_dma;
required_device<cassette_image_device> m_cassette;
required_device<wave_device> m_wave;
required_device<speaker_sound_device> m_speaker;
required_device<centronics_device> m_centronics;
required_device<output_latch_device> m_cent_data_out;
optional_device<mc6845_device> m_6845;
optional_device<mc6845_device> m_crtc;
required_ioport m_io_dsw;
required_ioport m_io_x0;
required_ioport m_io_x1;
@ -115,11 +136,9 @@ public:
required_ioport m_io_x6;
required_ioport m_io_x7;
required_ioport m_io_config;
required_device<palette_device> m_palette;
void palette_set_colors_rgb(const UINT8 *colors);
void super80_cassette_motor( UINT8 data );
void driver_init_common( );
DECLARE_QUICKLOAD_LOAD_MEMBER( super80 );
optional_device<wd2793_t> m_fdc;
optional_device<floppy_connector> m_floppy0;
optional_device<floppy_connector> m_floppy1;
};

View File

@ -11,7 +11,7 @@ WRITE8_MEMBER( super80_state::pio_port_a_w )
m_keylatch = data;
};
READ8_MEMBER(super80_state::pio_port_b_r)
READ8_MEMBER( super80_state::pio_port_b_r )
{
UINT8 data = 0xff;
@ -150,6 +150,15 @@ TIMER_CALLBACK_MEMBER(super80_state::super80_halfspeed)
/**************************** I/O PORTS *****************************************************************/
READ8_MEMBER( super80_state::port3e_r )
{
return 0xff;
}
WRITE8_MEMBER( super80_state::port3f_w )
{
}
READ8_MEMBER( super80_state::super80_f2_r )
{
UINT8 data = m_io_dsw->read() & 0xf0; // dip switches on pcb
@ -198,7 +207,7 @@ void super80_state::machine_reset()
membank("boot")->set_entry(1);
}
void super80_state::driver_init_common( )
void super80_state::driver_init_common()
{
UINT8 *RAM = memregion("maincpu")->base();
membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xc000);

View File

@ -1,4 +1,4 @@
/* Super80.c written by Robbbert, 2005-2010. See the MESS wiki for documentation. */
/* Super80.c written by Robbbert, 2005-2010. See the driver source for documentation. */
/* Notes on using MAME MC6845 Device (MMD).
1. Speed of MMD is about 20% slower than pre-MMD coding
@ -382,7 +382,7 @@ UINT32 super80_state::screen_update_super80v(screen_device &screen, bitmap_rgb32
m_cursor = (m_mc6845_reg[14]<<8) | m_mc6845_reg[15]; // get cursor position
m_s_options=m_io_config->read();
output_set_value("cass_led",BIT(m_shared, 5));
m_6845->screen_update(screen, bitmap, cliprect);
m_crtc->screen_update(screen, bitmap, cliprect);
return 0;
}
@ -446,12 +446,12 @@ WRITE8_MEMBER( super80_state::super80v_10_w )
{
data &= 0x1f;
m_mc6845_ind = data;
m_6845->address_w( space, 0, data );
m_crtc->address_w( space, 0, data );
}
WRITE8_MEMBER( super80_state::super80v_11_w )
{
m_mc6845_reg[m_mc6845_ind] = data & mc6845_mask[m_mc6845_ind]; /* save data in register */
m_6845->register_w( space, 0, data );
m_crtc->register_w( space, 0, data );
if ((m_mc6845_ind > 8) && (m_mc6845_ind < 12)) mc6845_cursor_configure(); /* adjust cursor shape - remove when mame fixed */
}