summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/ldp1000.h
blob: 1f3140f14e8046e67295c322508c7de266a1a386 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// license:BSD-3-Clause
// copyright-holders:Angelo Salese
/***************************************************************************

    Sony LDP-1000 laserdisc emulation.

***************************************************************************/

#ifndef MAME_MACHINE_LDP1000_H
#define MAME_MACHINE_LDP1000_H

#pragma once

#include "laserdsc.h"


//**************************************************************************
//  INTERFACE CONFIGURATION MACROS
//**************************************************************************

#define MCFG_LASERDISC_LDP1000_ADD(_tag) \
	MCFG_DEVICE_ADD(_tag, SONY_LDP1000, 0)

//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

// device type definition
DECLARE_DEVICE_TYPE(SONY_LDP1000, sony_ldp1000_device)

// ======================> sony_ldp1000_device

class sony_ldp1000_device : public laserdisc_device
{
public:
	// construction/destruction
	sony_ldp1000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	// I/O operations TODO: both actually protected
	DECLARE_WRITE8_MEMBER( command_w );
	DECLARE_READ8_MEMBER( status_r );

protected:
	// device-level overrides
	virtual void device_validity_check(validity_checker &valid) const override;
	virtual void device_start() override;
	virtual void device_reset() override;
	virtual const tiny_rom_entry *device_rom_region() const override;

	virtual void player_vsync(const vbi_metadata &vbi, int fieldnum, const attotime &curtime) override;
	virtual int32_t 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_t m_command;
	ldp1000_status m_status;
	ldp1000_player_state m_player_state;
	bool m_audio_enable[2];
	// TODO: sub-class into a specific internal player state
	void set_new_player_state(ldp1000_player_state which);
	void set_new_player_bcd(uint8_t data);
	uint32_t bcd_to_raw();
	void exec_enter_cmd();
	uint8_t m_internal_bcd[0x10];
	uint8_t m_index_state;

};

#endif // MAME_MACHINE_LDP1000_H