mirror of
https://github.com/holub/mame
synced 2025-04-16 13:34:55 +03:00
srcclean and manual cleanup
This commit is contained in:
parent
afc4a360ba
commit
587598e618
@ -24,10 +24,10 @@
|
||||
#include "emu.h"
|
||||
#include "roland_sa.h"
|
||||
|
||||
DEFINE_DEVICE_TYPE(ROLAND_SA, roland_sa_device, "roland_sa", "Roland SA CPU-B Sound Generator")
|
||||
namespace {
|
||||
|
||||
// LUT for the address speed
|
||||
const uint32_t roland_sa_device::env_table[] = {
|
||||
const uint32_t env_table[] = {
|
||||
0x000000, 0x000023, 0x000026, 0x000029, 0x00002d, 0x000031, 0x000036,
|
||||
0x00003b, 0x000040, 0x000046, 0x00004c, 0x000052, 0x00005a, 0x000062,
|
||||
0x00006c, 0x000076, 0x000080, 0x00008c, 0x000098, 0x0000a4, 0x0000b4,
|
||||
@ -67,9 +67,14 @@ const uint32_t roland_sa_device::env_table[] = {
|
||||
0x097fff, 0x077fff, 0x04ffff, 0x027fff};
|
||||
|
||||
// LUT for bits 5/6/7/8 of the subphase
|
||||
const uint16_t roland_sa_device::addr_table[] = {0x1e0, 0x080, 0x060, 0x04d, 0x040, 0x036, 0x02d, 0x026,
|
||||
const uint16_t addr_table[] = {0x1e0, 0x080, 0x060, 0x04d, 0x040, 0x036, 0x02d, 0x026,
|
||||
0x020, 0x01b, 0x016, 0x011, 0x00d, 0x00a, 0x006, 0x003};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
DEFINE_DEVICE_TYPE(ROLAND_SA, roland_sa_device, "roland_sa", "Roland SA CPU-B Sound Generator")
|
||||
|
||||
roland_sa_device::roland_sa_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, ROLAND_SA, tag, owner, clock)
|
||||
, device_sound_interface(mconfig, *this)
|
||||
@ -162,22 +167,22 @@ void roland_sa_device::load_roms(uint8_t *ic5, uint8_t *ic6, uint8_t *ic7)
|
||||
// ROM IC10
|
||||
uint16_t r10_pos = i % 1024;
|
||||
uint16_t r10 = (uint16_t)round(exp2f(11.0 + ~r10_pos / 1024.0) - 1024);
|
||||
bool r10_9 = (r10 >> 0) & 1;
|
||||
bool r10_8 = (r10 >> 1) & 1;
|
||||
bool r10_0 = (r10 >> 2) & 1;
|
||||
bool r10_1 = (r10 >> 3) & 1;
|
||||
bool r10_2 = (r10 >> 4) & 1;
|
||||
bool r10_3 = !((r10 >> 5) & 1);
|
||||
bool r10_4 = !((r10 >> 6) & 1);
|
||||
bool r10_5 = !((r10 >> 7) & 1);
|
||||
bool r10_6 = !((r10 >> 8) & 1);
|
||||
bool r10_7 = !((r10 >> 9) & 1);
|
||||
bool r10_9 = BIT(r10, 0);
|
||||
bool r10_8 = BIT(r10, 1);
|
||||
bool r10_0 = BIT(r10, 2);
|
||||
bool r10_1 = BIT(r10, 3);
|
||||
bool r10_2 = BIT(r10, 4);
|
||||
bool r10_3 = BIT(~r10, 5);
|
||||
bool r10_4 = BIT(~r10, 6);
|
||||
bool r10_5 = BIT(~r10, 7);
|
||||
bool r10_6 = BIT(~r10, 8);
|
||||
bool r10_7 = BIT(~r10, 9);
|
||||
|
||||
bool wavein_sign = i >= 0x4000;
|
||||
uint8_t add_r_0 = ((i / 0x400) >> 0) & 1;
|
||||
uint8_t add_r_1 = ((i / 0x400) >> 1) & 1;
|
||||
uint8_t add_r_2 = ((i / 0x400) >> 2) & 1;
|
||||
uint8_t add_r_3 = ((i / 0x400) >> 3) & 1;
|
||||
uint8_t add_r_0 = BIT(i / 0x400, 0);
|
||||
uint8_t add_r_1 = BIT(i / 0x400, 1);
|
||||
uint8_t add_r_2 = BIT(i / 0x400, 2);
|
||||
uint8_t add_r_3 = BIT(i / 0x400, 3);
|
||||
|
||||
// Copy pasted from silicon
|
||||
bool result_b14 = !((!(!add_r_3 && !add_r_2 && !add_r_1 && !add_r_0) && !wavein_sign) || (!add_r_3 && !add_r_2 && !add_r_1 && !add_r_0 && wavein_sign));
|
||||
@ -206,58 +211,38 @@ void roland_sa_device::load_roms(uint8_t *ic5, uint8_t *ic6, uint8_t *ic7)
|
||||
// Wave rom values
|
||||
for (size_t i = 0; i < 0x20000; i++)
|
||||
{
|
||||
size_t descrambled_i = (
|
||||
((i >> 0) & 1) << 0 |
|
||||
((~i >> 1) & 1) << 1 |
|
||||
((i >> 2) & 1) << 2 |
|
||||
((~i >> 3) & 1) << 3 |
|
||||
((i >> 4) & 1) << 4 |
|
||||
((~i >> 5) & 1) << 5 |
|
||||
((i >> 6) & 1) << 6 |
|
||||
((i >> 7) & 1) << 7 |
|
||||
((~i >> 8) & 1) << 8 |
|
||||
((~i >> 9) & 1) << 9 |
|
||||
((i >> 10) & 1) << 10 |
|
||||
((i >> 11) & 1) << 11 |
|
||||
((i >> 12) & 1) << 12 |
|
||||
((i >> 13) & 1) << 13 |
|
||||
((i >> 14) & 1) << 14 |
|
||||
((i >> 15) & 1) << 15 |
|
||||
((i >> 16) & 1) << 16
|
||||
);
|
||||
const size_t descrambled_i = i ^ 0b0'00000011'00101010;
|
||||
|
||||
uint16_t exp_sample = (
|
||||
((ic5[descrambled_i] >> 0) & 1) << 13 |
|
||||
((ic6[descrambled_i] >> 4) & 1) << 12 |
|
||||
((ic7[descrambled_i] >> 4) & 1) << 11 |
|
||||
((~ic6[descrambled_i] >> 0) & 1) << 10 |
|
||||
((ic7[descrambled_i] >> 7) & 1) << 9 |
|
||||
((ic5[descrambled_i] >> 7) & 1) << 8 |
|
||||
((~ic5[descrambled_i] >> 5) & 1) << 7 |
|
||||
((ic6[descrambled_i] >> 2) & 1) << 6 |
|
||||
((ic7[descrambled_i] >> 2) & 1) << 5 |
|
||||
((ic7[descrambled_i] >> 1) & 1) << 4 |
|
||||
((~ic5[descrambled_i] >> 1) & 1) << 3 |
|
||||
((ic5[descrambled_i] >> 3) & 1) << 2 |
|
||||
((ic6[descrambled_i] >> 5) & 1) << 1 |
|
||||
((~ic6[descrambled_i] >> 7) & 1) << 0
|
||||
);
|
||||
bool exp_sign = (~ic7[descrambled_i] >> 3) & 1;
|
||||
const uint16_t exp_sample =
|
||||
BIT( ic5[descrambled_i], 0) << 13 |
|
||||
BIT( ic6[descrambled_i], 4) << 12 |
|
||||
BIT( ic7[descrambled_i], 4) << 11 |
|
||||
BIT(~ic6[descrambled_i], 0) << 10 |
|
||||
BIT( ic7[descrambled_i], 7) << 9 |
|
||||
BIT( ic5[descrambled_i], 7) << 8 |
|
||||
BIT(~ic5[descrambled_i], 5) << 7 |
|
||||
BIT( ic6[descrambled_i], 2) << 6 |
|
||||
BIT( ic7[descrambled_i], 2) << 5 |
|
||||
BIT( ic7[descrambled_i], 1) << 4 |
|
||||
BIT(~ic5[descrambled_i], 1) << 3 |
|
||||
BIT( ic5[descrambled_i], 3) << 2 |
|
||||
BIT( ic6[descrambled_i], 5) << 1 |
|
||||
BIT(~ic6[descrambled_i], 7) << 0;
|
||||
const bool exp_sign = BIT(~ic7[descrambled_i], 3);
|
||||
samples_exp[i] = exp_sample;
|
||||
samples_exp_sign[i] = exp_sign;
|
||||
|
||||
uint16_t delta_sample = (
|
||||
((~ic7[descrambled_i] >> 6) & 1) << 8 |
|
||||
((ic5[descrambled_i] >> 4) & 1) << 7 |
|
||||
((ic7[descrambled_i] >> 0) & 1) << 6 |
|
||||
((~ic6[descrambled_i] >> 3) & 1) << 5 |
|
||||
((ic5[descrambled_i] >> 2) & 1) << 4 |
|
||||
((~ic5[descrambled_i] >> 6) & 1) << 3 |
|
||||
((ic6[descrambled_i] >> 6) & 1) << 2 |
|
||||
((ic7[descrambled_i] >> 5) & 1) << 1 |
|
||||
((~ic6[descrambled_i] >> 7) & 1) << 0
|
||||
);
|
||||
bool delta_sign = (ic6[descrambled_i] >> 1) & 1;
|
||||
const uint16_t delta_sample =
|
||||
BIT(~ic7[descrambled_i], 6) << 8 |
|
||||
BIT( ic5[descrambled_i], 4) << 7 |
|
||||
BIT( ic7[descrambled_i], 0) << 6 |
|
||||
BIT(~ic6[descrambled_i], 3) << 5 |
|
||||
BIT( ic5[descrambled_i], 2) << 4 |
|
||||
BIT(~ic5[descrambled_i], 6) << 3 |
|
||||
BIT( ic6[descrambled_i], 6) << 2 |
|
||||
BIT( ic7[descrambled_i], 5) << 1 |
|
||||
BIT(~ic6[descrambled_i], 7) << 0;
|
||||
const bool delta_sign = BIT(ic6[descrambled_i], 1);
|
||||
samples_delta[i] = delta_sample;
|
||||
samples_delta_sign[i] = delta_sign;
|
||||
}
|
||||
@ -283,9 +268,7 @@ void roland_sa_device::sound_stream_update(sound_stream &stream, std::vector<rea
|
||||
{
|
||||
outputs[0].fill(0);
|
||||
|
||||
int32_t *int_buffer = new int32_t[outputs[0].samples()];
|
||||
for (size_t i = 0; i < outputs[0].samples(); i++)
|
||||
int_buffer[i] = 0;
|
||||
std::unique_ptr<int32_t []> int_buffer = make_unique_clear<int32_t []>(outputs[0].samples());
|
||||
|
||||
for (size_t voiceI = 0; voiceI < NUM_VOICES; voiceI++)
|
||||
{
|
||||
@ -425,6 +408,4 @@ void roland_sa_device::sound_stream_update(sound_stream &stream, std::vector<rea
|
||||
|
||||
for (size_t i = 0; i < outputs[0].samples(); i++)
|
||||
outputs[0].put_int(i, int_buffer[i], 0xffff);
|
||||
|
||||
delete[] int_buffer;
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ public:
|
||||
|
||||
protected:
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_start() override ATTR_COLD;
|
||||
virtual void device_reset() override ATTR_COLD;
|
||||
|
||||
// device_sound_interface implementation
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
@ -30,9 +30,6 @@ private:
|
||||
static constexpr unsigned NUM_VOICES = 16;
|
||||
static constexpr unsigned PARTS_PER_VOICE = 10;
|
||||
|
||||
static const uint32_t env_table[];
|
||||
static const uint16_t addr_table[];
|
||||
|
||||
uint16_t samples_exp[0x20000];
|
||||
bool samples_exp_sign[0x20000];
|
||||
uint16_t samples_delta[0x20000];
|
||||
|
@ -429,7 +429,7 @@ INPUT_PORTS_START(ob8)
|
||||
INPUT_PORTS_END
|
||||
|
||||
ROM_START(ob8)
|
||||
ROM_REGION(0X4000, MAINCPU_TAG, 0)
|
||||
ROM_REGION(0x4000, MAINCPU_TAG, 0)
|
||||
ROM_DEFAULT_BIOS("a8")
|
||||
|
||||
ROM_SYSTEM_BIOS(0, "a8", "OB-8 A8 OS")
|
||||
|
Loading…
Reference in New Issue
Block a user