mirror of
https://github.com/holub/mame
synced 2025-04-20 15:32:45 +03:00
amstrad: added support for 64k, 320k, and 576k RAM sizes
added preliminary support for the SYMBiFACE II board [Barry Rodewald] idehd: added Read Native Max Address IDE command
This commit is contained in:
parent
ec0a11fb91
commit
06b51f4e8e
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -795,6 +795,8 @@ src/emu/bus/cpc/cpcexp.c svneol=native#text/plain
|
||||
src/emu/bus/cpc/cpcexp.h svneol=native#text/plain
|
||||
src/emu/bus/cpc/mface2.c svneol=native#text/plain
|
||||
src/emu/bus/cpc/mface2.h svneol=native#text/plain
|
||||
src/emu/bus/cpc/symbfac2.c svneol=native#text/plain
|
||||
src/emu/bus/cpc/symbfac2.h svneol=native#text/plain
|
||||
src/emu/bus/ecbbus/ecbbus.c svneol=native#text/plain
|
||||
src/emu/bus/ecbbus/ecbbus.h svneol=native#text/plain
|
||||
src/emu/bus/ecbbus/grip.c svneol=native#text/plain
|
||||
|
@ -1063,6 +1063,7 @@ BUSOBJS += $(BUSOBJ)/cpc/cpc_rom.o
|
||||
BUSOBJS += $(BUSOBJ)/cpc/cpc_pds.o
|
||||
BUSOBJS += $(BUSOBJ)/cpc/cpc_rs232.o
|
||||
BUSOBJS += $(BUSOBJ)/cpc/mface2.o
|
||||
BUSOBJS += $(BUSOBJ)/cpc/symbfac2.o
|
||||
endif
|
||||
|
||||
#-------------------------------------------------
|
||||
|
252
src/emu/bus/cpc/symbfac2.c
Normal file
252
src/emu/bus/cpc/symbfac2.c
Normal file
@ -0,0 +1,252 @@
|
||||
/*
|
||||
* symbfac2.c
|
||||
* SYMBiFACE II expansion device
|
||||
* - IDE
|
||||
* - RTC (Dallas DS1287A)
|
||||
* - PS/2 compatible mouse connector
|
||||
* - 512kB RAM expansion
|
||||
* - 512kB rewritable ROM
|
||||
*
|
||||
* Created on: 2/08/2014
|
||||
*
|
||||
* TODO:
|
||||
* - expansion RAM
|
||||
* - rewritable ROM
|
||||
* - mouse controls still need some work
|
||||
*/
|
||||
|
||||
#include "symbfac2.h"
|
||||
|
||||
|
||||
const device_type CPC_SYMBIFACE2 = &device_creator<cpc_symbiface2_device>;
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE CONFIG INTERFACE
|
||||
//**************************************************************************
|
||||
|
||||
// device machine config
|
||||
static MACHINE_CONFIG_FRAGMENT( cpc_symbiface2 )
|
||||
MCFG_ATA_INTERFACE_ADD("ide",ata_devices,"hdd",NULL,false)
|
||||
MCFG_DS12885_ADD("rtc")
|
||||
// no pass-through
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static INPUT_PORTS_START(cpc_symbiface2)
|
||||
PORT_START("sf2_mouse_x")
|
||||
PORT_BIT(0x3f , 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_REVERSE PORT_PLAYER(1) PORT_CODE(MOUSECODE_X) PORT_CHANGED_MEMBER(DEVICE_SELF,cpc_symbiface2_device,mouse_change_x,NULL)
|
||||
|
||||
PORT_START("sf2_mouse_y")
|
||||
PORT_BIT(0x3f , 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_CODE(MOUSECODE_Y) PORT_CHANGED_MEMBER(DEVICE_SELF,cpc_symbiface2_device,mouse_change_x,NULL)
|
||||
|
||||
PORT_START("sf2_mouse_buttons")
|
||||
PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("PS/2 Mouse left button") PORT_CODE(MOUSECODE_BUTTON1) PORT_CHANGED_MEMBER(DEVICE_SELF,cpc_symbiface2_device,mouse_change_x,NULL)
|
||||
PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("PS/2 Mouse right button") PORT_CODE(MOUSECODE_BUTTON3) PORT_CHANGED_MEMBER(DEVICE_SELF,cpc_symbiface2_device,mouse_change_x,NULL)
|
||||
PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("PS/2 Mouse middle button") PORT_CODE(MOUSECODE_BUTTON2) PORT_CHANGED_MEMBER(DEVICE_SELF,cpc_symbiface2_device,mouse_change_x,NULL)
|
||||
PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("PS/2 Mouse back button") PORT_CODE(MOUSECODE_BUTTON4) PORT_CHANGED_MEMBER(DEVICE_SELF,cpc_symbiface2_device,mouse_change_x,NULL)
|
||||
PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("PS/2 Mouse forward button") PORT_CODE(MOUSECODE_BUTTON5) PORT_CHANGED_MEMBER(DEVICE_SELF,cpc_symbiface2_device,mouse_change_x,NULL)
|
||||
|
||||
// TODO: mouse scroll wheel support
|
||||
// PORT_START("sf2_mouse_scroll")
|
||||
// PORT_BIT(0x1f , 0, IPT_TRACKBALL_Y)
|
||||
// PORT_SENSITIVITY(100)
|
||||
// PORT_KEYDELTA(10)
|
||||
// PORT_PLAYER(1)
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
machine_config_constructor cpc_symbiface2_device::device_mconfig_additions() const
|
||||
{
|
||||
return MACHINE_CONFIG_NAME( cpc_symbiface2 );
|
||||
}
|
||||
|
||||
ioport_constructor cpc_symbiface2_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME( cpc_symbiface2 );
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
cpc_symbiface2_device::cpc_symbiface2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, CPC_SYMBIFACE2, "SYMBiFACE II", tag, owner, clock, "cpc_symf2", __FILE__),
|
||||
device_cpc_expansion_card_interface(mconfig, *this),
|
||||
m_ide(*this,"ide"),
|
||||
m_rtc(*this,"rtc"),
|
||||
m_mouse_x(*this,"sf2_mouse_x"),
|
||||
m_mouse_y(*this,"sf2_mouse_y"),
|
||||
m_mouse_buttons(*this,"sf2_mouse_buttons")
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void cpc_symbiface2_device::device_start()
|
||||
{
|
||||
device_t* cpu = machine().device("maincpu");
|
||||
address_space& space = cpu->memory().space(AS_IO);
|
||||
|
||||
space.install_readwrite_handler(0xfd00,0xfd07,0,0,read8_delegate(FUNC(cpc_symbiface2_device::ide_cs1_r),this),write8_delegate(FUNC(cpc_symbiface2_device::ide_cs1_w),this));
|
||||
space.install_readwrite_handler(0xfd08,0xfd0f,0,0,read8_delegate(FUNC(cpc_symbiface2_device::ide_cs0_r),this),write8_delegate(FUNC(cpc_symbiface2_device::ide_cs0_w),this));
|
||||
space.install_read_handler(0xfd10,0xfd10,0,0,read8_delegate(FUNC(cpc_symbiface2_device::mouse_r),this));
|
||||
space.install_readwrite_handler(0xfd14,0xfd15,0,0,read8_delegate(FUNC(cpc_symbiface2_device::rtc_r),this),write8_delegate(FUNC(cpc_symbiface2_device::rtc_w),this));
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void cpc_symbiface2_device::device_reset()
|
||||
{
|
||||
m_iohigh = false;
|
||||
m_mouse_state = PS2_MOUSE_IDLE;
|
||||
m_input_x = m_mouse_x->read() & 0x3f;
|
||||
m_input_y = m_mouse_y->read() & 0x3f;
|
||||
}
|
||||
|
||||
// IDE controller (custom)
|
||||
// #FD00 - CS1
|
||||
// #FD08 - CS0
|
||||
READ8_MEMBER(cpc_symbiface2_device::ide_cs0_r)
|
||||
{
|
||||
// data is returned in words, so it must be buffered
|
||||
if(offset == 0x00) // data register
|
||||
{
|
||||
if(m_iohigh)
|
||||
{
|
||||
m_iohigh = false;
|
||||
return m_ide_data >> 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iohigh = true;
|
||||
m_ide_data = m_ide->read_cs0(space,offset);
|
||||
return m_ide_data & 0xff;
|
||||
}
|
||||
}
|
||||
else
|
||||
return m_ide->read_cs0(space,offset);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(cpc_symbiface2_device::ide_cs0_w)
|
||||
{
|
||||
m_ide->write_cs0(space,offset,data);
|
||||
}
|
||||
|
||||
READ8_MEMBER(cpc_symbiface2_device::ide_cs1_r)
|
||||
{
|
||||
return m_ide->read_cs1(space,offset);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(cpc_symbiface2_device::ide_cs1_w)
|
||||
{
|
||||
m_ide->write_cs1(space,offset,data);
|
||||
}
|
||||
|
||||
// RTC (Dallas DS1287A)
|
||||
// #FD15 (write only) register select
|
||||
// #FD14 (read/write) read from or write into selected register
|
||||
READ8_MEMBER(cpc_symbiface2_device::rtc_r)
|
||||
{
|
||||
switch(offset & 0x01)
|
||||
{
|
||||
case 0x00:
|
||||
return m_rtc->read(space,1);
|
||||
case 0x01:
|
||||
return m_rtc->read(space,0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(cpc_symbiface2_device::rtc_w)
|
||||
{
|
||||
switch(offset & 0x01)
|
||||
{
|
||||
case 0x00:
|
||||
m_rtc->write(space,1,data);
|
||||
break;
|
||||
case 0x01:
|
||||
m_rtc->write(space,0,data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// PS/2 Mouse connector
|
||||
// #FD10 (read only) read mouse status
|
||||
/*
|
||||
Status byte
|
||||
Bit 76543210
|
||||
Use mmDDDDDD
|
||||
|
||||
m: Mode
|
||||
D: Use-Data
|
||||
|
||||
If read and...
|
||||
|
||||
m = 00 -> no more data available, you can stop reading the status for a while
|
||||
m = 01 -> D = X offset (signed); you will receive positive values, if the user
|
||||
is moving the mouse to the right
|
||||
m = 10 -> D = Y offset (signed); you will receive positive values, if the user
|
||||
is moving the mouse upwards
|
||||
m = 11 -> D[bit5] = 0 -> D[bit0] = left button
|
||||
D[bit1] = right button
|
||||
D[bit2] = middle button
|
||||
D[bit3] = forward button
|
||||
D[bit4] = backward button
|
||||
D[bit5] = 1 -> D[bit0-4] = scroll wheel offset (signed)
|
||||
*/
|
||||
READ8_MEMBER(cpc_symbiface2_device::mouse_r)
|
||||
{
|
||||
UINT8 ret = 0;
|
||||
int input;
|
||||
int input_diff;
|
||||
|
||||
switch(m_mouse_state)
|
||||
{
|
||||
case PS2_MOUSE_IDLE:
|
||||
m_mouse_state = PS2_MOUSE_IDLE;
|
||||
ret = 0;
|
||||
break;
|
||||
case PS2_MOUSE_X:
|
||||
input = m_mouse_x->read() & 0x3f;
|
||||
input_diff = m_input_x - input;
|
||||
ret = 0x40 | (input_diff & 0x3f);
|
||||
m_input_x = input;
|
||||
m_mouse_state = PS2_MOUSE_Y;
|
||||
break;
|
||||
case PS2_MOUSE_Y:
|
||||
input = m_mouse_y->read() & 0x3f;
|
||||
input_diff = m_input_y - input;
|
||||
ret = 0x80 | (input_diff & 0x3f);
|
||||
m_input_y = input;
|
||||
m_mouse_state = PS2_MOUSE_BUTTONS;
|
||||
break;
|
||||
case PS2_MOUSE_BUTTONS:
|
||||
ret = 0xc0 | (m_mouse_buttons->read() & 0x1f);
|
||||
m_mouse_state = PS2_MOUSE_IDLE;
|
||||
break;
|
||||
case PS2_MOUSE_SCROLL:
|
||||
m_mouse_state = PS2_MOUSE_IDLE;
|
||||
break; // TODO
|
||||
}
|
||||
//popmessage("Mouse: X: %02x Y: %02x\n",m_input_x,m_input_y);
|
||||
return ret;
|
||||
}
|
||||
|
||||
INPUT_CHANGED_MEMBER(cpc_symbiface2_device::mouse_change_x)
|
||||
{
|
||||
m_mouse_state = PS2_MOUSE_X;
|
||||
}
|
||||
|
||||
INPUT_CHANGED_MEMBER(cpc_symbiface2_device::mouse_change_y)
|
||||
{
|
||||
m_mouse_state = PS2_MOUSE_Y;
|
||||
}
|
||||
|
||||
INPUT_CHANGED_MEMBER(cpc_symbiface2_device::mouse_change_buttons)
|
||||
{
|
||||
m_mouse_state = PS2_MOUSE_BUTTONS;
|
||||
}
|
||||
|
71
src/emu/bus/cpc/symbfac2.h
Normal file
71
src/emu/bus/cpc/symbfac2.h
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* symbfac2.h
|
||||
*
|
||||
* Created on: 2/08/2014
|
||||
*/
|
||||
|
||||
#ifndef SYMBFAC2_H_
|
||||
#define SYMBFAC2_H_
|
||||
|
||||
#include "emu.h"
|
||||
#include "machine/ataintf.h"
|
||||
#include "machine/ds128x.h"
|
||||
#include "cpcexp.h"
|
||||
|
||||
class cpc_symbiface2_device : public device_t,
|
||||
public device_cpc_expansion_card_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
cpc_symbiface2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// optional information overrides
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
virtual ioport_constructor device_input_ports() const;
|
||||
|
||||
DECLARE_READ8_MEMBER(ide_cs0_r);
|
||||
DECLARE_WRITE8_MEMBER(ide_cs0_w);
|
||||
DECLARE_READ8_MEMBER(ide_cs1_r);
|
||||
DECLARE_WRITE8_MEMBER(ide_cs1_w);
|
||||
DECLARE_READ8_MEMBER(rtc_r);
|
||||
DECLARE_WRITE8_MEMBER(rtc_w);
|
||||
DECLARE_READ8_MEMBER(mouse_r);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(mouse_change_x);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(mouse_change_y);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(mouse_change_buttons);
|
||||
|
||||
enum
|
||||
{
|
||||
PS2_MOUSE_IDLE = 0,
|
||||
PS2_MOUSE_X,
|
||||
PS2_MOUSE_Y,
|
||||
PS2_MOUSE_BUTTONS,
|
||||
PS2_MOUSE_SCROLL
|
||||
};
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
private:
|
||||
//cpc_expansion_slot_device *m_slot;
|
||||
required_device<ata_interface_device> m_ide;
|
||||
required_device<ds12885_device> m_rtc;
|
||||
|
||||
required_ioport m_mouse_x;
|
||||
required_ioport m_mouse_y;
|
||||
required_ioport m_mouse_buttons;
|
||||
|
||||
bool m_iohigh;
|
||||
UINT16 m_ide_data;
|
||||
|
||||
UINT8 m_mouse_state;
|
||||
UINT8 m_input_x;
|
||||
UINT8 m_input_y;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
extern const device_type CPC_SYMBIFACE2;
|
||||
|
||||
|
||||
#endif /* SYMBFAC2_H_ */
|
@ -128,6 +128,7 @@ protected:
|
||||
IDE_COMMAND_IDENTIFY_DEVICE = 0xec,
|
||||
IDE_COMMAND_SET_FEATURES = 0xef,
|
||||
IDE_COMMAND_SECURITY_UNLOCK = 0xf2,
|
||||
IDE_COMMAND_READ_NATIVE_MAX_ADDRESS = 0xf8,
|
||||
IDE_COMMAND_SET_MAX = 0xf9
|
||||
};
|
||||
|
||||
|
@ -214,6 +214,8 @@ void ata_mass_storage_device::signature()
|
||||
|
||||
void ata_mass_storage_device::finished_command()
|
||||
{
|
||||
int total_sectors = m_num_cylinders * m_num_heads * m_num_sectors;
|
||||
|
||||
switch (m_command)
|
||||
{
|
||||
case IDE_COMMAND_IDENTIFY_DEVICE:
|
||||
@ -261,6 +263,14 @@ void ata_mass_storage_device::finished_command()
|
||||
set_irq(ASSERT_LINE);
|
||||
break;
|
||||
|
||||
case IDE_COMMAND_READ_NATIVE_MAX_ADDRESS:
|
||||
m_buffer[0] = (total_sectors & 0xff000000) >> 24;
|
||||
m_buffer[1] = (total_sectors & 0x00ff0000) >> 16;
|
||||
m_buffer[2] = (total_sectors & 0x0000ff00) >> 8;
|
||||
m_buffer[3] = (total_sectors & 0x000000ff);
|
||||
set_irq(ASSERT_LINE);
|
||||
break;
|
||||
|
||||
default:
|
||||
ata_hle_device::finished_command();
|
||||
break;
|
||||
@ -712,6 +722,10 @@ void ata_mass_storage_device::process_command()
|
||||
set_irq(ASSERT_LINE);
|
||||
break;
|
||||
|
||||
case IDE_COMMAND_READ_NATIVE_MAX_ADDRESS:
|
||||
start_busy(MINIMUM_COMMAND_TIME, PARAM_COMMAND);
|
||||
break;
|
||||
|
||||
default:
|
||||
ata_hle_device::process_command();
|
||||
break;
|
||||
|
@ -815,6 +815,7 @@ SLOT_INTERFACE_START(cpc_exp_cards)
|
||||
SLOT_INTERFACE("pds", CPC_PDS)
|
||||
SLOT_INTERFACE("rs232", CPC_RS232)
|
||||
SLOT_INTERFACE("amsrs232", CPC_RS232_AMS)
|
||||
SLOT_INTERFACE("sf2", CPC_SYMBIFACE2)
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
SLOT_INTERFACE_START(cpcplus_exp_cards)
|
||||
@ -824,6 +825,7 @@ SLOT_INTERFACE_START(cpcplus_exp_cards)
|
||||
SLOT_INTERFACE("pds", CPC_PDS)
|
||||
SLOT_INTERFACE("rs232", CPC_RS232)
|
||||
SLOT_INTERFACE("amsrs232", CPC_RS232_AMS)
|
||||
SLOT_INTERFACE("sf2", CPC_SYMBIFACE2)
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
static MACHINE_CONFIG_START( amstrad_nofdc, amstrad_state )
|
||||
@ -896,6 +898,7 @@ static MACHINE_CONFIG_START( amstrad_nofdc, amstrad_state )
|
||||
/* internal ram */
|
||||
MCFG_RAM_ADD(RAM_TAG)
|
||||
MCFG_RAM_DEFAULT_SIZE("128K")
|
||||
MCFG_RAM_EXTRA_OPTIONS("64K,320K,576K")
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
FLOPPY_FORMATS_MEMBER( amstrad_state::floppy_formats )
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "bus/cpc/mface2.h"
|
||||
#include "bus/cpc/cpc_pds.h"
|
||||
#include "bus/cpc/cpc_rs232.h"
|
||||
#include "bus/cpc/symbfac2.h"
|
||||
#include "machine/ram.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "bus/centronics/ctronics.h"
|
||||
|
@ -1270,20 +1270,34 @@ void amstrad_state::AmstradCPC_GA_SetRamConfiguration()
|
||||
int ConfigurationIndex = m_GateArray_RamConfiguration & 0x07;
|
||||
int BankIndex,i;
|
||||
unsigned char *BankAddr;
|
||||
UINT8 banknum = (m_GateArray_RamConfiguration & 0x38) >> 3;
|
||||
|
||||
/* if b5 = 0 */
|
||||
if(((m_GateArray_RamConfiguration) & (1<<5)) == 0)
|
||||
if(m_ram->size() > 65536)
|
||||
{
|
||||
for (i=0;i<4;i++)
|
||||
{
|
||||
BankIndex = RamConfigurations[(ConfigurationIndex << 2) + i];
|
||||
BankAddr = m_ram->pointer() + (BankIndex << 14);
|
||||
if(BankIndex > 3)
|
||||
{
|
||||
UINT8 maxbank = ((m_ram->size()-65536) / 65536);
|
||||
BankAddr = m_ram->pointer() + (BankIndex << 14) + ((banknum%maxbank)*0x10000);
|
||||
}
|
||||
else
|
||||
BankAddr = m_ram->pointer() + (BankIndex << 14);
|
||||
m_Aleste_RamBanks[i] = BankAddr;
|
||||
m_AmstradCPC_RamBanks[i] = BankAddr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{/* Need to add the ram expansion configuration here ! */
|
||||
{
|
||||
// set normal 64k RAM mapping
|
||||
for (i=0;i<4;i++)
|
||||
{
|
||||
BankAddr = m_ram->pointer() + (i << 14);
|
||||
m_Aleste_RamBanks[i] = BankAddr;
|
||||
m_AmstradCPC_RamBanks[i] = BankAddr;
|
||||
}
|
||||
}
|
||||
amstrad_rethinkMemory();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user