MT 07334: microtan: out of memory when trying to run BASIC

This commit is contained in:
Robbbert 2019-05-24 16:55:29 +10:00
parent 28756bc689
commit 41e91c388a
3 changed files with 31 additions and 46 deletions

View File

@ -231,7 +231,7 @@ MACHINE_CONFIG_START(microtan_state::microtan)
/* sound hardware */
SPEAKER(config, "speaker").front_center();
WAVE(config, "wave", m_cassette).add_route(ALL_OUTPUTS, "speaker", 0.25);
WAVE(config, "wave", m_cassette).add_route(ALL_OUTPUTS, "speaker", 0.05);
AY8910(config, m_ay8910[0], 1000000).add_route(ALL_OUTPUTS, "speaker", 0.5);
AY8910(config, m_ay8910[1], 1000000).add_route(ALL_OUTPUTS, "speaker", 0.5);

View File

@ -28,16 +28,17 @@
class microtan_state : public driver_device
{
public:
microtan_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"),
m_irq_line(*this, "irq_line"),
m_cassette(*this, "cassette"),
m_via6522(*this, "via6522%u", 0),
m_ay8910(*this, "ay8910%u", 0),
m_gfxdecode(*this, "gfxdecode"),
m_led(*this, "led1")
microtan_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_videoram(*this, "videoram")
, m_maincpu(*this, "maincpu")
, m_irq_line(*this, "irq_line")
, m_cassette(*this, "cassette")
, m_via6522(*this, "via6522%u", 0)
, m_ay8910(*this, "ay8910%u", 0)
, m_io_keyboard(*this, "ROW%u", 0)
, m_gfxdecode(*this, "gfxdecode")
, m_led(*this, "led1")
{ }
void microtan(machine_config &config);
@ -65,6 +66,7 @@ private:
required_device<cassette_image_device> m_cassette;
required_device_array<via6522_device, 2> m_via6522;
required_device_array<ay8910_device, 2> m_ay8910;
required_ioport_array<9> m_io_keyboard;
required_device<gfxdecode_device> m_gfxdecode;
output_finder<> m_led;
@ -101,7 +103,6 @@ private:
DECLARE_WRITE8_MEMBER(via_1_out_b);
DECLARE_WRITE_LINE_MEMBER(via_1_out_ca2);
DECLARE_WRITE_LINE_MEMBER(via_1_out_cb2);
uint8_t read_dsw();
void store_key(int key);
image_verify_result verify_snapshot(uint8_t *data, int size);
image_init_result parse_intel_hex(uint8_t *snapshot_buff, char *src);

View File

@ -119,18 +119,6 @@ static const char keyboard[8][9][8] = {
},
};
uint8_t microtan_state::read_dsw()
{
switch(machine().phase())
{
case machine_phase::RESET:
case machine_phase::RUNNING:
return ioport("DSW")->read();
default:
return 0x00;
}
}
/**************************************************************
* VIA callback functions for VIA #0
@ -291,7 +279,6 @@ void microtan_state::store_key(int key)
INTERRUPT_GEN_MEMBER(microtan_state::interrupt)
{
int mod, row, col, chg, newvar;
static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8" };
if( m_repeat )
{
@ -303,14 +290,13 @@ INTERRUPT_GEN_MEMBER(microtan_state::interrupt)
m_repeat = m_repeater;
}
row = 9;
newvar = ioport("ROW8")->read();
newvar = m_io_keyboard[8]->read();
chg = m_keyrows[--row] ^ newvar;
while ( !chg && row > 0)
{
newvar = ioport(keynames[row - 1])->read();
newvar = m_io_keyboard[row - 1]->read();
chg = m_keyrows[--row] ^ newvar;
}
if (!chg)
@ -380,7 +366,6 @@ INTERRUPT_GEN_MEMBER(microtan_state::interrupt)
void microtan_state::init_microtan()
{
uint8_t *dst = memregion("gfx2")->base();
address_space &space = m_maincpu->space(AS_PROGRAM);
for (int i = 0; i < 256; i++)
{
@ -418,19 +403,6 @@ void microtan_state::init_microtan()
dst += 4;
}
switch (read_dsw() & 3)
{
case 0: // 1K only :)
space.nop_readwrite(0x0400, 0xbbff);
break;
case 1: // +7K TANEX
space.install_ram(0x0400, 0x1fff,nullptr);
space.nop_readwrite(0x2000, 0xbbff);
break;
default: // +7K TANEX + 40K TANRAM
space.install_ram(0x0400, 0xbbff, nullptr);
break;
}
m_read_cassette_timer = timer_alloc(TIMER_READ_CASSETTE);
m_pulse_nmi_timer = timer_alloc(TIMER_PULSE_NMI);
@ -467,12 +439,24 @@ void microtan_state::machine_start()
void microtan_state::machine_reset()
{
static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8" };
address_space &space = m_maincpu->space(AS_PROGRAM);
switch (ioport("DSW")->read() & 3)
{
case 0: // 1K only :)
space.nop_readwrite(0x0400, 0xbbff);
break;
case 1: // +7K TANEX
space.install_ram(0x0400, 0x1fff,nullptr);
space.nop_readwrite(0x2000, 0xbbff);
break;
default: // +7K TANEX + 40K TANRAM
space.install_ram(0x0400, 0xbbff, nullptr);
break;
}
for (int i = 1; i < 10; i++)
{
m_keyrows[i] = ioport(keynames[i-1])->read();
}
m_keyrows[i] = m_io_keyboard[i-1]->read();
m_led = BIT(~m_keyrows[3], 7);
}