File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
2
DingusPPC - The Experimental PowerPC Macintosh emulator
3
- Copyright (C) 2018-23 divingkatae and maximum
3
+ Copyright (C) 2018-24 divingkatae and maximum
4
4
(theweirdo) spatium
5
5
6
6
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
@@ -138,8 +138,17 @@ uint32_t CdromDrive::report_capacity(uint8_t *data_ptr) {
138
138
return 8 ;
139
139
}
140
140
141
+ uint8_t CdromDrive::hex_to_bcd (const uint8_t val) {
142
+ uint8_t hi = val / 10 ;
143
+ uint8_t lo = val % 10 ;
144
+ return (hi << 4 ) | lo;
145
+ }
146
+
141
147
AddrMsf CdromDrive::lba_to_msf (const int lba) {
142
- return {lba / 4500 , /* .min*/ (lba / 75 ) % 60 , /* .sec*/ lba % 75 /* .frm*/ };
148
+ return {hex_to_bcd ( lba / 4500 ), /* .min*/
149
+ hex_to_bcd ((lba / 75 ) % 60 ), /* .sec*/
150
+ hex_to_bcd ( lba % 75 ) /* .frm*/
151
+ };
143
152
}
144
153
145
154
uint32_t CdromDrive::read_toc (uint8_t *cmd_ptr, uint8_t *data_ptr) {
Original file line number Diff line number Diff line change 1
1
/*
2
2
DingusPPC - The Experimental PowerPC Macintosh emulator
3
- Copyright (C) 2018-23 divingkatae and maximum
3
+ Copyright (C) 2018-24 divingkatae and maximum
4
4
(theweirdo) spatium
5
5
6
6
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
@@ -69,6 +69,7 @@ class CdromDrive : public BlockStorageDevice {
69
69
70
70
protected:
71
71
std::function<void (uint8_t , uint8_t )> set_error;
72
+ uint8_t hex_to_bcd (const uint8_t val);
72
73
AddrMsf lba_to_msf (const int lba);
73
74
74
75
TrackDescriptor tracks[CDROM_MAX_TRACKS];
You can’t perform that action at this time.
0 commit comments