(nw) basic52: cleaned up, added sound, bypassed baud auto-detect.

This commit is contained in:
Robbbert 2020-05-17 06:40:12 +10:00
parent bb222482b6
commit aed37668aa
2 changed files with 25 additions and 12 deletions

View File

@ -23,19 +23,22 @@ However, the way the cpu is written, it actually passes bytes around, so
the auto-speed detection doesn't work as intended. Also the cpu interface
is horribly outdated and needs to be brought up to date.
So, as it stands, start the driver, then press d and g in turn until
something starts happening. Basic-52 usually starts at a very slow rate,
about 1 character per second, while Basic-31 is much faster.
The optional eprom presents the ability to bypass the auto-speed problems.
Once the system starts, all input must be in uppercase. Read the manual
to discover the special features of this Basic.
Sound: BASIC-31 has sound, and BASIC-52 doesn't. The sound command is PWM.
Example: PWM 800,200,900
****************************************************************************/
#include "emu.h"
#include "cpu/mcs51/mcs51.h"
#include "machine/i8255.h"
#include "machine/terminal.h"
#include "sound/spkrdev.h"
#include "speaker.h"
class basic52_state : public driver_device
@ -45,6 +48,7 @@ public:
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_terminal(*this, "terminal")
, m_speaker(*this, "speaker")
{ }
void basic52(machine_config &config);
@ -52,6 +56,7 @@ public:
protected:
void kbd_put(u8 data);
void port1_w(u8 data);
uint8_t unk_r();
uint8_t from_term();
void basic52_io(address_map &map);
@ -59,6 +64,7 @@ protected:
uint8_t m_term_data;
required_device<mcs51_cpu_device> m_maincpu;
required_device<generic_terminal_device> m_terminal;
required_device<speaker_sound_device> m_speaker;
};
@ -66,20 +72,17 @@ void basic52_state::basic52_mem(address_map &map)
{
map.unmap_value_high();
map(0x0000, 0x1fff).rom();
map(0x2000, 0x7fff).ram();
//map(0x8000, 0x9fff).rom(); // EPROM
//map(0xc000, 0xdfff) // Expansion block
//map(0xe000, 0xffff) // Expansion block
}
void basic52_state::basic52_io(address_map &map)
{
map.unmap_value_high();
map(0x0000, 0x7fff).ram();
map(0x8000, 0x9fff).rom(); // EPROM
// 8000-9FFF is reserved for a plug-in EPROM containing BASIC programs.
// We have used this to preset the baud rate and skip the unreliable auto-detect.
map(0x8000, 0x8000).lr8(NAME([] () { return 0x31; })); // we will be manually setting the baud rate
map(0x8001, 0x8002).lr8(NAME([] () { return 0xFE; })); // to the fastest possible
map(0xa000, 0xa003).rw("ppi8255", FUNC(i8255_device::read), FUNC(i8255_device::write)); // PPI-8255
//map(0xc000, 0xdfff) // Expansion block
//map(0xe000, 0xffff) // Expansion block
}
/* Input ports */
@ -97,6 +100,11 @@ uint8_t basic52_state::unk_r()
return m_term_data; // won't boot without this
}
void basic52_state::port1_w(u8 data)
{
m_speaker->level_w(BIT(data, 2));
}
void basic52_state::kbd_put(u8 data)
{
@ -111,6 +119,7 @@ void basic52_state::basic31(machine_config &config)
I8031(config, m_maincpu, XTAL(11'059'200));
m_maincpu->set_addrmap(AS_PROGRAM, &basic52_state::basic52_mem);
m_maincpu->set_addrmap(AS_IO, &basic52_state::basic52_io);
m_maincpu->port_out_cb<1>().set(FUNC(basic52_state::port1_w));
m_maincpu->port_in_cb<3>().set(FUNC(basic52_state::unk_r));
m_maincpu->serial_tx_cb().set(m_terminal, FUNC(generic_terminal_device::write));
m_maincpu->serial_rx_cb().set(FUNC(basic52_state::from_term));
@ -120,6 +129,10 @@ void basic52_state::basic31(machine_config &config)
m_terminal->set_keyboard_callback(FUNC(basic52_state::kbd_put));
I8255(config, "ppi8255", 0);
// sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.50);
}
void basic52_state::basic52(machine_config &config)
@ -156,4 +169,4 @@ ROM_END
/* Driver */
/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
COMP( 1985, basic52, 0, 0, basic52, basic52, basic52_state, empty_init, "Intel", "MCS BASIC 52", MACHINE_NO_SOUND_HW)
COMP( 1985, basic31, basic52, 0, basic31, basic52, basic52_state, empty_init, "Intel", "MCS BASIC 31", MACHINE_NO_SOUND_HW)
COMP( 1985, basic31, basic52, 0, basic31, basic52, basic52_state, empty_init, "Intel", "MCS BASIC 31", 0 )

View File

@ -829,7 +829,7 @@ void ace_state::ace(machine_config &config)
//-------------------------------------------------
ROM_START( jupace )
ROM_REGION( 0x2000, Z80_TAG, 0 )
ROM_REGION( 0x10000, Z80_TAG, 0 )
ROM_LOAD( "rom-a.z1", 0x0000, 0x1000, CRC(dc8438a5) SHA1(8fa97eb71e5dd17c7d190c6587ee3840f839347c) )
ROM_LOAD( "rom-b.z2", 0x1000, 0x1000, CRC(4009f636) SHA1(98c5d4bcd74bcf014268cf4c00b2007ea5cc21f3) )