From 09cbc1ef087fa2c9cc747f3d24179dcf00bba512 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Tue, 3 May 2011 19:26:59 +0000 Subject: [PATCH] naomi: Add jvs command 0x32, crazy taxi starts ! [O. Galibert] --- src/emu/machine/jvsdev.c | 12 ++++++++++++ src/emu/machine/jvsdev.h | 4 +++- src/mame/machine/jvs13551.c | 10 ++++++++++ src/mame/machine/jvs13551.h | 1 + 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/emu/machine/jvsdev.c b/src/emu/machine/jvsdev.c index 830ecda8571..2137d7b0315 100644 --- a/src/emu/machine/jvsdev.c +++ b/src/emu/machine/jvsdev.c @@ -73,6 +73,7 @@ void jvs_device::message(UINT8 dest, const UINT8 *send_buffer, UINT32 send_size, } else if(len == 0) { // Incorrect parameter *d++ = 0x02; + break; } else s += len; } @@ -149,6 +150,12 @@ int jvs_device::handle_message(const UINT8 *send_buffer, UINT32 send_size, UINT8 *recv_buffer++ = 0x01; return analogs(recv_buffer, send_buffer[1]) ? 2 : 0; + case 0x32: + if(send_size < 2 || send_size < 2+send_buffer[1]) + return 0; + *recv_buffer++ = 0x01; + return swoutputs(send_buffer[1], send_buffer+2) ? 2+send_buffer[1] : 0; + case 0x38: if(send_size < 3) return 0; @@ -205,6 +212,11 @@ bool jvs_device::analogs(UINT8 *&buf, UINT8 count) return false; } +bool jvs_device::swoutputs(UINT8 count, const UINT8 *vals) +{ + return false; +} + bool jvs_device::swoutputs(UINT8 id, UINT8 val) { return false; diff --git a/src/emu/machine/jvsdev.h b/src/emu/machine/jvsdev.h index 1fad6342998..bc175e8065e 100644 --- a/src/emu/machine/jvsdev.h +++ b/src/emu/machine/jvsdev.h @@ -20,6 +20,8 @@ public: bool get_address_set_line(); protected: + UINT32 jvs_outputs; + void handle_output(const char *tag, UINT8 id, UINT8 val); // device-level overrides @@ -35,6 +37,7 @@ protected: virtual bool switches(UINT8 *&buf, UINT8 count_players, UINT8 bytes_per_switch); virtual bool coin_counters(UINT8 *&buf, UINT8 count); virtual bool analogs(UINT8 *&buf, UINT8 count); + virtual bool swoutputs(UINT8 count, const UINT8 *vals); virtual bool swoutputs(UINT8 id, UINT8 val); private: @@ -42,7 +45,6 @@ private: jvs_device *next_device; UINT8 jvs_address; UINT32 jvs_reset_counter; - UINT32 jvs_outputs; int handle_message(const UINT8 *send_buffer, UINT32 send_size, UINT8 *&recv_buffer); }; diff --git a/src/mame/machine/jvs13551.c b/src/mame/machine/jvs13551.c index 6b320749e5f..83b18fd24c0 100644 --- a/src/mame/machine/jvs13551.c +++ b/src/mame/machine/jvs13551.c @@ -132,6 +132,16 @@ bool sega_837_13551::analogs(UINT8 *&buf, UINT8 count) return true; } +bool sega_837_13551::swoutputs(UINT8 count, const UINT8 *vals) +{ + if(count > 1) + return false; + jvs_outputs = vals[0] & 0x3f; + logerror("837-13551: output %02x\n", jvs_outputs); + input_port_write_safe(machine(), port_tag[11], jvs_outputs, 0x3f); + return true; +} + bool sega_837_13551::swoutputs(UINT8 id, UINT8 val) { if(id > 6) diff --git a/src/mame/machine/jvs13551.h b/src/mame/machine/jvs13551.h index 78bca33e5a4..373b057a690 100644 --- a/src/mame/machine/jvs13551.h +++ b/src/mame/machine/jvs13551.h @@ -44,6 +44,7 @@ protected: virtual bool switches(UINT8 *&buf, UINT8 count_players, UINT8 bytes_per_switch); virtual bool coin_counters(UINT8 *&buf, UINT8 count); virtual bool analogs(UINT8 *&buf, UINT8 count); + virtual bool swoutputs(UINT8 count, const UINT8 *vals); virtual bool swoutputs(UINT8 id, UINT8 val); private: