summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2016-11-20 16:58:11 -0500
committer arbee <rb6502@users.noreply.github.com>2016-11-20 16:58:11 -0500
commit792b4fe159e77b2b61a78a7b8df159390043a3bc (patch)
tree9a38f88bf656a545250482c9402a4ab2abe4574e
parenteee0e0815e61121716a08fb67f3160f964758241 (diff)
sc499: corrected regressions that prevented writing [Hans Ostermeyer]
-rw-r--r--src/devices/bus/isa/sc499.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/devices/bus/isa/sc499.cpp b/src/devices/bus/isa/sc499.cpp
index 3d1e60f873d..0623733f65d 100644
--- a/src/devices/bus/isa/sc499.cpp
+++ b/src/devices/bus/isa/sc499.cpp
@@ -1257,6 +1257,10 @@ void sc499_device::write_block()
check_tape();
}
+ // write block to image file as well
+ m_image->fseek((int64_t) m_tape_pos * SC499_CTAPE_BLOCK_SIZE, SEEK_SET);
+ m_image->fwrite(&m_ctape_block_buffer[0], SC499_CTAPE_BLOCK_SIZE);
+
m_image->write_block(m_tape_pos, &m_ctape_block_buffer[0]);
m_ctape_block_count = m_tape_pos;
m_ctape_block_index = 0;
@@ -1313,7 +1317,7 @@ void sc499_ctape_image_device::device_config_complete()
uint8_t *sc499_ctape_image_device::read_block(int block_num)
{
// access beyond end of tape cart
- if (m_ctape_data.size() <= (block_num + 1) * SC499_CTAPE_BLOCK_SIZE)
+ if (m_ctape_data.size() < (block_num + 1) * SC499_CTAPE_BLOCK_SIZE)
return nullptr;
else
return &m_ctape_data[block_num * SC499_CTAPE_BLOCK_SIZE];
@@ -1321,8 +1325,10 @@ uint8_t *sc499_ctape_image_device::read_block(int block_num)
void sc499_ctape_image_device::write_block(int block_num, uint8_t *ptr)
{
- if (!(m_ctape_data.size() <= (block_num + 1) * SC499_CTAPE_BLOCK_SIZE))
- memcpy(&m_ctape_data[block_num * SC499_CTAPE_BLOCK_SIZE], ptr, SC499_CTAPE_BLOCK_SIZE);
+ if ((m_ctape_data.size() < (block_num + 1) * SC499_CTAPE_BLOCK_SIZE))
+ m_ctape_data.resize((block_num + 1) * SC499_CTAPE_BLOCK_SIZE);
+
+ memcpy(&m_ctape_data[block_num * SC499_CTAPE_BLOCK_SIZE], ptr, SC499_CTAPE_BLOCK_SIZE);
}
image_init_result sc499_ctape_image_device::call_load()