summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/sg1000_exp/sk1100.h
blob: e48c47745cbf954f41eff5f29040c42cb1fe91be (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
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************

    Sega SK-1100 keyboard emulation

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

#ifndef MAME_BUS_SG1000_EXP_SK1100_H
#define MAME_BUS_SG1000_EXP_SK1100_H

#pragma once


#include "sg1000exp.h"
#include "sk1100prn.h"
#include "formats/sc3000_bit.h"
#include "imagedev/cassette.h"
#include "machine/i8255.h"


#define UPD9255_0_TAG   "upd9255_0" // "upd9255_1" is being used by the SF-7000 driver


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

// ======================> sega_sk1100_device

class sega_sk1100_device : public device_t,
							public device_sg1000_expansion_slot_interface
{
public:
	// construction/destruction
	sega_sk1100_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);

	// optional information overrides
	virtual ioport_constructor device_input_ports() const override;

protected:
	// device-level overrides
	virtual void device_start() override;
	virtual void device_add_mconfig(machine_config &config) override;

	// device_sg1000_expansion_slot_interface overrides
	virtual uint8_t peripheral_r(offs_t offset) override;
	virtual void peripheral_w(offs_t offset, uint8_t data) override;
	virtual bool is_readable(uint8_t offset) override;

private:
	uint8_t ppi_pa_r();
	uint8_t ppi_pb_r();
	void ppi_pc_w(uint8_t data);

	required_device<cassette_image_device> m_cassette;
	required_device<i8255_device> m_ppi;
	required_device<sk1100_printer_port_device> m_printer_port;
	required_ioport_array<8> m_pa;
	required_ioport_array<8> m_pb;

	/* keyboard state */
	uint8_t m_keylatch;
};


// device type definition
DECLARE_DEVICE_TYPE(SEGA_SK1100, sega_sk1100_device)


#endif // MAME_BUS_SG1000_EXP_SK1100_H