diff options
Diffstat (limited to 'src/devices/sound/tc8830f.cpp')
-rw-r--r-- | src/devices/sound/tc8830f.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/devices/sound/tc8830f.cpp b/src/devices/sound/tc8830f.cpp index 06759146d93..1db6ab5bad4 100644 --- a/src/devices/sound/tc8830f.cpp +++ b/src/devices/sound/tc8830f.cpp @@ -37,7 +37,8 @@ tc8830f_device::tc8830f_device(const machine_config &mconfig, const char *tag, d m_output(0), m_command(0), m_cmd_rw(0), - m_phrase(0), m_mem_base(nullptr), m_mem_mask(0) + m_phrase(0), + m_mem(*this, DEVICE_SELF) { } @@ -47,9 +48,6 @@ void tc8830f_device::device_start() // create the stream m_stream = stream_alloc(0, 1, clock() / 0x10); - m_mem_base = region()->base(); - m_mem_mask = region()->bytes() - 1; - // register for savestates save_item(NAME(m_playing)); save_item(NAME(m_address)); @@ -90,11 +88,11 @@ void tc8830f_device::sound_stream_update(sound_stream &stream, stream_sample_t * if (m_playing) { // get bit - int bit = m_mem_base[m_address] >> m_bitcount & 1; + int bit = m_mem[m_address] >> m_bitcount & 1; m_bitcount = (m_bitcount + 1) & 7; if (m_bitcount == 0) { - m_address = (m_address + 1) & m_mem_mask; + m_address = (m_address + 1) & m_mem.mask(); if (m_address == m_stop_address) m_playing = false; } @@ -199,7 +197,7 @@ void tc8830f_device::write_p(UINT8 data) m_address = (m_address & ~(0xf << (m_cmd_rw*4))) | (data << (m_cmd_rw*4)); if (m_cmd_rw == 5) { - m_address &= m_mem_mask; + m_address &= m_mem.mask(); m_bitcount = 0; m_cmd_rw = -1; } @@ -210,7 +208,7 @@ void tc8830f_device::write_p(UINT8 data) m_stop_address = (m_stop_address & ~(0xf << (m_cmd_rw*4))) | (data << (m_cmd_rw*4)); if (m_cmd_rw == 5) { - m_stop_address &= m_mem_mask; + m_stop_address &= m_mem.mask(); m_cmd_rw = -1; } break; @@ -234,9 +232,9 @@ void tc8830f_device::write_p(UINT8 data) // update addresses and start UINT8 offs = m_phrase * 4; - m_address = (m_mem_base[offs] | m_mem_base[offs|1]<<8 | m_mem_base[offs|2]<<16) & m_mem_mask; + m_address = (m_mem[offs] | m_mem[offs|1]<<8 | m_mem[offs|2]<<16) & m_mem.mask(); offs += 4; - m_stop_address = (m_mem_base[offs] | m_mem_base[offs|1]<<8 | m_mem_base[offs|2]<<16) & m_mem_mask; + m_stop_address = (m_mem[offs] | m_mem[offs|1]<<8 | m_mem[offs|2]<<16) & m_mem.mask(); m_bitcount = 0; m_prevbits = 0; |