summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ariane Fugmann <sailorsat@t-online.de>2016-12-02 10:58:20 +0100
committer Vas Crabb <cuavas@users.noreply.github.com>2016-12-02 20:58:20 +1100
commit28978a4357b00c0b30a4fed3b2d9e69a4c8904ba (patch)
treee4c4ab64b185efbaf3f5da803dec92ba529e2595
parente44ca0abe691d2407d73868ddd8ca83e0ec59539 (diff)
M1COMM/M2COMM cleanups (#1789)
* M1COMM: code cleanup (nw) * M2COMM: code cleanup (nw)
-rw-r--r--src/mame/machine/m1comm.cpp12
-rw-r--r--src/mame/machine/m1comm.h12
-rw-r--r--src/mame/machine/m2comm.cpp44
-rw-r--r--src/mame/machine/m2comm.h18
4 files changed, 43 insertions, 43 deletions
diff --git a/src/mame/machine/m1comm.cpp b/src/mame/machine/m1comm.cpp
index 73ff3147ba8..be789852184 100644
--- a/src/mame/machine/m1comm.cpp
+++ b/src/mame/machine/m1comm.cpp
@@ -65,7 +65,7 @@ Notes:
static ADDRESS_MAP_START( m1comm_mem, AS_PROGRAM, 8, m1comm_device )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x9fff) AM_RAM
- AM_RANGE(0xC000, 0xffff) AM_READWRITE(share_r, share_w)
+ AM_RANGE(0xc000, 0xffff) AM_READWRITE(share_r, share_w)
ADDRESS_MAP_END
/*************************************
@@ -73,11 +73,11 @@ ADDRESS_MAP_END
*************************************/
static ADDRESS_MAP_START( m1comm_io, AS_IO, 8, m1comm_device )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x1F) AM_READWRITE(dlc_reg_r, dlc_reg_w)
- AM_RANGE(0x20, 0x2F) AM_READWRITE(dma_reg_r, dma_reg_w)
+ AM_RANGE(0x00, 0x1f) AM_READWRITE(dlc_reg_r, dlc_reg_w)
+ AM_RANGE(0x20, 0x2f) AM_READWRITE(dma_reg_r, dma_reg_w)
AM_RANGE(0x40, 0x40) AM_READWRITE(syn_r, syn_w)
AM_RANGE(0x60, 0x60) AM_READWRITE(zfg_r, zfg_w)
- AM_RANGE(0xFF, 0xFF) AM_RAM
+ AM_RANGE(0xff, 0xff) AM_RAM
ADDRESS_MAP_END
MACHINE_CONFIG_FRAGMENT( m1comm )
@@ -173,7 +173,7 @@ READ8_MEMBER(m1comm_device::dlc_reg_r)
if (!m_cn)
{
device_reset();
- return 0xFF;
+ return 0xff;
}
// dirty hack to keep Z80 in RESET state
@@ -211,7 +211,7 @@ WRITE8_MEMBER(m1comm_device::dma_reg_w)
READ8_MEMBER(m1comm_device::syn_r)
{
- uint8_t result = m_syn | 0xFC;
+ uint8_t result = m_syn | 0xfc;
#ifdef __M1COMM_VERBOSE__
osd_printf_verbose("m1comm-syn_r: read register %02x for value %02x\n", offset, result);
#endif
diff --git a/src/mame/machine/m1comm.h b/src/mame/machine/m1comm.h
index c9adb75dc80..2321c5ebddb 100644
--- a/src/mame/machine/m1comm.h
+++ b/src/mame/machine/m1comm.h
@@ -69,13 +69,13 @@ private:
uint8_t m_shared[0x1000]; // 2x 2k = 4k; model1 accesses this with 16bit data and 11bit address (A0 to A10)
uint8_t m_dlc_reg[0x20]; // MB89374 registers
uint8_t m_dma_reg[0x20]; // MB89237A registers
- uint8_t m_syn; // bit0 is stored; purpose unknown, bit1 is used to enable/disable VINT/IRQ5
- uint8_t m_zfg; // z80 flip gate? purpose unknown, bit0 is stored
- uint8_t m_cn; // bit0 is used to enable/disable the comm board
- uint8_t m_fg; // flip gate? purpose unknown, bit0 is stored, bit7 is connected to ZFG bit 0
+ uint8_t m_syn; // bit0 is stored; purpose unknown, bit1 is used to enable/disable VINT/IRQ5
+ uint8_t m_zfg; // z80 flip gate? purpose unknown, bit0 is stored
+ uint8_t m_cn; // bit0 is used to enable/disable the comm board
+ uint8_t m_fg; // flip gate? purpose unknown, bit0 is stored, bit7 is connected to ZFG bit 0
- emu_file m_line_rx; // rx line - can be either differential, simple serial or toslink
- emu_file m_line_tx; // tx line - is differential, simple serial and toslink
+ emu_file m_line_rx; // rx line - can be either differential, simple serial or toslink
+ emu_file m_line_tx; // tx line - is differential, simple serial and toslink
char m_localhost[256];
char m_remotehost[256];
uint8_t m_buffer[0x1000];
diff --git a/src/mame/machine/m2comm.cpp b/src/mame/machine/m2comm.cpp
index f3355b0654d..8d15c93965c 100644
--- a/src/mame/machine/m2comm.cpp
+++ b/src/mame/machine/m2comm.cpp
@@ -238,7 +238,7 @@ void m2comm_device::device_reset()
READ8_MEMBER(m2comm_device::zfg_r)
{
- uint8_t result = m_zfg | 0xFE;
+ uint8_t result = m_zfg | (~m_fg << 7) | 0x7e;
#ifdef __M2COMM_VERBOSE__
osd_printf_verbose("m2comm-zfg_r: read register %02x for value %02x\n", offset, result);
#endif
@@ -272,7 +272,7 @@ WRITE8_MEMBER(m2comm_device::share_w)
READ8_MEMBER(m2comm_device::cn_r)
{
- return m_cn;
+ return m_cn | 0xfe;
}
WRITE8_MEMBER(m2comm_device::cn_w)
@@ -288,6 +288,9 @@ WRITE8_MEMBER(m2comm_device::cn_w)
// reset command
osd_printf_verbose("M2COMM: board disabled\n");
m_linkenable = 0x00;
+ m_zfg = 0;
+ m_cn = 0;
+ m_fg = 0;
}
else
{
@@ -297,9 +300,25 @@ WRITE8_MEMBER(m2comm_device::cn_w)
m_linkid = 0x00;
m_linkalive = 0x00;
m_linkcount = 0x00;
- m_linktimer = 0x00E8; // 58 fps * 4s
+ m_linktimer = 0x00e8; // 58 fps * 4s
+
+ // zero memory
+ for (int i = 0; i < 0x4000; i++)
+ {
+ m_shared[i] = 0x00;
+ }
+
+ // TODO - check EPR-16726 on Daytona USA and Sega Rally Championship
+ // EPR-18643(A) - these are accessed by VirtuaON and Sega Touring Car Championship
+
+ // frameSize - 0x0e00
+ m_shared[0x12] = 0x00;
+ m_shared[0x13] = 0x0e;
+
+ // frameOffset - 0x01c0
+ m_shared[0x14] = 0xc0;
+ m_shared[0x15] = 0x01;
- comm_init();
comm_tick();
}
#endif
@@ -307,7 +326,7 @@ WRITE8_MEMBER(m2comm_device::cn_w)
READ8_MEMBER(m2comm_device::fg_r)
{
- return m_fg | (~m_zfg << 7);
+ return m_fg | (~m_zfg << 7) | 0x7e;
}
WRITE8_MEMBER(m2comm_device::fg_w)
@@ -324,20 +343,6 @@ void m2comm_device::check_vint_irq()
}
#ifdef __M2COMM_SIMULATION__
-void m2comm_device::comm_init()
-{
- // TODO - check EPR-16726 on Daytona USA and Sega Rally Championship
- // EPR-18643(A) - these are accessed by VirtuaON and Sega Touring Car Championship
-
- // frameSize - 0xe00
- m_shared[0x12] = 0x00;
- m_shared[0x13] = 0x0e;
-
- // frameOffset - 0x1c0
- m_shared[0x14] = 0xc0;
- m_shared[0x15] = 0x01;
-}
-
void m2comm_device::comm_tick()
{
if (m_linkenable == 0x01)
@@ -465,6 +470,7 @@ void m2comm_device::comm_tick()
m_buffer[1] = 0x01;
m_buffer[2] = 0x00;
m_line_tx.write(m_buffer, dataSize);
+ m_linktimer = 0x00e8; // 58 fps * 4s
}
// send second packet
diff --git a/src/mame/machine/m2comm.h b/src/mame/machine/m2comm.h
index c525a381409..1d5b64ca0ab 100644
--- a/src/mame/machine/m2comm.h
+++ b/src/mame/machine/m2comm.h
@@ -28,7 +28,7 @@ public:
// single bit registers (74LS74)
DECLARE_READ8_MEMBER(zfg_r);
DECLARE_WRITE8_MEMBER(zfg_w);
- // shared memory 2k
+ // shared memory 16k (these are actually 2x 16k bank switched)
DECLARE_READ8_MEMBER(share_r);
DECLARE_WRITE8_MEMBER(share_w);
@@ -47,9 +47,6 @@ public:
// IRQ logic - 5 = VINT, 7 = DLC
void check_vint_irq();
-#ifdef __M2COMM_SIMULATION__
- void set_linktype(uint16_t linktype);
-#endif
protected:
// device-level overrides
@@ -58,12 +55,12 @@ protected:
private:
uint8_t m_shared[0x4000]; // 16k shared memory
- uint8_t m_zfg; // z80 flip gate? purpose unknown, bit0 is stored
- uint8_t m_cn; // bit0 is used to enable/disable the comm board
- uint8_t m_fg; // flip gate? purpose unknown, bit0 is stored, bit7 is connected to ZFG bit 0
+ uint8_t m_zfg; // z80 flip gate - bit 0 switches memory banks, bit7 is connected to FG bit 0
+ uint8_t m_cn; // bit0 is used to enable/disable the comm board
+ uint8_t m_fg; // i960 flip gate - bit0 is stored, bit7 is connected to ZFG bit 0
- emu_file m_line_rx; // rx line - can be either differential, simple serial or toslink
- emu_file m_line_tx; // tx line - is differential, simple serial and toslink
+ emu_file m_line_rx; // rx line - can be either differential, simple serial or toslink
+ emu_file m_line_tx; // tx line - is differential, simple serial and toslink
char m_localhost[256];
char m_remotehost[256];
uint8_t m_buffer[0x4000];
@@ -75,9 +72,6 @@ private:
uint8_t m_linkid;
uint8_t m_linkcount;
- uint16_t m_linktype;
-
- void comm_init();
void comm_tick();
#endif
};