mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-23 06:31:28 +00:00
cdromdrive: convert MSF values to BCD.
This commit is contained in:
parent
f31c71e430
commit
a81156c3e3
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||||
Copyright (C) 2018-23 divingkatae and maximum
|
Copyright (C) 2018-24 divingkatae and maximum
|
||||||
(theweirdo) spatium
|
(theweirdo) spatium
|
||||||
|
|
||||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||||
@ -138,8 +138,17 @@ uint32_t CdromDrive::report_capacity(uint8_t *data_ptr) {
|
|||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t CdromDrive::hex_to_bcd(const uint8_t val) {
|
||||||
|
uint8_t hi = val / 10;
|
||||||
|
uint8_t lo = val % 10;
|
||||||
|
return (hi << 4) | lo;
|
||||||
|
}
|
||||||
|
|
||||||
AddrMsf CdromDrive::lba_to_msf(const int lba) {
|
AddrMsf CdromDrive::lba_to_msf(const int lba) {
|
||||||
return {lba / 4500, /*.min*/ (lba / 75) % 60, /*.sec*/ lba % 75 /*.frm*/};
|
return {hex_to_bcd( lba / 4500), /*.min*/
|
||||||
|
hex_to_bcd((lba / 75) % 60), /*.sec*/
|
||||||
|
hex_to_bcd( lba % 75) /*.frm*/
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CdromDrive::read_toc(uint8_t *cmd_ptr, uint8_t *data_ptr) {
|
uint32_t CdromDrive::read_toc(uint8_t *cmd_ptr, uint8_t *data_ptr) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||||
Copyright (C) 2018-23 divingkatae and maximum
|
Copyright (C) 2018-24 divingkatae and maximum
|
||||||
(theweirdo) spatium
|
(theweirdo) spatium
|
||||||
|
|
||||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||||
@ -69,6 +69,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::function<void(uint8_t, uint8_t)> set_error;
|
std::function<void(uint8_t, uint8_t)> set_error;
|
||||||
|
uint8_t hex_to_bcd(const uint8_t val);
|
||||||
AddrMsf lba_to_msf(const int lba);
|
AddrMsf lba_to_msf(const int lba);
|
||||||
|
|
||||||
TrackDescriptor tracks[CDROM_MAX_TRACKS];
|
TrackDescriptor tracks[CDROM_MAX_TRACKS];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user