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

    Commodore PET 64KB RAM Expansion emulation

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

#ifndef MAME_BUS_PET_64K_H
#define MAME_BUS_PET_64K_H

#pragma once

#include "exp.h"



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

// ======================> pet_64k_expansion_device

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

protected:
	// device-level overrides
	virtual void device_start() override;
	virtual void device_reset() override;

	// device_pet_expansion_card_interface overrides
	virtual int pet_norom_r(offs_t offset, int sel) override;
	virtual uint8_t pet_bd_r(offs_t offset, uint8_t data, int &sel) override;
	virtual void pet_bd_w(offs_t offset, uint8_t data, int &sel) override;

private:
	inline uint8_t read_ram(offs_t offset);
	inline void write_ram(offs_t offset, uint8_t data);

	optional_shared_ptr<uint8_t> m_ram;

	uint8_t m_ctrl;
};


// device type definition
DECLARE_DEVICE_TYPE(PET_64K, pet_64k_expansion_device)

#endif // MAME_BUS_PET_64K_H