summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices
diff options
context:
space:
mode:
author angelosa <salese_corp_ltd@email.it>2016-06-14 20:53:51 +0200
committer angelosa <salese_corp_ltd@email.it>2016-06-14 20:53:51 +0200
commit6a4015e14dff8a43cc4a620fc0110a4137e5edf8 (patch)
tree295e47b760238d78146076f7e13bbbdd60017676 /src/devices
parent3c030752cf3feebf7c50e15bb47bf16aa9ac1960 (diff)
LDP-1000A checkpoint (nw)
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/machine/ldp1000.cpp85
-rw-r--r--src/devices/machine/ldp1000.h33
2 files changed, 110 insertions, 8 deletions
diff --git a/src/devices/machine/ldp1000.cpp b/src/devices/machine/ldp1000.cpp
index 922f3c2b63e..415a4581097 100644
--- a/src/devices/machine/ldp1000.cpp
+++ b/src/devices/machine/ldp1000.cpp
@@ -5,14 +5,16 @@
Sony LDP-1000 laserdisc emulation.
TODO:
- - Dump BIOSes (seven of them according to docs)
- - Hookup with Sony SMC-70 / SMC-777
+ - Dump BIOSes (seven of them according to docs);
+ - Serial interface, needs BIOS dump;
+ - Hookup with Sony SMC-70 / SMC-777;
***************************************************************************/
#include "emu.h"
#include "machine/ldp1000.h"
+#define DUMP_BCD 1
ROM_START( ldp1000 )
ROM_REGION( 0x2000, "ldp1000", 0 )
@@ -110,11 +112,84 @@ INT32 sony_ldp1000_device::player_update(const vbi_metadata &vbi, int fieldnum,
// READ/WRITE HANDLERS
//**************************************************************************
-READ8_MEMBER( sony_ldp1000_device::read )
+READ8_MEMBER( sony_ldp1000_device::status_r )
{
- return 0;
+ UINT8 res = m_status;
+ m_status = stat_undef;
+ return res;
}
-WRITE8_MEMBER( sony_ldp1000_device::write )
+void sony_ldp1000_device::set_new_player_state(ldp1000_player_state which, UINT8 fifo_size)
{
+ m_player_state = which;
+ m_index_state = 0;
+ m_index_size = fifo_size;
+ printf("set new player state\n");
+}
+
+// TODO: probably don't even need a size ...
+void sony_ldp1000_device::set_new_player_bcd(UINT8 data)
+{
+ m_internal_bcd[m_index_state] = data;
+ m_index_state ++;
+ if(m_index_state >= m_index_size)
+ {
+ #if DUMP_BCD
+ for(int i=0;i<m_index_size;i++)
+ printf("%02x ",m_internal_bcd[i]);
+
+ printf("[size = %02x]\n",m_index_size);
+ #endif
+ m_status = stat_ack;
+ }
+ else
+ m_status = stat_ack;
+}
+
+
+// TODO: de-instantize this
+WRITE8_MEMBER( sony_ldp1000_device::command_w )
+{
+ printf("CMD %02x\n",data);
+ // 0x30 to 0x69 range causes an ACK, anything else is invalid
+ m_command = data;
+
+ if((m_command & 0xf0) == 0x30)
+ {
+ set_new_player_bcd(data);
+ return;
+ }
+
+ switch(m_command)
+ {
+ case 0x40: // enter bcd command, todo
+ break;
+
+ case 0x43: // search
+ set_new_player_state(player_search,5);
+ m_status = stat_ack;
+ break;
+
+ /*
+ audio channels absolute enable / disable
+ ---- --x- select channel
+ ---- ---x enable channel (active low)
+ */
+ case 0x46:
+ case 0x47:
+ case 0x48:
+ case 0x49:
+ m_audio_enable[(m_command & 2) >> 1] = (m_command & 1) == 0;
+ m_status = stat_ack;
+ break;
+
+ case 0x56: // Clear All
+ m_status = stat_ack;
+ // reset any pending operation here
+ break;
+
+ default:
+ m_status = stat_undef;
+ break;
+ }
}
diff --git a/src/devices/machine/ldp1000.h b/src/devices/machine/ldp1000.h
index ee7acc789bf..b7cf9cbeea4 100644
--- a/src/devices/machine/ldp1000.h
+++ b/src/devices/machine/ldp1000.h
@@ -36,9 +36,9 @@ public:
// construction/destruction
sony_ldp1000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- // I/O operations
- DECLARE_WRITE8_MEMBER( write );
- DECLARE_READ8_MEMBER( read );
+ // I/O operations TODO: both actually protected
+ DECLARE_WRITE8_MEMBER( command_w );
+ DECLARE_READ8_MEMBER( status_r );
protected:
// device-level overrides
@@ -51,6 +51,33 @@ protected:
virtual INT32 player_update(const vbi_metadata &vbi, int fieldnum, const attotime &curtime) override;
virtual void player_overlay(bitmap_yuy16 &bitmap) override { }
+ enum ldp1000_status {
+ stat_undef = 0x00,
+ stat_completion = 0x01,
+ stat_error = 0x02,
+ stat_pgm_end = 0x04,
+ stat_not_target = 0x05,
+ stat_no_frame = 0x06,
+ stat_ack = 0x0a,
+ stat_nak = 0x0b
+ };
+
+ enum ldp1000_player_state {
+ player_standby = 0,
+ player_search
+ };
+
+private:
+ UINT8 m_command;
+ ldp1000_status m_status;
+ ldp1000_player_state m_player_state;
+ bool m_audio_enable[2];
+ // TODO: sub-class
+ void set_new_player_state(ldp1000_player_state which, UINT8 fifo_size);
+ void set_new_player_bcd(UINT8 data);
+ UINT8 m_internal_bcd[0x10];
+ UINT8 m_index_state;
+ UINT8 m_index_size;
};