summaryrefslogtreecommitdiffstats
path: root/docs/release/scripts/build/msgfmt.py
diff options
context:
space:
mode:
Diffstat (limited to 'docs/release/scripts/build/msgfmt.py')
0 files changed, 0 insertions, 0 deletions
id='n12' href='#n12'>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 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert

#include "emu.h"
#include "nextmo.h"

const device_type NEXTMO = &device_creator<nextmo_device>;

DEVICE_ADDRESS_MAP_START(map, 8, nextmo_device)
	AM_RANGE(0x04, 0x04) AM_READWRITE(r4_r, r4_w)
	AM_RANGE(0x05, 0x05) AM_READWRITE(r5_r, r5_w)
	AM_RANGE(0x06, 0x06) AM_READWRITE(r6_r, r6_w)
	AM_RANGE(0x07, 0x07) AM_READWRITE(r7_r, r7_w)
	AM_RANGE(0x08, 0x08) AM_READWRITE(r8_r, r8_w)
	AM_RANGE(0x09, 0x09) AM_READWRITE(r9_r, r9_w)
	AM_RANGE(0x0a, 0x0a) AM_READWRITE(ra_r, ra_w)
	AM_RANGE(0x0b, 0x0b) AM_READWRITE(rb_r, rb_w)
	AM_RANGE(0x10, 0x17) AM_READWRITE(r10_r, r10_w)
ADDRESS_MAP_END

nextmo_device::nextmo_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	device_t(mconfig, NEXTMO, "NeXT Magneto-optical drive", tag, owner, clock, "nextmo", __FILE__),
	r4(0),
	irq_cb(*this),
	drq_cb(*this)
{
}

void nextmo_device::device_start()
{
	irq_cb.resolve_safe();
	drq_cb.resolve_safe();
}

void nextmo_device::device_reset()
{
}

READ8_MEMBER(nextmo_device::r4_r)
{
	logerror("nextmo: r4_r %02x (%08x)\n", r4, space.device().safe_pc());
	return r4;
}

WRITE8_MEMBER(nextmo_device::r4_w)
{
	if(r4 & 1)
		device_reset();
	r4 = (r4 & (~data & 0xfc)) | (data & 3);
	logerror("nextmo: r4_w %02x (%08x)\n", r4, space.device().safe_pc());
}

READ8_MEMBER(nextmo_device::r5_r)
{
	logerror("nextmo: r5_r %02x (%08x)\n", r5, space.device().safe_pc());
	return r5;
}

WRITE8_MEMBER(nextmo_device::r5_w)
{
	r5 = data;
	logerror("nextmo: r5_w %02x (%08x)\n", r5, space.device().safe_pc());
}

READ8_MEMBER(nextmo_device::r6_r)
{
	logerror("nextmo: r6_r %02x (%08x)\n", r6, space.device().safe_pc());
	return r6;
}

WRITE8_MEMBER(nextmo_device::r6_w)
{
	r6 = data;
	logerror("nextmo: r6_w %02x (%08x)\n", r6, space.device().safe_pc());
}

READ8_MEMBER(nextmo_device::r7_r)
{
	logerror("nextmo: r7_r %02x (%08x)\n", r7, space.device().safe_pc());
	return r7;
}

WRITE8_MEMBER(nextmo_device::r7_w)
{
	r7 = data;
	logerror("nextmo: r7_w %02x (%08x)\n", r7, space.device().safe_pc());
	if(r7 & 0xc0) {
		logerror("nextmo: start dma %02x %02x\n", r6, r7);
		sector_pos = 0;
		if(!drq_cb.isnull())
			drq_cb(true);
	}
}

uint8_t nextmo_device::dma_r()
{
	uint8_t r = 0;
	if(r7 & 0x80)
		r = sector[sector_pos++];
	check_dma_end();
	return r;
}

void nextmo_device::dma_w(uint8_t data)
{
	if(r7 & 0x40)
		sector[sector_pos++] = data;
	check_dma_end();
}

void nextmo_device::check_dma_end()
{
	int limit;
	if(r7 & 0x40)
		limit = r6 & 0x20 ? 0x510 : 0x400;
	else
		limit = r6 & 0x20 ? 0x400 : 0x510;
	if(sector_pos == limit) {
		if(!drq_cb.isnull())
			drq_cb(false);
		if(r7 & 0x40) {
			if(r6 & 0x20)
				check_ecc();
			else
				compute_ecc();
		}
		r7 &= 0x3f;
		r4 |= 0x08;
	}
}

READ8_MEMBER(nextmo_device::r8_r)
{
	logerror("nextmo: r8_r (%08x)\n", space.device().safe_pc());
	return 0x00;
}

WRITE8_MEMBER(nextmo_device::r8_w)
{
	logerror("nextmo: r8_w %02x (%08x)\n", data, space.device().safe_pc());
}

READ8_MEMBER(nextmo_device::r9_r)
{
	logerror("nextmo: r9_r (%08x)\n", space.device().safe_pc());
	return 0x00;
}

WRITE8_MEMBER(nextmo_device::r9_w)
{
	logerror("nextmo: r9_w %02x (%08x)\n", data, space.device().safe_pc());
}

READ8_MEMBER(nextmo_device::ra_r)
{
	logerror("nextmo: ra_r (%08x)\n", space.device().safe_pc());
	return 0x00;
}

WRITE8_MEMBER(nextmo_device::ra_w)
{
	logerror("nextmo: ra_w %02x (%08x)\n", data, space.device().safe_pc());
}

READ8_MEMBER(nextmo_device::rb_r)
{
	logerror("nextmo: rb_r (%08x)\n", space.device().safe_pc());
	return 0x24;
}

WRITE8_MEMBER(nextmo_device::rb_w)
{
	logerror("nextmo: rb_w %02x (%08x)\n", data, space.device().safe_pc());
}

READ8_MEMBER(nextmo_device::r10_r)
{
	logerror("nextmo: r10_r %d (%08x)\n", offset, space.device().safe_pc());
	return 0x00;
}

WRITE8_MEMBER(nextmo_device::r10_w)
{
	logerror("nextmo: r10_w %d, %02x (%08x)\n", offset, data, space.device().safe_pc());
}

void nextmo_device::check_ecc()
{
	logerror("nextmo: check_ecc\n");
	for(int i=0; i<0x400; i++)
		sector[i] = i;
}

void nextmo_device::compute_ecc()
{
	logerror("nextmo: compute_ecc\n");
	memset(sector+0x400, 0, 0x110);
}