mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
-ins8154: Added internal 128-byte RAM and simplified handlers. [Ryan Holtz]
-astrocde: Various changes. [Ryan Holtz] * Added I/O access handling to expansion slot. * Added INS8154 I/O functionality to Blue RAM boards (RAM not yet hooked up). * Hooked up cassette saving and loading to Blue RAM boards.
This commit is contained in:
parent
735ac8764e
commit
16b1e9923d
@ -866,6 +866,7 @@ FORMATS["APPLIX_DSK"] = true
|
||||
FORMATS["APRIDISK"] = true
|
||||
FORMATS["AP_DSK35"] = true
|
||||
FORMATS["ASST128_DSK"] = true
|
||||
FORMATS["ASTROCADE_WAV"] = true
|
||||
FORMATS["ATARI_DSK"] = true
|
||||
FORMATS["ATOM_DSK"] = true
|
||||
FORMATS["ATOM_TAP"] = true
|
||||
|
@ -1,5 +1,10 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Ryan Holtz
|
||||
//
|
||||
// TODO: Emulation of the circuitry to convert 300-baud Kansas City Standard data into bits.
|
||||
//
|
||||
// Decoding is done in hardware by an external box, and decoded bits are fed to bit 0 of the controller port,
|
||||
// with sync bits being fed to bit 1.
|
||||
|
||||
#include "emu.h"
|
||||
#include "cassette.h"
|
||||
@ -29,13 +34,11 @@ astrocade_cassette_device::~astrocade_cassette_device()
|
||||
uint8_t astrocade_cassette_device::read_handle()
|
||||
{
|
||||
uint8_t data = m_cassette->input() > 0.0 ? 0 : 1;
|
||||
logerror("%s: Cassette Handle Read: %d\n", machine().describe_context(), data);
|
||||
return data;
|
||||
}
|
||||
|
||||
uint8_t astrocade_cassette_device::read_knob()
|
||||
{
|
||||
logerror("%s: Cassette Knob Read\n", machine().describe_context());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,14 @@ READ8_MEMBER(astrocade_exp_device::read)
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
READ8_MEMBER(astrocade_exp_device::read_io)
|
||||
{
|
||||
if (m_card)
|
||||
return m_card->read_io(space, offset);
|
||||
else
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
write
|
||||
-------------------------------------------------*/
|
||||
@ -83,3 +91,9 @@ WRITE8_MEMBER(astrocade_exp_device::write)
|
||||
if (m_card)
|
||||
m_card->write(space, offset, data);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(astrocade_exp_device::write_io)
|
||||
{
|
||||
if (m_card)
|
||||
m_card->write_io(space, offset, data);
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ public:
|
||||
// reading and writing
|
||||
virtual DECLARE_READ8_MEMBER(read) { return 0xff; }
|
||||
virtual DECLARE_WRITE8_MEMBER(write) { }
|
||||
virtual DECLARE_READ8_MEMBER(read_io) { return 0xff; }
|
||||
virtual DECLARE_WRITE8_MEMBER(write_io) { }
|
||||
|
||||
protected:
|
||||
device_astrocade_card_interface(const machine_config &mconfig, device_t &device);
|
||||
@ -46,6 +48,8 @@ public:
|
||||
// reading and writing
|
||||
virtual DECLARE_READ8_MEMBER(read);
|
||||
virtual DECLARE_WRITE8_MEMBER(write);
|
||||
virtual DECLARE_READ8_MEMBER(read_io);
|
||||
virtual DECLARE_WRITE8_MEMBER(write_io);
|
||||
|
||||
protected:
|
||||
bool m_card_mounted;
|
||||
|
@ -21,10 +21,10 @@
|
||||
switch and run it as a cartridge. This is useful for cartridge development.
|
||||
|
||||
Blue RAM -- available in 4K, 16K, and 32K. These also use an INS8154 chip,
|
||||
(not yet implemented) which has an additional $80 bytes of RAM mapped
|
||||
immediately after the end of the expansion address space. This memory
|
||||
can't be write protected. The INS8154 has I/O features needed for loading
|
||||
tape programs into Blue RAM BASIC, as well as running the Blue RAM Utility cart.
|
||||
which has an additional $80 bytes of RAM mapped immediately after the end of
|
||||
the expansion address space (not yet implemented). This memory can't be write
|
||||
protected. The INS8154 has I/O features needed for loading tape programs into
|
||||
Blue RAM BASIC, as well as running the Blue RAM Utility cart.
|
||||
4K: $6000 to $6FFF (can't run VIPERSoft BASIC, because this program needs memory
|
||||
past this range)
|
||||
16K: $6000 to $9FFF
|
||||
@ -69,9 +69,11 @@ DEFINE_DEVICE_TYPE(ASTROCADE_RL64RAM, astrocade_rl64ram_device, "astroca
|
||||
|
||||
|
||||
astrocade_blueram_4k_device::astrocade_blueram_4k_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, type, tag, owner, clock),
|
||||
device_astrocade_card_interface(mconfig, *this),
|
||||
m_write_prot(*this, "RAM_PROTECT")
|
||||
: device_t(mconfig, type, tag, owner, clock)
|
||||
, device_astrocade_card_interface(mconfig, *this)
|
||||
, m_write_prot(*this, "RAM_PROTECT")
|
||||
, m_ramio(*this, "ramio")
|
||||
, m_cassette(*this, "cassette")
|
||||
{
|
||||
}
|
||||
|
||||
@ -163,7 +165,35 @@ WRITE8_MEMBER(astrocade_blueram_4k_device::write)
|
||||
m_ram[offset - 0x1000] = data;
|
||||
}
|
||||
|
||||
READ8_MEMBER(astrocade_blueram_4k_device::read_io)
|
||||
{
|
||||
return m_ramio->read_io(offset & 0x7f);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(astrocade_blueram_4k_device::write_io)
|
||||
{
|
||||
logerror("write_io: %04x = %02x\n", offset, data);
|
||||
m_ramio->write_io(offset & 0x7f, data);
|
||||
}
|
||||
|
||||
uint8_t astrocade_blueram_4k_device::porta_r()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t astrocade_blueram_4k_device::portb_r()
|
||||
{
|
||||
return m_cassette->input() > 0.0 ? 1 : 0;
|
||||
}
|
||||
|
||||
void astrocade_blueram_4k_device::porta_w(uint8_t data)
|
||||
{
|
||||
}
|
||||
|
||||
void astrocade_blueram_4k_device::portb_w(uint8_t data)
|
||||
{
|
||||
m_cassette->output(BIT(data, 0) ? +1 : -1);
|
||||
}
|
||||
|
||||
// Viper System 1 expansion has RAM in 0x6000-0x9fff
|
||||
READ8_MEMBER(astrocade_viper_sys1_device::read)
|
||||
@ -207,3 +237,20 @@ WRITE8_MEMBER(astrocade_rl64ram_device::write)
|
||||
if (!m_write_prot->read())
|
||||
m_ram[offset] = data;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
machine configuration
|
||||
-------------------------------------------------*/
|
||||
|
||||
void astrocade_blueram_4k_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
CASSETTE(config, m_cassette);
|
||||
m_cassette->set_default_state(CASSETTE_STOPPED);
|
||||
m_cassette->set_interface("astrocade_cass");
|
||||
|
||||
INS8154(config, m_ramio);
|
||||
m_ramio->out_a().set(FUNC(astrocade_blueram_4k_device::porta_w));
|
||||
m_ramio->out_b().set(FUNC(astrocade_blueram_4k_device::portb_w));
|
||||
m_ramio->in_a().set(FUNC(astrocade_blueram_4k_device::porta_r));
|
||||
m_ramio->in_b().set(FUNC(astrocade_blueram_4k_device::portb_r));
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "exp.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "machine/ins8154.h"
|
||||
|
||||
|
||||
// ======================> astrocade_blueram_4k_device
|
||||
@ -22,15 +24,25 @@ public:
|
||||
// reading and writing
|
||||
virtual DECLARE_READ8_MEMBER(read) override;
|
||||
virtual DECLARE_WRITE8_MEMBER(write) override;
|
||||
virtual DECLARE_READ8_MEMBER(read_io) override;
|
||||
virtual DECLARE_WRITE8_MEMBER(write_io) override;
|
||||
|
||||
uint8_t porta_r();
|
||||
uint8_t portb_r();
|
||||
void porta_w(uint8_t data);
|
||||
void portb_w(uint8_t data);
|
||||
|
||||
protected:
|
||||
astrocade_blueram_4k_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
virtual void device_start() override { m_ram.resize(0x1000); save_item(NAME(m_ram)); }
|
||||
virtual void device_reset() override { }
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
std::vector<uint8_t> m_ram;
|
||||
required_ioport m_write_prot;
|
||||
required_device<ins8154_device> m_ramio;
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
};
|
||||
|
||||
// ======================> astrocade_blueram_16k_device
|
||||
|
@ -78,6 +78,7 @@ void ins8154_device::device_start()
|
||||
save_item(NAME(m_mdr));
|
||||
save_item(NAME(m_odra));
|
||||
save_item(NAME(m_odrb));
|
||||
save_item(NAME(m_ram));
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +98,7 @@ void ins8154_device::device_reset()
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(ins8154_device::ins8154_r)
|
||||
uint8_t ins8154_device::read_io(offs_t offset)
|
||||
{
|
||||
uint8_t val = 0xff;
|
||||
|
||||
@ -146,7 +147,12 @@ READ8_MEMBER(ins8154_device::ins8154_r)
|
||||
return val;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(ins8154_device::ins8154_porta_w)
|
||||
uint8_t ins8154_device::read_ram(offs_t offset)
|
||||
{
|
||||
return m_ram[offset & 0x7f];
|
||||
}
|
||||
|
||||
void ins8154_device::porta_w(uint8_t data)
|
||||
{
|
||||
m_out_a = data;
|
||||
|
||||
@ -155,7 +161,7 @@ WRITE8_MEMBER(ins8154_device::ins8154_porta_w)
|
||||
m_out_a_cb(offs_t(0), (data & m_odra) | (m_odra ^ 0xff));
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(ins8154_device::ins8154_portb_w)
|
||||
void ins8154_device::portb_w(uint8_t data)
|
||||
{
|
||||
LOG("%s: INS8154 Write PortB %02x with odrb: %02x\n", machine().describe_context(), data, m_odrb);
|
||||
m_out_b = data;
|
||||
@ -165,7 +171,7 @@ WRITE8_MEMBER(ins8154_device::ins8154_portb_w)
|
||||
m_out_b_cb(offs_t(0), (data & m_odrb) | (m_odrb ^ 0xff));
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(ins8154_device::ins8154_w)
|
||||
void ins8154_device::write_io(offs_t offset, uint8_t data)
|
||||
{
|
||||
if (offset > 0x24)
|
||||
{
|
||||
@ -176,11 +182,11 @@ WRITE8_MEMBER(ins8154_device::ins8154_w)
|
||||
switch (offset)
|
||||
{
|
||||
case 0x20:
|
||||
ins8154_porta_w(space, 0, data);
|
||||
porta_w(data);
|
||||
break;
|
||||
|
||||
case 0x21:
|
||||
ins8154_portb_w(space, 0, data);
|
||||
portb_w(data);
|
||||
break;
|
||||
|
||||
case 0x22:
|
||||
@ -205,12 +211,12 @@ WRITE8_MEMBER(ins8154_device::ins8154_w)
|
||||
if (offset < 0x08)
|
||||
{
|
||||
LOGBITS("%s: INS8154 Port A set bit %02x\n", machine().describe_context(), offset & 0x07);
|
||||
ins8154_porta_w(space, 0, m_out_a |= (1 << (offset & 0x07)));
|
||||
porta_w(m_out_a |= (1 << (offset & 0x07)));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGBITS("%s: INS8154 Port B set bit %02x\n", machine().describe_context(), offset & 0x07);
|
||||
ins8154_portb_w(space, 0, m_out_b |= (1 << (offset & 0x07)));
|
||||
portb_w(m_out_b |= (1 << (offset & 0x07)));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -219,14 +225,19 @@ WRITE8_MEMBER(ins8154_device::ins8154_w)
|
||||
if (offset < 0x08)
|
||||
{
|
||||
LOGBITS("%s: INS8154 Port A clear bit %02x\n", machine().describe_context(), offset & 0x07);
|
||||
ins8154_porta_w(space, 0, m_out_a & ~(1 << (offset & 0x07)));
|
||||
porta_w(m_out_a & ~(1 << (offset & 0x07)));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGBITS("%s: INS8154 Port B clear bit %02x\n", machine().describe_context(), offset & 0x07);
|
||||
ins8154_portb_w(space, 0, m_out_b & ~(1 << (offset & 0x07)));
|
||||
portb_w(m_out_b & ~(1 << (offset & 0x07)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ins8154_device::write_ram(offs_t offset, uint8_t data)
|
||||
{
|
||||
m_ram[offset & 0x7f] = data;
|
||||
}
|
||||
|
@ -47,11 +47,13 @@ public:
|
||||
auto out_b() { return m_out_b_cb.bind(); }
|
||||
auto out_irq() { return m_out_irq_cb.bind(); }
|
||||
|
||||
DECLARE_READ8_MEMBER( ins8154_r );
|
||||
DECLARE_WRITE8_MEMBER( ins8154_w );
|
||||
uint8_t read_io(offs_t offset);
|
||||
void write_io(offs_t offset, uint8_t data);
|
||||
uint8_t read_ram(offs_t offset);
|
||||
void write_ram(offs_t offset, uint8_t data);
|
||||
|
||||
DECLARE_WRITE8_MEMBER( ins8154_porta_w );
|
||||
DECLARE_WRITE8_MEMBER( ins8154_portb_w );
|
||||
void porta_w(uint8_t data);
|
||||
void portb_w(uint8_t data);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -77,6 +79,9 @@ private:
|
||||
uint8_t m_mdr; /* Mode Definition Register */
|
||||
uint8_t m_odra; /* Output Definition Register Port A */
|
||||
uint8_t m_odrb; /* Output Definition Register Port B */
|
||||
|
||||
/* on-board RAM */
|
||||
uint8_t m_ram[0x80];
|
||||
};
|
||||
|
||||
|
||||
|
@ -123,7 +123,7 @@ void acrnsys_state::a6502_mem(address_map &map)
|
||||
{
|
||||
map.unmap_value_low();
|
||||
map(0x0000, 0x03ff).ram();
|
||||
map(0x0e00, 0x0e7f).mirror(0x100).rw(m_ins8154, FUNC(ins8154_device::ins8154_r), FUNC(ins8154_device::ins8154_w));
|
||||
map(0x0e00, 0x0e7f).mirror(0x100).rw(m_ins8154, FUNC(ins8154_device::read_io), FUNC(ins8154_device::write_io));
|
||||
map(0xf000, 0xffff).rom().region("maincpu", 0);
|
||||
}
|
||||
|
||||
|
@ -185,8 +185,8 @@ WRITE8_MEMBER( acrnsys1_state::acrnsys1_led_segment_w )
|
||||
void acrnsys1_state::acrnsys1_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x03ff).ram();
|
||||
map(0x0e00, 0x0e7f).mirror(0x100).rw("b1", FUNC(ins8154_device::ins8154_r), FUNC(ins8154_device::ins8154_w));
|
||||
map(0x0e80, 0x0eff).mirror(0x100).ram();
|
||||
map(0x0e00, 0x0e7f).mirror(0x100).rw("b1", FUNC(ins8154_device::read_io), FUNC(ins8154_device::write_io));
|
||||
map(0x0e80, 0x0eff).mirror(0x100).rw("b1", FUNC(ins8154_device::read_ram), FUNC(ins8154_device::write_ram));
|
||||
map(0xf800, 0xf9ff).mirror(0x600).rom();
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,11 @@ READ8_MEMBER(astrocde_home_state::inputs_r)
|
||||
if (BIT(offset, 2))
|
||||
return m_keypad[offset & 3]->read();
|
||||
else
|
||||
return m_ctrl[offset & 3]->read_handle();
|
||||
{
|
||||
uint8_t data = m_ctrl[offset & 3]->read_handle();
|
||||
//printf("%d", BIT(data, 0));
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( astrocde )
|
||||
@ -258,7 +262,10 @@ MACHINE_START_MEMBER(astrocde_home_state, astrocde)
|
||||
// if no RAM is mounted and the handlers are installed, the system starts with garbage on screen and a RESET is necessary
|
||||
// thus, install RAM only if an expansion is mounted
|
||||
if (m_exp->get_card_mounted())
|
||||
{
|
||||
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x5000, 0xffff, read8_delegate(FUNC(astrocade_exp_device::read),(astrocade_exp_device*)m_exp), write8_delegate(FUNC(astrocade_exp_device::write),(astrocade_exp_device*)m_exp));
|
||||
m_maincpu->space(AS_IO).install_readwrite_handler(0x0080, 0x00ff, 0x0000, 0x0000, 0xff00, read8_delegate(FUNC(astrocade_exp_device::read_io),(astrocade_exp_device*)m_exp), write8_delegate(FUNC(astrocade_exp_device::write_io),(astrocade_exp_device*)m_exp));
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************
|
||||
|
@ -649,8 +649,8 @@ void modulab_state::modulab_map(address_map &map)
|
||||
// map(0x0800, 0x13ff).ram().mirror(0xe000); // expansion port area consisting of 3 chip selects each selecting 0x3ff byte addresses
|
||||
map(0x1400, 0x17ff).rom().mirror(0xe000).region("maincpu", 0x0000);
|
||||
map(0x1800, 0x187f).rw(FUNC(modulab_state::io_r), FUNC(modulab_state::io_w)).mirror(0xe200);
|
||||
map(0x1900, 0x197f).rw(m_pia1, FUNC(ins8154_device::ins8154_r), FUNC(ins8154_device::ins8154_w)).mirror(0xe200);
|
||||
map(0x1980, 0x19ff).ram().mirror(0xe200); // 8154 internal RAM
|
||||
map(0x1900, 0x197f).rw(m_pia1, FUNC(ins8154_device::read_io), FUNC(ins8154_device::write_io)).mirror(0xe200);
|
||||
map(0x1980, 0x19ff).rw(m_pia1, FUNC(ins8154_device::read_ram), FUNC(ins8154_device::write_ram)).mirror(0xe200);
|
||||
map(0x1c00, 0x1fff).rom().mirror(0xe000).region("maincpu", 0x0400);
|
||||
}
|
||||
|
||||
|
@ -117,8 +117,8 @@ void mk14_state::mem_map(address_map &map)
|
||||
map.unmap_value_high();
|
||||
map.global_mask(0x0fff);
|
||||
map(0x000, 0x1ff).mirror(0x600).rom(); // ROM
|
||||
map(0x800, 0x87f).mirror(0x600).rw("ic8", FUNC(ins8154_device::ins8154_r), FUNC(ins8154_device::ins8154_w)); // I/O
|
||||
map(0x880, 0x8ff).mirror(0x600).ram(); // 128 I/O chip RAM
|
||||
map(0x800, 0x87f).mirror(0x600).rw("ic8", FUNC(ins8154_device::read_io), FUNC(ins8154_device::write_io)); // I/O
|
||||
map(0x880, 0x8ff).mirror(0x600).rw("ic8", FUNC(ins8154_device::read_ram), FUNC(ins8154_device::write_ram)); // 128 bytes I/O chip RAM
|
||||
map(0x900, 0x9ff).mirror(0x400).rw(FUNC(mk14_state::keyboard_r), FUNC(mk14_state::display_w));
|
||||
map(0xb00, 0xbff).ram(); // VDU RAM
|
||||
map(0xf00, 0xfff).ram(); // Standard RAM
|
||||
|
@ -139,7 +139,6 @@ private:
|
||||
int m_tmp;
|
||||
int m_t1;
|
||||
|
||||
uint8_t m_ins8154_ram[0x80];
|
||||
uint8_t m_txt_ram[0x400];
|
||||
|
||||
vega_obj m_obj[NUM_OBJ];
|
||||
@ -204,12 +203,12 @@ WRITE8_MEMBER(vega_state::extern_w)
|
||||
|
||||
if(m_p2_data&0x40) /* P26 connected to M/IO pin */
|
||||
{
|
||||
m_ins8154_ram[offset&0x7f]=data;
|
||||
m_ins8154->write_ram(offset, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
//register w ?
|
||||
m_ins8154->ins8154_w(space,offset&0x7f,data);
|
||||
m_ins8154->write_io(offset & 0x7f, data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -332,12 +331,12 @@ READ8_MEMBER(vega_state::extern_r)
|
||||
|
||||
if(m_p2_data&0x40) /* P26 connected to M/IO pin */
|
||||
{
|
||||
return m_ins8154_ram[offset&0x7f];
|
||||
return m_ins8154->read_ram(offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
//register r ?
|
||||
return m_ins8154->ins8154_r(space,offset&0x7f);
|
||||
return m_ins8154->read_io(offset & 0x7f);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
|
Loading…
Reference in New Issue
Block a user