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
100
101
102
103
104
105
106
107
|
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/***************************************************************************
coco12.cpp
TRS-80 Radio Shack Color Computer 1/2 Family
***************************************************************************/
#include "emu.h"
#include "includes/coco12.h"
//-------------------------------------------------
// device_start
//-------------------------------------------------
void coco12_state::device_start()
{
coco_state::device_start();
configure_sam();
}
//-------------------------------------------------
// configure_sam
//-------------------------------------------------
void coco12_state::configure_sam()
{
uint8_t *rom = memregion(MAINCPU_TAG)->base();
m_sam->configure_bank(0, ram().pointer(), ram().size(), false); // $0000-$7FFF
m_sam->configure_bank(1, &rom[0x0000], 0x2000, true); // $8000-$9FFF
m_sam->configure_bank(2, &rom[0x2000], 0x2000, true); // $A000-$BFFF
// $C000-$FEFF
m_sam->configure_bank(3, read8_delegate(*m_cococart, FUNC(cococart_slot_device::cts_read)), write8_delegate(*m_cococart, FUNC(cococart_slot_device::cts_write)));
// $FF00-$FF1F
m_sam->configure_bank(4, read8_delegate(*this, FUNC(coco12_state::ff00_read)), write8_delegate(*this, FUNC(coco12_state::ff00_write)));
// $FF20-$FF3F
m_sam->configure_bank(5, read8_delegate(*this, FUNC(coco12_state::ff20_read)), write8_delegate(*this, FUNC(coco12_state::ff20_write)));
// $FF40-$FF5F
m_sam->configure_bank(6, read8_delegate(*this, FUNC(coco12_state::ff40_read)), write8_delegate(*this, FUNC(coco12_state::ff40_write)));
// $FF60-$FFBF
m_sam->configure_bank(7, read8_delegate(*this, FUNC(coco12_state::ff60_read)), write8_delegate(*this, FUNC(coco12_state::ff60_write)));
}
//-------------------------------------------------
// horizontal_sync
//-------------------------------------------------
WRITE_LINE_MEMBER( coco12_state::horizontal_sync )
{
pia_0().ca1_w(state);
m_sam->hs_w(state);
}
//-------------------------------------------------
// field_sync
//-------------------------------------------------
WRITE_LINE_MEMBER( coco12_state::field_sync )
{
pia_0().cb1_w(state);
}
//-------------------------------------------------
// sam_read
//-------------------------------------------------
READ8_MEMBER( coco12_state::sam_read )
{
uint8_t data = ram().read(offset);
m_vdg->as_w(data & 0x80 ? ASSERT_LINE : CLEAR_LINE);
m_vdg->inv_w(data & 0x40 ? ASSERT_LINE : CLEAR_LINE);
return data;
}
//-------------------------------------------------
// pia1_pb_changed
//-------------------------------------------------
void coco12_state::pia1_pb_changed(uint8_t data)
{
/* call inherited function */
coco_state::pia1_pb_changed(data);
m_vdg->css_w(data & 0x08);
m_vdg->intext_w(data & 0x10);
m_vdg->gm0_w(data & 0x10);
m_vdg->gm1_w(data & 0x20);
m_vdg->gm2_w(data & 0x40);
m_vdg->ag_w(data & 0x80);
}
|