mirror of
https://github.com/holub/mame
synced 2025-06-09 14:22:41 +03:00
bus/coco: add CoCo Max Hi Res Input Module (#8104)
This commit is contained in:
parent
b6886b0c78
commit
eb1df97c6b
@ -3455,6 +3455,8 @@ if (BUSES["COCO"]~=null) then
|
|||||||
MAME_DIR .. "src/devices/bus/coco/coco_fdc.h",
|
MAME_DIR .. "src/devices/bus/coco/coco_fdc.h",
|
||||||
MAME_DIR .. "src/devices/bus/coco/coco_gmc.cpp",
|
MAME_DIR .. "src/devices/bus/coco/coco_gmc.cpp",
|
||||||
MAME_DIR .. "src/devices/bus/coco/coco_gmc.h",
|
MAME_DIR .. "src/devices/bus/coco/coco_gmc.h",
|
||||||
|
MAME_DIR .. "src/devices/bus/coco/coco_max.cpp",
|
||||||
|
MAME_DIR .. "src/devices/bus/coco/coco_max.h",
|
||||||
MAME_DIR .. "src/devices/bus/coco/coco_midi.cpp",
|
MAME_DIR .. "src/devices/bus/coco/coco_midi.cpp",
|
||||||
MAME_DIR .. "src/devices/bus/coco/coco_midi.h",
|
MAME_DIR .. "src/devices/bus/coco/coco_midi.h",
|
||||||
MAME_DIR .. "src/devices/bus/coco/coco_multi.cpp",
|
MAME_DIR .. "src/devices/bus/coco/coco_multi.cpp",
|
||||||
|
172
src/devices/bus/coco/coco_max.cpp
Normal file
172
src/devices/bus/coco/coco_max.cpp
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
// license:BSD-3-Clause
|
||||||
|
// copyright-holders:tim lindner
|
||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
coco_max.cpp
|
||||||
|
|
||||||
|
Code for emulating CoCo Max Hi-Res Input Module
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "emu.h"
|
||||||
|
#include "coco_max.h"
|
||||||
|
|
||||||
|
#include "machine/ram.h"
|
||||||
|
|
||||||
|
#define MOUSE_SENSITIVITY 75
|
||||||
|
#define COCOMAX_X_TAG "cocomax_x"
|
||||||
|
#define COCOMAX_Y_TAG "cocomax_y"
|
||||||
|
#define COCOMAX_BUTTONS "cocomax_buttons"
|
||||||
|
|
||||||
|
// #define VERBOSE (LOG_GENERAL )
|
||||||
|
#include "logmacro.h"
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// INPUT_PORTS( cocomax_mouse )
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
INPUT_PORTS_START( cocomax_mouse )
|
||||||
|
PORT_START(COCOMAX_X_TAG)
|
||||||
|
PORT_BIT( 0xff, 0x00, IPT_AD_STICK_X) PORT_NAME("CoCo Max Mouse X") PORT_SENSITIVITY(MOUSE_SENSITIVITY) PORT_MINMAX(0x00,0xff) PORT_PLAYER(1)
|
||||||
|
PORT_START(COCOMAX_Y_TAG)
|
||||||
|
PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Y) PORT_NAME("CoCo Max Mouse Y") PORT_SENSITIVITY(MOUSE_SENSITIVITY) PORT_MINMAX(0x00,0xff) PORT_PLAYER(1)
|
||||||
|
PORT_START(COCOMAX_BUTTONS)
|
||||||
|
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("CoCo Max Left Button") PORT_CODE(KEYCODE_0_PAD) PORT_CODE(MOUSECODE_BUTTON1) PORT_PLAYER(1)
|
||||||
|
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("CoCo Max Right Button") PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(MOUSECODE_BUTTON2) PORT_PLAYER(1)
|
||||||
|
INPUT_PORTS_END
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// TYPE DECLARATIONS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
// ======================> coco_pak_device
|
||||||
|
|
||||||
|
class coco_pak_max_device :
|
||||||
|
public device_t,
|
||||||
|
public device_cococart_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// construction/destruction
|
||||||
|
coco_pak_max_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// device-level overrides
|
||||||
|
virtual void device_start() override;
|
||||||
|
virtual void device_reset() override;
|
||||||
|
virtual ioport_constructor device_input_ports() const override;
|
||||||
|
|
||||||
|
u8 ff90_read(offs_t offset);
|
||||||
|
|
||||||
|
private:
|
||||||
|
required_ioport m_mouse_x;
|
||||||
|
required_ioport m_mouse_y;
|
||||||
|
required_ioport m_buttons;
|
||||||
|
|
||||||
|
uint8_t m_a2d_result;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// GLOBAL VARIABLES
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
DEFINE_DEVICE_TYPE_PRIVATE(COCO_PAK_MAX, device_cococart_interface, coco_pak_max_device, "cocopakmax", "CoCo Max HI-RES input module")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// coco_pak_device - constructor
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
coco_pak_max_device::coco_pak_max_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||||
|
: device_t(mconfig, COCO_PAK_MAX, tag, owner, clock)
|
||||||
|
, device_cococart_interface(mconfig, *this)
|
||||||
|
, m_mouse_x(*this, COCOMAX_X_TAG)
|
||||||
|
, m_mouse_y(*this, COCOMAX_Y_TAG)
|
||||||
|
, m_buttons(*this, COCOMAX_BUTTONS)
|
||||||
|
, m_a2d_result(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ioport_constructor coco_pak_max_device::device_input_ports() const
|
||||||
|
{
|
||||||
|
return INPUT_PORTS_NAME(cocomax_mouse);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// device_start - device-specific startup
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void coco_pak_max_device::device_start()
|
||||||
|
{
|
||||||
|
// initial state
|
||||||
|
m_a2d_result = 0;
|
||||||
|
|
||||||
|
// save state
|
||||||
|
save_item(NAME(m_a2d_result));
|
||||||
|
|
||||||
|
// install $ff90-$ff93 handler
|
||||||
|
install_read_handler(0xff90, 0xff97, read8sm_delegate(*this, FUNC(coco_pak_max_device::ff90_read)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// device_reset - device-specific reset
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void coco_pak_max_device::device_reset()
|
||||||
|
{
|
||||||
|
m_a2d_result = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// ff90_read
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
u8 coco_pak_max_device::ff90_read(offs_t offset)
|
||||||
|
{
|
||||||
|
uint8_t result = m_a2d_result;
|
||||||
|
|
||||||
|
switch (offset & 0x08)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
m_a2d_result = m_mouse_y->read();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
m_a2d_result = m_mouse_x->read();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
m_a2d_result = BIT(m_buttons->read(), 0) ? 0 : 0xff;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
m_a2d_result = BIT(m_buttons->read(), 1) ? 0 : 0xff;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
/* not connected*/
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
/* not connected*/
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
/* not connected*/
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
/* not connected*/
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
14
src/devices/bus/coco/coco_max.h
Normal file
14
src/devices/bus/coco/coco_max.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// license:BSD-3-Clause
|
||||||
|
// copyright-holders:tim lindner
|
||||||
|
#ifndef MAME_BUS_COCO_COCO_MAX_H
|
||||||
|
#define MAME_BUS_COCO_COCO_MAX_H
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cococart.h"
|
||||||
|
|
||||||
|
// device type definition
|
||||||
|
DECLARE_DEVICE_TYPE(COCO_PAK_MAX, device_cococart_interface)
|
||||||
|
|
||||||
|
#endif // MAME_BUS_COCO_COCO_MAX_H
|
||||||
|
|
@ -43,6 +43,7 @@
|
|||||||
#include "coco_dcmodem.h"
|
#include "coco_dcmodem.h"
|
||||||
#include "coco_fdc.h"
|
#include "coco_fdc.h"
|
||||||
#include "coco_gmc.h"
|
#include "coco_gmc.h"
|
||||||
|
#include "coco_max.h"
|
||||||
#include "coco_midi.h"
|
#include "coco_midi.h"
|
||||||
#include "coco_multi.h"
|
#include "coco_multi.h"
|
||||||
#include "coco_orch90.h"
|
#include "coco_orch90.h"
|
||||||
@ -699,6 +700,7 @@ void coco_cart_add_basic_devices(device_slot_interface &device)
|
|||||||
device.option_add("ccpsg", COCO_PSG);
|
device.option_add("ccpsg", COCO_PSG);
|
||||||
device.option_add("dcmodem", COCO_DCMODEM);
|
device.option_add("dcmodem", COCO_DCMODEM);
|
||||||
device.option_add("gmc", COCO_PAK_GMC);
|
device.option_add("gmc", COCO_PAK_GMC);
|
||||||
|
device.option_add("max", COCO_PAK_MAX);
|
||||||
device.option_add("midi", COCO_MIDI);
|
device.option_add("midi", COCO_MIDI);
|
||||||
device.option_add("orch90", COCO_ORCH90);
|
device.option_add("orch90", COCO_ORCH90);
|
||||||
device.option_add("ram", COCO_PAK_RAM);
|
device.option_add("ram", COCO_PAK_RAM);
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "bus/coco/coco_gmc.h"
|
#include "bus/coco/coco_gmc.h"
|
||||||
#include "bus/coco/coco_orch90.h"
|
#include "bus/coco/coco_orch90.h"
|
||||||
|
#include "bus/coco/coco_max.h"
|
||||||
#include "bus/coco/coco_midi.h"
|
#include "bus/coco/coco_midi.h"
|
||||||
#include "bus/coco/coco_pak.h"
|
#include "bus/coco/coco_pak.h"
|
||||||
#include "bus/coco/coco_psg.h"
|
#include "bus/coco/coco_psg.h"
|
||||||
@ -214,6 +215,7 @@ void dragon_cart(device_slot_interface &device)
|
|||||||
device.option_add("gmc", COCO_PAK_GMC);
|
device.option_add("gmc", COCO_PAK_GMC);
|
||||||
device.option_add("jcbsnd", DRAGON_JCBSND);
|
device.option_add("jcbsnd", DRAGON_JCBSND);
|
||||||
device.option_add("jcbspch", DRAGON_JCBSPCH);
|
device.option_add("jcbspch", DRAGON_JCBSPCH);
|
||||||
|
device.option_add("max", COCO_PAK_MAX);
|
||||||
device.option_add("midi", DRAGON_MIDI);
|
device.option_add("midi", DRAGON_MIDI);
|
||||||
device.option_add("orch90", COCO_ORCH90);
|
device.option_add("orch90", COCO_ORCH90);
|
||||||
device.option_add("pak", COCO_PAK);
|
device.option_add("pak", COCO_PAK);
|
||||||
|
@ -57,7 +57,25 @@
|
|||||||
// CONSTANTS
|
// CONSTANTS
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
|
||||||
#define LOG_SAM 0
|
#define LOG_FBITS (1U << 1)
|
||||||
|
#define LOG_VBITS (1U << 2)
|
||||||
|
#define LOG_PBITS (1U << 3)
|
||||||
|
#define LOG_TBITS (1U << 4)
|
||||||
|
#define LOG_MBITS (1U << 5)
|
||||||
|
#define LOG_RBITS (1U << 6)
|
||||||
|
|
||||||
|
#define VERBOSE (0)
|
||||||
|
// #define VERBOSE (LOG_FBITS)
|
||||||
|
// #define VERBOSE (LOG_FBITS | LOG_VBITS | LOG_PBITS | LOG_MBITS | LOG_RBITS)
|
||||||
|
|
||||||
|
#include "logmacro.h"
|
||||||
|
|
||||||
|
#define LOGFBITS(...) LOGMASKED(LOG_FBITS, __VA_ARGS__)
|
||||||
|
#define LOGVBITS(...) LOGMASKED(LOG_VBITS, __VA_ARGS__)
|
||||||
|
#define LOGPBITS(...) LOGMASKED(LOG_PBITS, __VA_ARGS__)
|
||||||
|
#define LOGTBITS(...) LOGMASKED(LOG_TBITS, __VA_ARGS__)
|
||||||
|
#define LOGMBITS(...) LOGMASKED(LOG_MBITS, __VA_ARGS__)
|
||||||
|
#define LOGRBITS(...) LOGMASKED(LOG_RBITS, __VA_ARGS__)
|
||||||
|
|
||||||
DEFINE_DEVICE_TYPE(SAM6883, sam6883_device, "sam6883", "MC6883 SAM")
|
DEFINE_DEVICE_TYPE(SAM6883, sam6883_device, "sam6883", "MC6883 SAM")
|
||||||
|
|
||||||
@ -302,16 +320,9 @@ void sam6883_device::update_memory()
|
|||||||
// 64k mode (dynamic)
|
// 64k mode (dynamic)
|
||||||
case SAM_STATE_M1|SAM_STATE_M0:
|
case SAM_STATE_M1|SAM_STATE_M0:
|
||||||
// 64k mode (static)
|
// 64k mode (static)
|
||||||
if (m_sam_state & SAM_STATE_TY)
|
// full 64k RAM or ROM/RAM
|
||||||
{
|
// CoCo Max requires these two be treated the same
|
||||||
// full 64k RAM
|
m_counter_mask = 0xfFFF;
|
||||||
m_counter_mask = 0xFFFF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// ROM/RAM
|
|
||||||
m_counter_mask = 0x7FFF;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -370,6 +381,54 @@ void sam6883_device::internal_write(offs_t offset, uint8_t data)
|
|||||||
update_memory();
|
update_memory();
|
||||||
if (xorval & (SAM_STATE_R1|SAM_STATE_R0))
|
if (xorval & (SAM_STATE_R1|SAM_STATE_R0))
|
||||||
update_cpu_clock();
|
update_cpu_clock();
|
||||||
|
|
||||||
|
if( xorval & (SAM_STATE_F6|SAM_STATE_F5|SAM_STATE_F4|SAM_STATE_F3|SAM_STATE_F2|SAM_STATE_F1|SAM_STATE_F0))
|
||||||
|
{
|
||||||
|
/* Video frame buffer address changed */
|
||||||
|
LOGFBITS("%s: SAM F Address: $%04x\n",
|
||||||
|
machine().describe_context(),
|
||||||
|
display_offset() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xorval & (SAM_STATE_V0|SAM_STATE_V1|SAM_STATE_V2))
|
||||||
|
{
|
||||||
|
/* Video frame buffer address changed */
|
||||||
|
LOGVBITS("%s: SAM V Bits: $%02x\n",
|
||||||
|
machine().describe_context(),
|
||||||
|
(m_sam_state & (SAM_STATE_V0|SAM_STATE_V1|SAM_STATE_V2)) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xorval & (SAM_STATE_P1))
|
||||||
|
{
|
||||||
|
/* Video frame buffer address changed */
|
||||||
|
LOGPBITS("%s: SAM P1 Bit: $%02x\n",
|
||||||
|
machine().describe_context(),
|
||||||
|
(m_sam_state & (SAM_STATE_P1)) >> 10 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xorval & (SAM_STATE_TY))
|
||||||
|
{
|
||||||
|
/* Video frame buffer address changed */
|
||||||
|
LOGTBITS("%s: SAM TY Bits: $%02x\n",
|
||||||
|
machine().describe_context(),
|
||||||
|
(m_sam_state & (SAM_STATE_TY)) >> 15 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xorval & (SAM_STATE_M0|SAM_STATE_M1))
|
||||||
|
{
|
||||||
|
/* Video frame buffer address changed */
|
||||||
|
LOGMBITS("%s: SAM M Bits: $%02x\n",
|
||||||
|
machine().describe_context(),
|
||||||
|
(m_sam_state & (SAM_STATE_M0|SAM_STATE_M1)) >> 9 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xorval & (SAM_STATE_R0|SAM_STATE_R1))
|
||||||
|
{
|
||||||
|
/* Video frame buffer address changed */
|
||||||
|
LOGRBITS("%s: SAM R Bits: $%02x\n",
|
||||||
|
machine().describe_context(),
|
||||||
|
(m_sam_state & (SAM_STATE_R0|SAM_STATE_R1)) >> 11 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user