MSM6258: start work - DO NOT USE!

This commit is contained in:
tildearrow 2022-05-23 19:01:10 -05:00
parent b849b5283b
commit 8ea60f37c5
6 changed files with 486 additions and 6 deletions

View file

@ -12,6 +12,7 @@
#include "okim6258.h"
#include <stdio.h>
#include <string.h>
#include <math.h>
@ -113,6 +114,7 @@ void okim6258_device::device_start()
m_signal = -2;
m_step = 0;
m_has_data = false;
}
@ -125,6 +127,7 @@ void okim6258_device::device_reset()
m_signal = -2;
m_step = 0;
m_status = 0;
m_has_data = false;
}
@ -150,6 +153,8 @@ void okim6258_device::sound_stream_update(short** outputs, int len)
nibble_shift ^= 4;
if (nibble_shift==0) m_has_data=false;
buffer[sampindex]=sample;
}
@ -241,10 +246,13 @@ uint8_t okim6258_device::status_r()
okim6258_data_w -- write to the control port of an OKIM6258-compatible chip
***********************************************************************************************/
void okim6258_device::data_w(uint8_t data)
bool okim6258_device::data_w(uint8_t data)
{
if (m_has_data) return false;
m_data_in = data;
m_nibble_shift = 0;
m_has_data = true;
return true;
}
@ -259,6 +267,8 @@ void okim6258_device::ctrl_w(uint8_t data)
if (data & COMMAND_STOP)
{
m_status &= ~(STATUS_PLAYING | STATUS_RECORDING);
m_has_data = false;
printf("stopping\n");
return;
}
@ -272,6 +282,7 @@ void okim6258_device::ctrl_w(uint8_t data)
m_signal = -2;
m_step = 0;
m_nibble_shift = 0;
printf("playing\n");
}
}
else

View file

@ -31,19 +31,19 @@ public:
void set_outbits(int outbit) { m_output_bits = outbit; }
uint8_t status_r();
void data_w(uint8_t data);
bool data_w(uint8_t data);
void ctrl_w(uint8_t data);
void set_divider(int val);
int get_vclk();
// device-levels
virtual void device_start();
virtual void device_reset();
virtual void device_clock_changed();
void device_start();
void device_reset();
void device_clock_changed();
// sound stream updates
virtual void sound_stream_update(short** outputs, int len);
void sound_stream_update(short** outputs, int len);
private:
int16_t clock_adpcm(uint8_t nibble);
@ -54,6 +54,7 @@ private:
uint32_t m_divider; /* master clock divider */
uint8_t m_adpcm_type; /* 3/4 bit ADPCM select */
uint8_t m_data_in; /* ADPCM data-in register */
bool m_has_data; /* whether we already have data */
uint8_t m_nibble_shift; /* nibble select */
uint8_t m_output_bits; /* D/A precision is 10-bits but 12-bit data can be