summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2016-06-05 23:27:46 +1000
committer Robbbert <Robbbert@users.noreply.github.com>2016-06-05 23:27:46 +1000
commitbb10b1beb04eb86373839689fa9e3250e6536eca (patch)
tree719d3523e1352bafdcf28c299e2c0436d0dec6d9
parent3671c971fdff3fc83d8ba9476848d2aee29533b6 (diff)
sorcerer: calculate baud rates based on actual dividers on pcb. Fixed a bug with quickload.
-rw-r--r--src/lib/formats/sorc_cas.cpp2
-rw-r--r--src/mame/drivers/sorcerer.cpp6
-rw-r--r--src/mame/includes/sorcerer.h3
-rw-r--r--src/mame/machine/sorcerer.cpp10
4 files changed, 12 insertions, 9 deletions
diff --git a/src/lib/formats/sorc_cas.cpp b/src/lib/formats/sorc_cas.cpp
index a900f77d5e5..2c714135a12 100644
--- a/src/lib/formats/sorc_cas.cpp
+++ b/src/lib/formats/sorc_cas.cpp
@@ -32,7 +32,7 @@ header and leader bytes.
#define WAVEENTRY_LOW -32768
#define WAVEENTRY_HIGH 32767
-#define SORCERER_WAV_FREQUENCY 4800
+#define SORCERER_WAV_FREQUENCY 4788
// image size
static int sorcerer_image_size;
diff --git a/src/mame/drivers/sorcerer.cpp b/src/mame/drivers/sorcerer.cpp
index 05e91b0bcdb..d596e241355 100644
--- a/src/mame/drivers/sorcerer.cpp
+++ b/src/mame/drivers/sorcerer.cpp
@@ -399,7 +399,7 @@ static const floppy_interface sorcerer_floppy_interface =
static MACHINE_CONFIG_START( sorcerer, sorcerer_state )
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu", Z80, 12638000/6)
+ MCFG_CPU_ADD("maincpu", Z80, ES_CPU_CLOCK)
MCFG_CPU_PROGRAM_MAP(sorcerer_mem)
MCFG_CPU_IO_MAP(sorcerer_io)
@@ -423,8 +423,8 @@ static MACHINE_CONFIG_START( sorcerer, sorcerer_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.05) // cass2 speaker
MCFG_DEVICE_ADD( "uart", AY31015, 0 )
- MCFG_AY31015_TX_CLOCK(4800.0)
- MCFG_AY31015_RX_CLOCK(4800.0)
+ MCFG_AY31015_TX_CLOCK(ES_UART_CLOCK)
+ MCFG_AY31015_RX_CLOCK(ES_UART_CLOCK)
/* printer */
MCFG_CENTRONICS_ADD("centronics", centronics_devices, "covox")
diff --git a/src/mame/includes/sorcerer.h b/src/mame/includes/sorcerer.h
index 9e49370b514..caead4ebb48 100644
--- a/src/mame/includes/sorcerer.h
+++ b/src/mame/includes/sorcerer.h
@@ -27,6 +27,9 @@
#define SORCERER_USING_RS232 0
+#define ES_CPU_CLOCK (12638000 / 6)
+#define ES_UART_CLOCK (ES_CPU_CLOCK / 440)
+
struct cass_data_t {
struct {
int length; /* time cassette level is at input.level */
diff --git a/src/mame/machine/sorcerer.cpp b/src/mame/machine/sorcerer.cpp
index 651abf5a514..7cf0db6bd8f 100644
--- a/src/mame/machine/sorcerer.cpp
+++ b/src/mame/machine/sorcerer.cpp
@@ -202,14 +202,14 @@ WRITE8_MEMBER(sorcerer_state::sorcerer_fe_w)
(BIT(data,5)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
if (data & 0x30)
- m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(19200));
+ m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(ES_UART_CLOCK*4));
else
m_cassette_timer->adjust(attotime::zero);
}
#if SORCERER_USING_RS232
else
{
- m_serial_timer->adjust(attotime::zero, 0, attotime::from_hz(19200));
+ m_serial_timer->adjust(attotime::zero, 0, attotime::from_hz(ES_UART_CLOCK*4));
m_cassette_timer->adjust(attotime::zero);
}
#endif
@@ -217,8 +217,8 @@ WRITE8_MEMBER(sorcerer_state::sorcerer_fe_w)
// bit 6 baud rate */
if (BIT(changed_bits, 6))
{
- m_uart->set_receiver_clock(BIT(data, 6) ? 19200.0 : 4800.0);
- m_uart->set_transmitter_clock(BIT(data, 6) ? 19200.0 : 4800.0);
+ m_uart->set_receiver_clock(BIT(data, 6) ? ES_UART_CLOCK*4 : ES_UART_CLOCK);
+ m_uart->set_transmitter_clock(BIT(data, 6) ? ES_UART_CLOCK*4 : ES_UART_CLOCK);
}
}
@@ -455,7 +455,7 @@ QUICKLOAD_LOAD_MEMBER( sorcerer_state, sorcerer )
C858 = an autorun basic program will have this exec address on the tape
C3DD = part of basic that displays READY and lets user enter input */
- if ((start_address == 0x1d5) || (execute_address == 0xc858))
+ if (((start_address == 0x1d5) || (execute_address == 0xc858)) && (space.read_byte(0xdffa) == 0xc3))
{
UINT8 i;
static const UINT8 data[]={