diff options
author | 2021-03-04 10:49:33 +0100 | |
---|---|---|
committer | 2021-03-05 10:17:20 +0100 | |
commit | 92326e47afea2dd65ec6b5ec842454fc74f046cc (patch) | |
tree | 515de40cefa3c48bf30869f9031fbf78e4ba45d4 /src/lib/formats/fsmgr.cpp | |
parent | f7011c21e11e988ec26d095f48b9070760c72bc3 (diff) |
floppy: Beginning of the support for preformatted floppy images.
What's missing:
- parameters (like the disk name when it exists)
- possibly a cleanup of ram_open and friends (but not sure of the appropriate direction in which to go)
Diffstat (limited to 'src/lib/formats/fsmgr.cpp')
-rw-r--r-- | src/lib/formats/fsmgr.cpp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/lib/formats/fsmgr.cpp b/src/lib/formats/fsmgr.cpp new file mode 100644 index 00000000000..706de6a855b --- /dev/null +++ b/src/lib/formats/fsmgr.cpp @@ -0,0 +1,81 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +// Filesystem management code for floppy and hd images + +// Currently limited to floppies and creation of preformatted images + +#include "emu.h" +#include "fsmgr.h" + +void filesystem_manager_t::enumerate(floppy_enumerator &fe, uint32_t form_factor, const std::vector<uint32_t> &variants) const +{ +} + +void filesystem_manager_t::floppy_instantiate(u32 key, std::vector<u8> &image) const +{ + fprintf(stderr, "filesystem_manager_t::floppy_instantiate called while unsupported\n"); + abort(); +} + +void filesystem_manager_t::floppy_instantiate_raw(u32 key, floppy_image *image) const +{ + fprintf(stderr, "filesystem_manager_t::floppy_instantiate_raw called while unsupported\n"); + abort(); +} + +bool filesystem_manager_t::has_variant(const std::vector<uint32_t> &variants, uint32_t variant) +{ + for(uint32_t v : variants) + if(variant == v) + return true; + return false; +} + +void filesystem_manager_t::copy(std::vector<u8> &image, u32 offset, const u8 *src, u32 size) +{ + memcpy(image.data() + offset, src, size); +} + +void filesystem_manager_t::fill(std::vector<u8> &image, u32 offset, u8 data, u32 size) +{ + memset(image.data() + offset, data, size); +} + +void filesystem_manager_t::wstr(std::vector<u8> &image, u32 offset, const char *str) +{ + memcpy(image.data() + offset, str, strlen(str)+1); +} + +void filesystem_manager_t::w8(std::vector<u8> &image, u32 offset, u8 data) +{ + image[offset] = data; +} + +void filesystem_manager_t::w16b(std::vector<u8> &image, u32 offset, u16 data) +{ + image[offset ] = data >> 8; + image[offset+1] = data; +} + +void filesystem_manager_t::w32b(std::vector<u8> &image, u32 offset, u32 data) +{ + image[offset ] = data >> 24; + image[offset+1] = data >> 16; + image[offset+2] = data >> 8; + image[offset+3] = data; +} + +void filesystem_manager_t::w16l(std::vector<u8> &image, u32 offset, u16 data) +{ + image[offset ] = data; + image[offset+1] = data >> 8; +} + +void filesystem_manager_t::w32l(std::vector<u8> &image, u32 offset, u32 data) +{ + image[offset ] = data; + image[offset+1] = data >> 8; + image[offset+2] = data >> 16; + image[offset+3] = data >> 24; +} |