mirror of
https://github.com/holub/mame
synced 2025-06-25 22:04:15 +03:00
Merge pull request #120 from p1pkin/jvs
JVS host: real fix for "CRC errors"
This commit is contained in:
commit
8027024f69
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user