1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-05 10:28:58 +00:00

Adds write support.

This commit is contained in:
Thomas Harte 2019-08-25 15:16:35 -04:00
parent 5598802439
commit 30cef1ee22
2 changed files with 7 additions and 0 deletions

View File

@ -31,3 +31,9 @@ std::vector<uint8_t> HFV::get_block(size_t address) {
file_.seek(file_offset, SEEK_SET);
return file_.read(get_block_size());
}
void HFV::set_block(size_t address, const std::vector<uint8_t> &contents) {
const long file_offset = long(get_block_size() * address);
file_.seek(file_offset, SEEK_SET);
file_.write(contents);
}

View File

@ -29,6 +29,7 @@ class HFV: public MassStorageDevice {
size_t get_block_size() final;
size_t get_number_of_blocks() final;
std::vector<uint8_t> get_block(size_t address) final;
void set_block(size_t address, const std::vector<uint8_t> &) final;
};