mirror of
https://github.com/holub/mame
synced 2025-04-21 07:52:35 +03:00
Added skeleton SAA1403 device, nw
This commit is contained in:
parent
1d087a1af5
commit
c2c576dad4
@ -2457,6 +2457,18 @@ if (MACHINES["S3C44B0"]~=null) then
|
||||
}
|
||||
end
|
||||
|
||||
---------------------------------------------------
|
||||
--
|
||||
--@src/devices/machine/saa1043.h,MACHINES["SAA1043"] = true
|
||||
---------------------------------------------------
|
||||
|
||||
if (MACHINES["SAA1043"]~=null) then
|
||||
files {
|
||||
MAME_DIR .. "src/devices/machine/saa1043.cpp",
|
||||
MAME_DIR .. "src/devices/machine/saa1043.h",
|
||||
}
|
||||
end
|
||||
|
||||
---------------------------------------------------
|
||||
--
|
||||
--@src/devices/machine/scnxx562.h,MACHINES["DUSCC"] = true
|
||||
|
@ -510,10 +510,10 @@ end
|
||||
|
||||
---------------------------------------------------
|
||||
--
|
||||
--@src/devices/video/mb88303.h,MACHINES["MB88303"] = true
|
||||
--@src/devices/video/mb88303.h,VIDEOS["MB88303"] = true
|
||||
---------------------------------------------------
|
||||
|
||||
if (MACHINES["MB88303"]~=null) then
|
||||
if (VIDEOS["MB88303"]~=null) then
|
||||
files {
|
||||
MAME_DIR .. "src/devices/video/mb88303.cpp",
|
||||
MAME_DIR .. "src/devices/video/mb88303.h",
|
||||
|
@ -356,6 +356,7 @@ VIDEOS["GBA_LCD"] = true
|
||||
VIDEOS["MGA2064W"] = true
|
||||
VIDEOS["PPU2C0X"] = true
|
||||
VIDEOS["DP8510"] = true
|
||||
VIDEOS["MB88303"] = true
|
||||
|
||||
--------------------------------------------------
|
||||
-- specify available machine cores
|
||||
@ -542,6 +543,7 @@ MACHINES["RTC9701"] = true
|
||||
MACHINES["S3520CF"] = true
|
||||
MACHINES["S3C24XX"] = true
|
||||
MACHINES["S3C44B0"] = true
|
||||
MACHINES["SAA1043"] = true
|
||||
MACHINES["SATURN"] = true
|
||||
--MACHINES["SCSI"] = true
|
||||
MACHINES["SCUDSP"] = true
|
||||
@ -3701,6 +3703,7 @@ files {
|
||||
MAME_DIR .. "src/mame/drivers/vii.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/vp60.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/vp122.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/vp415.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/vsmilepro.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/wicat.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/wyse.cpp",
|
||||
|
78
src/devices/machine/saa1043.cpp
Normal file
78
src/devices/machine/saa1043.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Ryan Holtz
|
||||
/***********************************************************************
|
||||
|
||||
Philips SAA1043 Universal Sync Generator
|
||||
|
||||
TOOD:
|
||||
- Everything.
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "saa1043.h"
|
||||
|
||||
DEFINE_DEVICE_TYPE(SAA1043, saa1043_device, "saa1043", "Philips SAA1043")
|
||||
|
||||
/*static*/ const uint32_t saa1043_device::s_line_counts[4] = { 624, 624, 524, 524 };
|
||||
|
||||
saa1043_device::saa1043_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, SAA1043, tag, owner, clock)
|
||||
, m_outputs({ *this, *this, *this, *this, *this, *this,
|
||||
*this, *this, *this, *this, *this, *this,
|
||||
*this, *this, *this, *this, *this, *this })
|
||||
{
|
||||
memset(m_outputs_hooked, 0, sizeof(bool) * OUT_COUNT);
|
||||
}
|
||||
|
||||
void saa1043_device::device_start()
|
||||
{
|
||||
m_h = attotime::from_ticks(320, clock());
|
||||
m_line_count = s_line_counts[m_type];
|
||||
|
||||
// resolve callbacks
|
||||
for (uint32_t i = 0; i < OUT_COUNT; i++)
|
||||
{
|
||||
m_outputs[i].resolve_safe();
|
||||
if (m_outputs_hooked[i])
|
||||
{
|
||||
m_timers[i] = timer_alloc(i);
|
||||
switch(i)
|
||||
{
|
||||
case V2:
|
||||
m_timers[V2]->adjust(m_h * 6, 1);
|
||||
break;
|
||||
default:
|
||||
// Not yet implemented
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void saa1043_device::device_reset()
|
||||
{
|
||||
// Clear any existing clock states
|
||||
for (uint32_t i = 0; i < OUT_COUNT; i++)
|
||||
{
|
||||
m_outputs[i](CLEAR_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
void saa1043_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case V2:
|
||||
m_outputs[id](1 - param);
|
||||
if (param)
|
||||
m_timers[V2]->adjust(m_h * (m_line_count - 9), 0);
|
||||
else
|
||||
m_timers[V2]->adjust(m_h * 9, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not yet implemented
|
||||
break;
|
||||
}
|
||||
}
|
184
src/devices/machine/saa1043.h
Normal file
184
src/devices/machine/saa1043.h
Normal file
@ -0,0 +1,184 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Ryan Holtz
|
||||
/***********************************************************************
|
||||
|
||||
Philips SAA1043 Universal Sync Generator emulation
|
||||
|
||||
TODO:
|
||||
- Everything.
|
||||
|
||||
************************************************************************
|
||||
_____ _____
|
||||
BC 1 |* \_/ | 28 Vdd
|
||||
FH2 2 | | 27 ID
|
||||
SI 3 | | 26 CS
|
||||
FH3 4 | | 25 CB
|
||||
X 5 | | 24 H2
|
||||
Y 6 | | 23 H1
|
||||
FD 7 | SAA1043 | 22 DL
|
||||
FH80 8 | | 21 CLP
|
||||
VCR 9 | | 20 V2
|
||||
OSCO 10 | | 19 V1
|
||||
OSCI 11 | | 18 RR
|
||||
PH 12 | | 17 WMP
|
||||
NS 13 | | 16 RI
|
||||
Vss 14 |_____________| 15 ECS
|
||||
|
||||
************************************************************************/
|
||||
|
||||
#ifndef MAME_MACHINE_SAA1043_H
|
||||
#define MAME_MACHINE_SAA1043_H
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
// NB: This is effectively an aggregate of the X and Y inputs.
|
||||
#define MCFG_SAA1043_TYPE(_type) \
|
||||
&downcast<saa1043_device &>(*device).set_type(_type);
|
||||
|
||||
#define MCFG_SAA1043_BC_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_bc_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_FH2_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_fh2_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_FH3_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_fh3_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_FH80_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_fh80_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_PH_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_ph_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_NS_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_ns_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_RI_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_ri_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_WMP_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_wmp_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_RR_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_rr_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_V1_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_v1_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_V2_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_v2_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_CLP_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_clp_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_DL_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_dl_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_H1_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_h1_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_H2_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_h2_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_CB_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_cb_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_CS_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_cs_callback(DEVCB_##_write);
|
||||
|
||||
#define MCFG_SAA1043_ID_CALLBACK(_write) \
|
||||
devcb = &downcast<saa1043_device &>(*device).set_id_callback(DEVCB_##_write);
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// ======================> saa1043_device
|
||||
|
||||
class saa1043_device : public device_t
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
saa1043_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
enum outputs : uint32_t
|
||||
{
|
||||
BC,
|
||||
FH2,
|
||||
FH3,
|
||||
FH80,
|
||||
PH,
|
||||
NS,
|
||||
RI,
|
||||
WMP,
|
||||
RR,
|
||||
V1,
|
||||
V2,
|
||||
CLP,
|
||||
DL,
|
||||
H1,
|
||||
H2,
|
||||
CB,
|
||||
CS,
|
||||
ID,
|
||||
|
||||
OUT_COUNT
|
||||
};
|
||||
|
||||
enum signal_type : uint32_t
|
||||
{
|
||||
PAL,
|
||||
SECAM,
|
||||
NTSC,
|
||||
PAL_M,
|
||||
};
|
||||
|
||||
void set_type(signal_type type) { m_type = type; }
|
||||
|
||||
template <class Object> devcb_base &set_bc_callback(Object &&cb) { m_outputs_hooked[BC] = true; return m_outputs[BC].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_fh2_callback(Object &&cb) { m_outputs_hooked[FH2] = true; return m_outputs[FH2].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_fh3_callback(Object &&cb) { m_outputs_hooked[FH3] = true; return m_outputs[FH3].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_fh80_callback(Object &&cb) { m_outputs_hooked[FH80] = true; return m_outputs[FH80].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_ph_callback(Object &&cb) { m_outputs_hooked[PH] = true; return m_outputs[PH].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_ns_callback(Object &&cb) { m_outputs_hooked[NS] = true; return m_outputs[NS].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_ri_callback(Object &&cb) { m_outputs_hooked[RI] = true; return m_outputs[RI].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_wmp_callback(Object &&cb) { m_outputs_hooked[WMP] = true; return m_outputs[WMP].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_rr_callback(Object &&cb) { m_outputs_hooked[RR] = true; return m_outputs[RR].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_v1_callback(Object &&cb) { m_outputs_hooked[V1] = true; return m_outputs[V1].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_v2_callback(Object &&cb) { m_outputs_hooked[V2] = true; return m_outputs[V2].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_clp_callback(Object &&cb) { m_outputs_hooked[CLP] = true; return m_outputs[CLP].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_dl_callback(Object &&cb) { m_outputs_hooked[DL] = true; return m_outputs[DL].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_h1_callback(Object &&cb) { m_outputs_hooked[H1] = true; return m_outputs[H1].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_h2_callback(Object &&cb) { m_outputs_hooked[H2] = true; return m_outputs[H2].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_cb_callback(Object &&cb) { m_outputs_hooked[CB] = true; return m_outputs[CB].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_cs_callback(Object &&cb) { m_outputs_hooked[CS] = true; return m_outputs[CS].set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_id_callback(Object &&cb) { m_outputs_hooked[ID] = true; return m_outputs[ID].set_callback(std::forward<Object>(cb)); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||
|
||||
private:
|
||||
devcb_write_line m_outputs[OUT_COUNT];
|
||||
bool m_outputs_hooked[OUT_COUNT];
|
||||
emu_timer *m_timers[OUT_COUNT];
|
||||
signal_type m_type;
|
||||
|
||||
attotime m_h;
|
||||
uint32_t m_line_count;
|
||||
|
||||
static const uint32_t s_line_counts[4];
|
||||
};
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(SAA1043, saa1043_device)
|
||||
|
||||
#endif // MAME_MACHINE_SAA1043_H
|
@ -52,6 +52,7 @@
|
||||
|
||||
#include "machine/i8155.h"
|
||||
#include "machine/i8255.h"
|
||||
#include "machine/saa1043.h"
|
||||
#include "video/mb88303.h"
|
||||
|
||||
class vp415_state : public driver_device
|
||||
@ -89,6 +90,8 @@ public:
|
||||
DECLARE_READ8_MEMBER(drive_i8255_pc_r);
|
||||
DECLARE_WRITE8_MEMBER(drive_cpu_port1_w);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(refv_w);
|
||||
|
||||
static const char* Z80CPU_TAG;
|
||||
static const char* Z80RAM_TAG;
|
||||
static const char* CTRLCPU_TAG;
|
||||
@ -102,6 +105,7 @@ public:
|
||||
static const char* I8155_TAG;
|
||||
static const char* I8255_TAG;
|
||||
static const char* CHARGEN_TAG;
|
||||
static const char* SYNCGEN_TAG;
|
||||
|
||||
protected:
|
||||
enum
|
||||
@ -184,6 +188,27 @@ protected:
|
||||
CTRL_PARITY_BIT = 2,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
I8255PB_COMM1 = 0x01,
|
||||
I8255PB_COMM2 = 0x02,
|
||||
I8255PB_COMM3 = 0x04,
|
||||
I8255PB_COMM4 = 0x08,
|
||||
I8255PB_RLS_N = 0x10,
|
||||
I8255PB_SL_PWR = 0x20,
|
||||
I8255PB_RAD_FS_N = 0x40,
|
||||
I8255PB_STR1 = 0x80,
|
||||
|
||||
I8255PB_COMM1_BIT = 0,
|
||||
I8255PB_COMM2_BIT = 1,
|
||||
I8255PB_COMM3_BIT = 2,
|
||||
I8255PB_COMM4_BIT = 3,
|
||||
I8255PB_RLS_N_BIT = 4,
|
||||
I8255PB_SL_PWR_BIT = 5,
|
||||
I8255PB_RAD_FS_N_BIT = 6,
|
||||
I8255PB_STR1_BIT = 7,
|
||||
};
|
||||
|
||||
virtual void video_start() override;
|
||||
|
||||
void z80_program_map(address_map &map);
|
||||
@ -214,6 +239,8 @@ protected:
|
||||
uint8_t m_aux_status_reg;
|
||||
uint8_t m_diag_status_reg;
|
||||
uint8_t m_intn_lines[2];
|
||||
|
||||
uint8_t m_refv;
|
||||
};
|
||||
|
||||
/*static*/ const char* vp415_state::Z80CPU_TAG = "z80cpu";
|
||||
@ -229,6 +256,7 @@ protected:
|
||||
/*static*/ const char* vp415_state::I8155_TAG = "i8155";
|
||||
/*static*/ const char* vp415_state::I8255_TAG = "i8255";
|
||||
/*static*/ const char* vp415_state::CHARGEN_TAG = "mb88303";
|
||||
/*static*/ const char* vp415_state::SYNCGEN_TAG = "saa1043";
|
||||
|
||||
void vp415_state::machine_reset()
|
||||
{
|
||||
@ -248,6 +276,12 @@ void vp415_state::machine_start()
|
||||
{
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(vp415_state::refv_w)
|
||||
{
|
||||
m_refv = state;
|
||||
m_drivecpu->set_input_line(MCS51_INT0_LINE, m_refv ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
// CPU Datagrabber Module (W)
|
||||
|
||||
WRITE8_MEMBER(vp415_state::ncr5385_w)
|
||||
@ -475,7 +509,16 @@ WRITE8_MEMBER(vp415_state::drive_i8255_pa_w)
|
||||
|
||||
WRITE8_MEMBER(vp415_state::drive_i8255_pb_w)
|
||||
{
|
||||
logerror("%s: drive_i8255_pb_w: %02x\n", machine().describe_context(), data);
|
||||
logerror("%s: drive_i8255_pb_w: COMM-1:%d, COMM-2:%d, COMM-3:%d, COMM-4:%d, /RLS:%d, SL-PWR:%d, /RAD-FS:%d, STR1:%d\n"
|
||||
, machine().describe_context()
|
||||
, BIT(data, I8255PB_COMM1_BIT)
|
||||
, BIT(data, I8255PB_COMM2_BIT)
|
||||
, BIT(data, I8255PB_COMM3_BIT)
|
||||
, BIT(data, I8255PB_COMM4_BIT)
|
||||
, BIT(data, I8255PB_RLS_N_BIT)
|
||||
, BIT(data, I8255PB_SL_PWR_BIT)
|
||||
, BIT(data, I8255PB_RAD_FS_N_BIT)
|
||||
, BIT(data, I8255PB_STR1_BIT));
|
||||
}
|
||||
|
||||
READ8_MEMBER(vp415_state::drive_i8255_pc_r)
|
||||
@ -561,6 +604,9 @@ MACHINE_CONFIG_START(vp415_state::vp415)
|
||||
|
||||
MCFG_DEVICE_ADD(CHARGEN_TAG, MB88303, 0)
|
||||
|
||||
MCFG_DEVICE_ADD(SYNCGEN_TAG, SAA1043, XTAL(5'000'000))
|
||||
MCFG_SAA1043_V2_CALLBACK(WRITELINE(vp415_state, refv_w))
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(50)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
|
||||
|
Loading…
Reference in New Issue
Block a user