summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/bus/ti99_peb/hsgpl.h
blob: a662b69c8e2443fa438777c10de1b33d07eb8169 (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
// license:LGPL-2.1+
// copyright-holders:Michael Zapf
/****************************************************************************

    SNUG HSGPL card emulation.
    See hsgpl.c for documentation

    Raphael Nabet, 2003.

    Michael Zapf
    October 2010: Rewritten as device
    February 2012: Rewritten as class

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

#ifndef __HSGPL__
#define __HSGPL__

#include "emu.h"
#include "peribox.h"
#include "machine/at29040a.h"

extern const device_type TI99_HSGPL;

class snug_high_speed_gpl_device : public ti_expansion_card_device
{
public:
	snug_high_speed_gpl_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	DECLARE_READ8Z_MEMBER(readz);
	DECLARE_WRITE8_MEMBER(write);

	DECLARE_READ8Z_MEMBER(crureadz);
	DECLARE_WRITE8_MEMBER(cruwrite);

protected:
	virtual void device_start(void);
	virtual void device_reset(void);
	virtual void device_stop(void);
	virtual void device_config_complete(void);
	virtual ioport_constructor device_input_ports() const;

	virtual machine_config_constructor device_mconfig_additions() const;

private:
	at29040a_device* m_dsr_eeprom;
	at29040a_device* m_rom6_eeprom;
	at29040a_device* m_grom_a_eeprom;
	at29040a_device* m_grom_b_eeprom;

	UINT8*          m_ram6_memory;
	UINT8*          m_gram_memory;

	void            dsrspace_readz(address_space& space, offs_t offset, UINT8* value, UINT8 mem_mask);
	void            cartspace_readz(address_space& space, offs_t offset, UINT8* value, UINT8 mem_mask);
	void            grom_readz(address_space& space, offs_t offset, UINT8* value, UINT8 mem_mask);

	void            cartspace_write(address_space& space, offs_t offset, UINT8 data, UINT8 mem_mask);
	void            grom_write(address_space& space, offs_t offset, UINT8 data, UINT8 mem_mask);

	bool            m_dsr_enabled;
	bool            m_gram_enabled;
	bool            m_bank_inhibit;
	int             m_dsr_page;
	bool            m_card_enabled;
	bool            m_write_enabled;
	bool            m_supercart_enabled;
	bool            m_led_on;
	bool            m_mbx_enabled;
	bool            m_ram_enabled;
	bool            m_flash_mode;

	int             m_current_grom_port;
	int             m_current_bank;

	int             m_module_bank;

	// GROM emulation
	bool            m_waddr_LSB;
	bool            m_raddr_LSB;
	int             m_grom_address;
};

#endif