summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/bus/a2bus/a2corvus.c
blob: 783e6fe70542140018585f3a801328c6cf71b01b (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*********************************************************************

    a2corvus.c

    Implementation of the Corvus flat-cable hard disk interface
    for the Apple II.

    This same card was used in the Corvus Concept.

    C0n0 = drive read/write
    C0n1 = read status (busy in bit 7, data direction in bit 6)

    Reads and writes to C0n2+ happen; the contents of the reads are thrown away
    immediately by all the code I've examined, and sending the writes to the
    drive's write port makes it not work so they're intended to be ignored too.

    5 MB: -chs 144,4,20 -ss 512
    10 MB: -chs 358,3,20 -ss 512
    20 MB: -chs 388,5,20 -ss 512

    To set up a disk from scratch on the Apple II:
    1) Create a disk of your desired capacity using CHDMAN -c none and the parameters
       listed above for each of the possible sizes.
    2) Boot apple2p with the corvus in slot 2 and a diskii(ng) in slot 6 with the
       "Corvus Hard Drive - Diagnostics.dsk" mounted.
    3) Press F to format.  Accept all the default options from now on;
       there is no "format switch" to worry about with the current emulation.
    4) Quit MESS.  Restart with the corvus in slot 6 and a diskii(ng) in slot 7
       with the "Corvus Hard Drive - Utilities 1.dsk" mounted.
    5) When you get the BASIC prompt, "LOAD BSYSGEN"
    7) Type "15100 Z(II) = PEEK(20480 + II)" to fix a bug in the program
       and press Enter.
    8) Type RUN and press Enter
    9) Choose drive 1 and press Y at "OK TO BSYSGEN?"
    10) When the format completes, type "RUN APPLESOFT BOOT PREP" and press Enter.
    11) Once it finishes, quit MESS.  Remove the diskii(ng) from slot 7 and
       the system should boot from the Corvus HD.

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

#include "a2corvus.h"
#include "includes/apple2.h"
#include "imagedev/harddriv.h"

/***************************************************************************
    PARAMETERS
***************************************************************************/

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

const device_type A2BUS_CORVUS = &device_creator<a2bus_corvus_device>;

#define CORVUS_ROM_REGION  "corvus_rom"
#define CORVUS_HD_TAG      "corvushd"

static MACHINE_CONFIG_FRAGMENT(corvus)
	MCFG_DEVICE_ADD(CORVUS_HD_TAG, CORVUS_HDC, 0)
	MCFG_HARDDISK_CONFIG_ADD("harddisk1", corvus_hdc_t::hd_intf)
	MCFG_HARDDISK_CONFIG_ADD("harddisk2", corvus_hdc_t::hd_intf)
	MCFG_HARDDISK_CONFIG_ADD("harddisk3", corvus_hdc_t::hd_intf)
	MCFG_HARDDISK_CONFIG_ADD("harddisk4", corvus_hdc_t::hd_intf)
MACHINE_CONFIG_END

ROM_START( corvus )
	ROM_REGION(0x800, CORVUS_ROM_REGION, 0)
	ROM_LOAD( "a4.7.u10", 0x0000, 0x0800, CRC(1cf6e32a) SHA1(dbd6efeb3b54c0523b8b4eda8b3d737413f6a91a) )
ROM_END

/***************************************************************************
    FUNCTION PROTOTYPES
***************************************************************************/

//-------------------------------------------------
//  machine_config_additions - device-specific
//  machine configurations
//-------------------------------------------------

machine_config_constructor a2bus_corvus_device::device_mconfig_additions() const
{
	return MACHINE_CONFIG_NAME( corvus );
}

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

const rom_entry *a2bus_corvus_device::device_rom_region() const
{
	return ROM_NAME( corvus );
}

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

a2bus_corvus_device::a2bus_corvus_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
	device_t(mconfig, type, name, tag, owner, clock, shortname, source),
	device_a2bus_card_interface(mconfig, *this),
	m_corvushd(*this, CORVUS_HD_TAG)
{
}

a2bus_corvus_device::a2bus_corvus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
	device_t(mconfig, A2BUS_CORVUS, "Corvus Flat Cable interface", tag, owner, clock, "a2corvus", __FILE__),
	device_a2bus_card_interface(mconfig, *this),
	m_corvushd(*this, CORVUS_HD_TAG)
{
}

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

void a2bus_corvus_device::device_start()
{
	// set_a2bus_device makes m_slot valid
	set_a2bus_device();

	astring tempstring;
	m_rom = device().machine().root_device().memregion(this->subtag(tempstring, CORVUS_ROM_REGION))->base();
}

void a2bus_corvus_device::device_reset()
{
}


/*-------------------------------------------------
    read_c0nx - called for reads from this card's c0nx space
-------------------------------------------------*/

UINT8 a2bus_corvus_device::read_c0nx(address_space &space, UINT8 offset)
{
	switch (offset)
	{
		case 0:
			return m_corvushd->read(space, 0);

		case 1:
			return m_corvushd->status_r(space, 0);

		default:
			logerror("Corvus: read unhandled c0n%x (PC=%x)\n", offset, space.device().safe_pc());
			break;
	}

	return 0xff;
}


/*-------------------------------------------------
    write_c0nx - called for writes to this card's c0nx space
-------------------------------------------------*/

void a2bus_corvus_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data)
{
	if (offset == 0)
	{
		m_corvushd->write(space, 0, data);
	}
}

/*-------------------------------------------------
    read_cnxx - called for reads from this card's cnxx space
-------------------------------------------------*/

UINT8 a2bus_corvus_device::read_cnxx(address_space &space, UINT8 offset)
{
	// one slot image at the end of the ROM, it appears
	return m_rom[offset+0x700];
}

/*-------------------------------------------------
    read_c800 - called for reads from this card's c800 space
-------------------------------------------------*/

UINT8 a2bus_corvus_device::read_c800(address_space &space, UINT16 offset)
{
	return m_rom[offset & 0x7ff];
}