summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/bbc/1mhzbus/sprite.cpp
blob: ee7f5f292e7415f3a197ca7d6931b19e9618e464 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************

    Logotron Sprite Board

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


#include "emu.h"
#include "sprite.h"
#include "screen.h"


//**************************************************************************
//  DEVICE DEFINITIONS
//**************************************************************************

DEFINE_DEVICE_TYPE(BBC_SPRITE, bbc_sprite_device, "bbc_sprite", "Logotron Sprite Board");


//-------------------------------------------------
//  device_add_mconfig - add device configuration
//-------------------------------------------------

void bbc_sprite_device::device_add_mconfig(machine_config &config)
{
	TMS9129(config, m_vdp, 10.738635_MHz_XTAL);
	m_vdp->int_callback().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::irq_w));
	m_vdp->set_screen("screen");
	m_vdp->set_vram_size(0x4000);

	SCREEN(config, "screen", SCREEN_TYPE_RASTER);
}

//**************************************************************************
//  LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
//  bbc_sprite_device - constructor
//-------------------------------------------------

bbc_sprite_device::bbc_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: device_t(mconfig, BBC_SPRITE, tag, owner, clock)
	, device_bbc_1mhzbus_interface(mconfig, *this)
	, m_vdp(*this, "vdp")
{
}

//-------------------------------------------------
//  device_start - device-specific startup
//-------------------------------------------------

void bbc_sprite_device::device_start()
{
}

//-------------------------------------------------
//  device_reset - device-specific reset
//-------------------------------------------------

void bbc_sprite_device::device_reset()
{
}


//**************************************************************************
//  IMPLEMENTATION
//**************************************************************************

uint8_t bbc_sprite_device::fred_r(offs_t offset)
{
	uint8_t data = 0xff;

	switch (offset)
	{
	case 0xa0:
		data = m_vdp->vram_read();
		break;
	case 0xa2:
		data = m_vdp->register_read();
		break;
	}
	return data;
}

void bbc_sprite_device::fred_w(offs_t offset, uint8_t data)
{
	switch (offset)
	{
	case 0xa1:
		m_vdp->vram_write(data);
		break;
	case 0xa3:
		m_vdp->register_write(data);
		break;
	}
}