summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/coco/dragon_amtor.cpp
blob: 5eff8fd28425fb62aea04bde31141c6d654effa2 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/***************************************************************************

    BMKAX25/AMTOR for G6WHK

    (c) 1990 Grosvenor Software

     Left: AX25  EXEC 49152
    Right: AMTOR EXEC 49152

    Cartridge contains a single 32K ROM and a switch to select either AX25
    or AMTOR, each taking 16K.

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

#include "emu.h"
#include "dragon_amtor.h"


//-------------------------------------------------
//  ROM( amtor )
//-------------------------------------------------

ROM_START( amtor )
	ROM_REGION(0x8000, "eprom", ROMREGION_ERASE00)
	// this region is filled by cococart_slot_device::call_load()
ROM_END

//**************************************************************************
//  GLOBAL VARIABLES
//**************************************************************************

DEFINE_DEVICE_TYPE(DRAGON_AMTOR, dragon_amtor_device, "dragon_amtor", "Dragon Amtor Cartridge")

//-------------------------------------------------
//  INPUT_PORTS( amtor )
//-------------------------------------------------

static INPUT_PORTS_START( amtor )
	PORT_START("SWITCH")
	PORT_CONFNAME( 0x01, 0x00, "Switch" )
	PORT_CONFSETTING(    0x00, "AMTOR")
	PORT_CONFSETTING(    0x01, "AX25")
INPUT_PORTS_END


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

//-------------------------------------------------
//  dragon_amtor_device - constructor
//-------------------------------------------------

dragon_amtor_device::dragon_amtor_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock)
	: device_t(mconfig, DRAGON_AMTOR, tag, owner, clock)
	, device_cococart_interface(mconfig, *this)
	, m_eprom(*this, "eprom")
	, m_switch(*this, "SWITCH")
{
}

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

void dragon_amtor_device::device_start()
{
}


//-------------------------------------------------
//  input_ports - device-specific input ports
//-------------------------------------------------

ioport_constructor dragon_amtor_device::device_input_ports() const
{
	return INPUT_PORTS_NAME( amtor );
}

//-------------------------------------------------
//  rom_region - device-specific ROM region
//-------------------------------------------------

const tiny_rom_entry *dragon_amtor_device::device_rom_region() const
{
	return ROM_NAME( amtor );
}


//-------------------------------------------------
//  dragon_amtor_device::get_cart_base
//-------------------------------------------------

u8 *dragon_amtor_device::get_cart_base()
{
	return m_eprom->base();
}

//-------------------------------------------------
//  dragon_amtor_device::get_cart_memregion
//-------------------------------------------------

memory_region *dragon_amtor_device::get_cart_memregion()
{
	return m_eprom;
}

//-------------------------------------------------
//  cts_read
//-------------------------------------------------

u8 dragon_amtor_device::cts_read(offs_t offset)
{
	offset = bitswap<16>(offset, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 0, 1);

	return bitswap<8>(m_eprom->base()[(m_switch->read() << 14) | offset], 3, 2, 1, 0, 7, 6, 5, 4 );
}