diff options
Diffstat (limited to 'src/lib/formats/fs_coco_os9.cpp')
-rw-r--r-- | src/lib/formats/fs_coco_os9.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/lib/formats/fs_coco_os9.cpp b/src/lib/formats/fs_coco_os9.cpp index f8a14c7acdd..334bb9d5b79 100644 --- a/src/lib/formats/fs_coco_os9.cpp +++ b/src/lib/formats/fs_coco_os9.cpp @@ -364,7 +364,7 @@ std::pair<err_t, std::vector<u8>> coco_os9_impl::file_read(const std::vector<std err_t coco_os9_impl::format(const meta_data &meta) { // for some reason, the OS-9 world favored filling with 0xE5 - m_blockdev.fill(0xE5); + m_blockdev.fill(0xe5); // identify geometry info u8 sectors = 18; // TODO - we need a definitive technique to get the floppy geometry @@ -428,7 +428,7 @@ err_t coco_os9_impl::format(const meta_data &meta) { u32 pos = (i * sector_bytes + j) * 8; if (pos + 8 < total_allocated_sectors) - abblk_bytes[j] = 0xFF; + abblk_bytes[j] = 0xff; else if (pos >= total_allocated_sectors) abblk_bytes[j] = 0x00; else @@ -442,28 +442,28 @@ err_t coco_os9_impl::format(const meta_data &meta) // root directory header auto roothdr_blk = m_blockdev.get(1 + allocation_bitmap_lsns); roothdr_blk.fill(0x00); - roothdr_blk.w8(0x00, 0xBF); + roothdr_blk.w8(0x00, 0xbf); roothdr_blk.w8(0x01, 0x00); roothdr_blk.w8(0x02, 0x00); roothdr_blk.w24b(0x03, creation_os9date); roothdr_blk.w16b(0x06, creation_os9time); roothdr_blk.w8(0x08, 0x01); roothdr_blk.w8(0x09, 0x00); - roothdr_blk.w8(0x0A, 0x00); - roothdr_blk.w8(0x0B, 0x00); - roothdr_blk.w8(0x0C, 0x40); - roothdr_blk.w24b(0x0D, creation_os9date); + roothdr_blk.w8(0x0a, 0x00); + roothdr_blk.w8(0x0b, 0x00); + roothdr_blk.w8(0x0c, 0x40); + roothdr_blk.w24b(0x0d, creation_os9date); roothdr_blk.w24b(0x10, 1 + allocation_bitmap_lsns + 1); roothdr_blk.w16b(0x13, 8); // root directory data auto rootdata_blk = m_blockdev.get(1 + allocation_bitmap_lsns + 1); rootdata_blk.fill(0x00); - rootdata_blk.w8(0x00, 0x2E); - rootdata_blk.w8(0x01, 0xAE); - rootdata_blk.w8(0x1F, 1 + allocation_bitmap_lsns); - rootdata_blk.w8(0x20, 0xAE); - rootdata_blk.w8(0x3F, 1 + allocation_bitmap_lsns); + rootdata_blk.w8(0x00, 0x2e); + rootdata_blk.w8(0x01, 0xae); + rootdata_blk.w8(0x1f, 1 + allocation_bitmap_lsns); + rootdata_blk.w8(0x20, 0xae); + rootdata_blk.w8(0x3f, 1 + allocation_bitmap_lsns); return ERR_OK; } @@ -580,7 +580,7 @@ std::string coco_os9_impl::pick_os9_string(std::string_view raw_string) // and add the final character if we have to if (iter < raw_string.end() && *iter & 0x80) - result.append(1, *iter & 0x7F); + result.append(1, *iter & 0x7f); return result; } @@ -595,7 +595,7 @@ std::string coco_os9_impl::to_os9_string(std::string_view s, size_t length) std::string result(length, '\0'); for (auto i = 0; i < std::min(length, s.size()); i++) { - result[i] = (s[i] & 0x7F) + result[i] = (s[i] & 0x7f) | (i == s.size() ? 0x80 : 0x00); } return result; @@ -610,11 +610,11 @@ util::arbitrary_datetime coco_os9_impl::from_os9_date(u32 os9_date, u16 os9_time { util::arbitrary_datetime dt; memset(&dt, 0, sizeof(dt)); - dt.year = ((os9_date >> 16) & 0xFF) + 1900; - dt.month = (os9_date >> 8) & 0xFF; - dt.day_of_month = (os9_date >> 0) & 0xFF; - dt.hour = (os9_time >> 8) & 0xFF; - dt.minute = (os9_time >> 0) & 0xFF; + dt.year = ((os9_date >> 16) & 0xff) + 1900; + dt.month = (os9_date >> 8) & 0xff; + dt.day_of_month = (os9_date >> 0) & 0xff; + dt.hour = (os9_time >> 8) & 0xff; + dt.minute = (os9_time >> 0) & 0xff; return dt; } @@ -625,11 +625,11 @@ util::arbitrary_datetime coco_os9_impl::from_os9_date(u32 os9_date, u16 os9_time std::tuple<u32, u16> coco_os9_impl::to_os9_date(const util::arbitrary_datetime &datetime) { - u32 os9_date = ((datetime.year - 1900) & 0xFF) << 16 - | (datetime.month & 0xFF) << 8 - | (datetime.day_of_month & 0xFF) << 0; - u16 os9_time = (datetime.hour & 0xFF) << 8 - | (datetime.minute & 0xFF) << 0; + u32 os9_date = ((datetime.year - 1900) & 0xff) << 16 + | (datetime.month & 0xff) << 8 + | (datetime.day_of_month & 0xff) << 0; + u16 os9_time = (datetime.hour & 0xff) << 8 + | (datetime.minute & 0xff) << 0; return std::make_tuple(os9_date, os9_time); } |