diff options
author | 2015-01-28 14:51:36 +0100 | |
---|---|---|
committer | 2015-01-28 14:51:36 +0100 | |
commit | 8027024f696d28344d186b05cda7f77ab94d788f (patch) | |
tree | 9e242aa57b9e1a6bbbe73074ba7db019397f7ffa /src | |
parent | 36c188f7865b6c9b8beb4b27f002127b16633974 (diff) | |
parent | 500c8f2c4d8b6968090ba92ab8bd02ac14afd522 (diff) |
Merge pull request #120 from p1pkin/jvs
JVS host: real fix for "CRC errors"
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/machine/jvshost.c | 22 | ||||
-rw-r--r-- | src/mame/machine/mie.c | 18 | ||||
-rw-r--r-- | src/mame/machine/mie.h | 2 |
3 files changed, 25 insertions, 17 deletions
diff --git a/src/emu/machine/jvshost.c b/src/emu/machine/jvshost.c index dd3bf50d22f..c406afff250 100644 --- a/src/emu/machine/jvshost.c +++ b/src/emu/machine/jvshost.c @@ -48,17 +48,13 @@ void jvs_host::commit_raw() // - have the message length without the two header bytes but with the checksum byte in the second byte // - have at least one command byte if(send_size < 3 || send_buffer[0] == 0x00 || send_buffer[1] != send_size-1) { - logerror("JVS checksum error\n"); - } /* - Naomi suchie3 have bad working controls with this - - // "This message is crap" doesn't exist so call it checksum error - recv_buffer[0] = 0x00; - recv_buffer[1] = 0x02; - recv_buffer[2] = 0x03; - recv_size = 3; - - } else */ { + logerror("JVS checksum error\n"); + // "This message is crap" doesn't exist so call it checksum error + recv_buffer[0] = 0x00; + recv_buffer[1] = 0x02; + recv_buffer[2] = 0x03; + recv_size = 3; + } else { if(first_device) { first_device->message(send_buffer[0], send_buffer+2, send_size-2, recv_buffer+2, recv_size); recv_is_encoded = false; @@ -146,7 +142,7 @@ void jvs_host::decode(UINT8 *buffer, UINT32 &size) if(!size) return; UINT32 pos = 0; - for(UINT32 i=0; i<size-1; i++) { + for(UINT32 i=0; i<size; i++) { UINT8 t = buffer[i]; if(!i && t == 0xe0) continue; @@ -156,5 +152,5 @@ void jvs_host::decode(UINT8 *buffer, UINT32 &size) } buffer[pos++] = t; } - size = pos; + size = pos ? pos - 1 : 0; } diff --git a/src/mame/machine/mie.c b/src/mame/machine/mie.c index 8ae32c24d3d..45cc56b2cd7 100644 --- a/src/mame/machine/mie.c +++ b/src/mame/machine/mie.c @@ -33,8 +33,9 @@ static ADDRESS_MAP_START( mie_port, AS_IO, 8, mie_device) AM_RANGE(0x00, 0x07) AM_READWRITE(gpio_r, gpio_w) AM_RANGE(0x08, 0x08) AM_READWRITE(gpiodir_r, gpiodir_w) AM_RANGE(0x0f, 0x0f) AM_READWRITE(adc_r, adc_w) - AM_RANGE(0x10, 0x10) AM_READWRITE(jvs_r, jvs_w) + AM_RANGE(0x10, 0x10) AM_READWRITE(jvs_r, jvs_w) // ports 1x and 2x is standard UARTs, TODO handle it properly AM_RANGE(0x12, 0x12) AM_WRITE(jvs_dest_w) + AM_RANGE(0x13, 0x13) AM_WRITE(jvs_lcr_w) AM_RANGE(0x15, 0x15) AM_READ(jvs_status_r) AM_RANGE(0x30, 0x30) AM_READWRITE(irq_enable_r, irq_enable_w) AM_RANGE(0x50, 0x50) AM_READWRITE(maple_irqlevel_r, maple_irqlevel_w) @@ -319,6 +320,9 @@ WRITE8_MEMBER(mie_device::lreg_w) READ8_MEMBER(mie_device::jvs_r) { + if (jvs_lcr & 0x80) + return 0; + const UINT8 *buf; UINT32 size; jvs->get_encoded_reply(buf, size); @@ -329,9 +333,10 @@ READ8_MEMBER(mie_device::jvs_r) WRITE8_MEMBER(mie_device::jvs_w) { - // Hack until the ports are better understood - if(jvs_dest == 2) - jvs->push(data); + if (jvs_lcr & 0x80) + return; + + jvs->push(data); } WRITE8_MEMBER(mie_device::jvs_dest_w) @@ -359,6 +364,11 @@ WRITE8_MEMBER(mie_device::jvs_control_w) jvs_control = data; } +WRITE8_MEMBER(mie_device::jvs_lcr_w) +{ + jvs_lcr = data; +} + READ8_MEMBER(mie_device::jvs_sense_r) { return 0x8c | (jvs->get_address_set_line() ? 2 : 0) | (jvs->get_presence_line() ? 0 : 1); diff --git a/src/mame/machine/mie.h b/src/mame/machine/mie.h index 7924afbbc1c..babe47ad830 100644 --- a/src/mame/machine/mie.h +++ b/src/mame/machine/mie.h @@ -61,6 +61,7 @@ public: DECLARE_READ8_MEMBER(jvs_status_r); DECLARE_WRITE8_MEMBER(jvs_control_w); DECLARE_READ8_MEMBER(jvs_sense_r); + DECLARE_WRITE8_MEMBER(jvs_lcr_w); DECLARE_READ8_MEMBER(read_ff); DECLARE_READ8_MEMBER(read_00); @@ -106,6 +107,7 @@ private: UINT8 gpiodir, gpio_val[8]; UINT8 irq_enable, irq_pending, maple_irqlevel; UINT8 jvs_control, jvs_dest; + UINT8 jvs_lcr; void raise_irq(int level); void recalc_irq(); |