summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats/fs_coco_os9.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2024-07-25 06:51:43 +1000
committer Vas Crabb <vas@vastheman.com>2024-07-25 06:51:43 +1000
commitbf6d5d7a2deee1224bb845bcba4c30ec4e55e64f (patch)
tree63ce482fb8cdb6997e87d801b7e01db2268897e5 /src/lib/formats/fs_coco_os9.cpp
parent932108930d3e717778e53ebae75f1bff5da4a6b1 (diff)
Miscellaneous fixes:
igspgmcrypt.cpp: Fixed a recently-introduced Endianness issue. sega/dsbz80.cpp: Don't leak the MPEG audio decoder. sega/dsbz80.cpp: Don't initialise the sample buffer on construction - it happens on reset anyway. formats/fs_coco_os9.cpp: Use lowercase for hexadecimal literals.
Diffstat (limited to 'src/lib/formats/fs_coco_os9.cpp')
-rw-r--r--src/lib/formats/fs_coco_os9.cpp48
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);
}