summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author angelosa <lordkale4@gmail.com>2019-09-21 12:41:14 +0200
committer angelosa <lordkale4@gmail.com>2019-09-21 12:41:14 +0200
commit3517c6fcb4a919e25965e17e4355f912ad052e36 (patch)
tree35930971fe05de7a3ba715bb11650eeedf6d5469 /src
parentbb68b228c57eab1a60b1cb03a5cf835a26fd8e5b (diff)
acorn_vidc.cpp: generate u255 law sound table on device start [Olivier Galibert, Angelo Salese]
Diffstat (limited to 'src')
-rw-r--r--src/devices/machine/acorn_vidc.cpp58
-rw-r--r--src/devices/machine/acorn_vidc.h1
-rw-r--r--src/mame/drivers/riscpc.cpp4
-rw-r--r--src/mame/machine/archimds.cpp9
4 files changed, 27 insertions, 45 deletions
diff --git a/src/devices/machine/acorn_vidc.cpp b/src/devices/machine/acorn_vidc.cpp
index 0b582f25ae7..97056c0b5a9 100644
--- a/src/devices/machine/acorn_vidc.cpp
+++ b/src/devices/machine/acorn_vidc.cpp
@@ -158,6 +158,23 @@ void acorn_vidc10_device::device_start()
m_video_timer = timer_alloc(TIMER_VIDEO);
m_sound_timer = timer_alloc(TIMER_SOUND);
+
+ // generate u255 law lookup table
+ // cfr. page 48 of the VIDC20 manual, page 33 of the VIDC manual
+ // TODO: manual mentions a format difference between VIDC10 revisions
+ for (int rawval = 0; rawval < 256; rawval++)
+ {
+ uint8_t chord = rawval >> 5;
+ uint8_t point = (rawval & 0x1e) >> 1;
+ bool sign = rawval & 1;
+ int16_t result = ((16+point)<<chord)-16;
+
+ if (sign)
+ result = -result;
+
+ m_ulaw_lookup[rawval] = result*8;
+ }
+ save_pointer(NAME(m_ulaw_lookup), 256);
}
@@ -385,47 +402,8 @@ WRITE32_MEMBER( acorn_vidc10_device::sound_frequency_w )
void acorn_vidc10_device::write_dac(uint8_t channel, uint8_t data)
{
- uint8_t ulaw_comp;
int16_t res;
- static constexpr int16_t mulawTable[256] =
- {
- -32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956,
- -23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764,
- -15996,-15484,-14972,-14460,-13948,-13436,-12924,-12412,
- -11900,-11388,-10876,-10364, -9852, -9340, -8828, -8316,
- -7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140,
- -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092,
- -3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004,
- -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980,
- -1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436,
- -1372, -1308, -1244, -1180, -1116, -1052, -988, -924,
- -876, -844, -812, -780, -748, -716, -684, -652,
- -620, -588, -556, -524, -492, -460, -428, -396,
- -372, -356, -340, -324, -308, -292, -276, -260,
- -244, -228, -212, -196, -180, -164, -148, -132,
- -120, -112, -104, -96, -88, -80, -72, -64,
- -56, -48, -40, -32, -24, -16, -8, -1,
- 32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956,
- 23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764,
- 15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412,
- 11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316,
- 7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140,
- 5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092,
- 3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004,
- 2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980,
- 1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436,
- 1372, 1308, 1244, 1180, 1116, 1052, 988, 924,
- 876, 844, 812, 780, 748, 716, 684, 652,
- 620, 588, 556, 524, 492, 460, 428, 396,
- 372, 356, 340, 324, 308, 292, 276, 260,
- 244, 228, 212, 196, 180, 164, 148, 132,
- 120, 112, 104, 96, 88, 80, 72, 64,
- 56, 48, 40, 32, 24, 16, 8, 0
- };
-
- uint8_t ulaw_temp = data ^ 0xff;
- ulaw_comp = (ulaw_temp>>1) | ((ulaw_temp&1)<<7);
- res = mulawTable[ulaw_comp];
+ res = m_ulaw_lookup[data];
m_dac[channel & 7]->write(res);
}
diff --git a/src/devices/machine/acorn_vidc.h b/src/devices/machine/acorn_vidc.h
index 08bf93dd571..ff6cf0ecf11 100644
--- a/src/devices/machine/acorn_vidc.h
+++ b/src/devices/machine/acorn_vidc.h
@@ -116,6 +116,7 @@ private:
u8 m_stereo_image[8];
const float m_sound_input_gain = 0.05;
const int m_sound_max_channels = 8;
+ int16_t m_ulaw_lookup[256];
void refresh_sound_frequency();
inline void refresh_stereo_image(uint8_t channel);
};
diff --git a/src/mame/drivers/riscpc.cpp b/src/mame/drivers/riscpc.cpp
index a1b1d7e0c99..cc7e8f8a57c 100644
--- a/src/mame/drivers/riscpc.cpp
+++ b/src/mame/drivers/riscpc.cpp
@@ -1009,7 +1009,7 @@ void riscpc_state::a7000p(machine_config &config)
void riscpc_state::sarpc(machine_config &config)
{
/* Basic machine hardware */
- ARM7(config, m_maincpu, 202000000); // StrongARM
+ SA1110(config, m_maincpu, 202000000); // StrongARM
m_maincpu->set_addrmap(AS_PROGRAM, &riscpc_state::riscpc_map);
base_config(config);
}
@@ -1017,7 +1017,7 @@ void riscpc_state::sarpc(machine_config &config)
void riscpc_state::sarpc_j233(machine_config &config)
{
/* Basic machine hardware */
- ARM7(config, m_maincpu, 233000000); // StrongARM
+ SA1110(config, m_maincpu, 233000000); // StrongARM
m_maincpu->set_addrmap(AS_PROGRAM, &riscpc_state::riscpc_map);
base_config(config);
}
diff --git a/src/mame/machine/archimds.cpp b/src/mame/machine/archimds.cpp
index 6637f13d44c..c7624291993 100644
--- a/src/mame/machine/archimds.cpp
+++ b/src/mame/machine/archimds.cpp
@@ -882,19 +882,22 @@ WRITE32_MEMBER(archimedes_state::archimedes_memc_w)
break;
case 4: /* sound start */
- //logerror("MEMC: SNDSTART %08x\n",data);
archimedes_clear_irq_b(ARCHIMEDES_IRQB_SOUND_EMPTY);
m_vidc_sndstart = 0x2000000 | ((data>>2)&0x7fff)*16;
+ //printf("MEMC: SNDSTART %08x\n",m_vidc_sndstart);
break;
case 5: /* sound end */
- //logerror("MEMC: SNDEND %08x\n",data);
// end buffer is actually +16 bytes wrt sound start
+ // TODO: it actually don't apply for ertictac and poizone?
m_vidc_sndend = 0x2000000 | (((data>>2)+1)&0x7fff)*16;
+ //printf("MEMC: SNDEND %08x\n",m_vidc_sndend);
break;
case 6:
- m_vidc_sndcur = 0;
+ //printf("MEMC: SNDPTR\n");
+ m_vidc_sndcur = m_vidc_sndstart;
+ m_vidc_sndendcur = m_vidc_sndend;
archimedes_request_irq_b(ARCHIMEDES_IRQB_SOUND_EMPTY);
break;