diff options
author | 2021-04-28 16:17:41 +0200 | |
---|---|---|
committer | 2021-04-28 16:17:56 +0200 | |
commit | 8709e06b673765ef76594de2878a4c48aa011b42 (patch) | |
tree | 723bf2b9ac26e8796de8001ac8e0ea3e85e92606 /src/lib/formats/fsblk_vec.cpp | |
parent | 3b24032ba84a083a8f93274f10136a3f14d522d0 (diff) |
floppy: start block-devicing fielsystem support
Diffstat (limited to 'src/lib/formats/fsblk_vec.cpp')
-rw-r--r-- | src/lib/formats/fsblk_vec.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/lib/formats/fsblk_vec.cpp b/src/lib/formats/fsblk_vec.cpp new file mode 100644 index 00000000000..a1f38898bcb --- /dev/null +++ b/src/lib/formats/fsblk_vec.cpp @@ -0,0 +1,39 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +// Block device on vector<uint8_t> + +#include "emu.h" +#include "fsblk_vec.h" + +const uint8_t *fsblk_vec_t::blk_t::rodata() +{ + return m_data; +} + +uint8_t *fsblk_vec_t::blk_t::data() +{ + return m_data; +} + +void fsblk_vec_t::blk_t::drop_weak_references() +{ +} + +uint32_t fsblk_vec_t::block_count() const +{ + return m_data.size() / m_block_size; +} + +fsblk_t::block_t fsblk_vec_t::get(uint32_t id) +{ + if(id >= block_count()) + fatalerror("Block number overflow: requiring block %d on device of size %d (%d bytes, block size %d)\n", id, block_count(), m_data.size(), m_block_size); + return block_t(new blk_t(m_data.data() + m_block_size*id, m_block_size)); +} + +void fsblk_vec_t::fill(uint8_t data) +{ + std::fill(m_data.begin(), m_data.end(), data); +} + |