1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 16:31:31 +00:00

Merge pull request #757 from TomHarte/ByteDrive

Updates Byte Drive implementation as per latest information.
This commit is contained in:
Thomas Harte 2020-02-16 21:16:58 -05:00 committed by GitHub
commit 5400c47f07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,13 @@
using namespace Oric;
/*
Notes on the code below: the Byte Drive 500 isn't well documented; this implementation is based on
experimentation without access to real hardware as documented in http://forum.defence-force.org/viewtopic.php?f=25&t=2055
and with additional guidance from iss of Oricutron (amongst other things) elsewhere,
e.g. http://forum.defence-force.org/viewtopic.php?f=22&t=1698&start=105#p21468
*/
BD500::BD500() : DiskController(P1793, 9000000, Storage::Disk::Drive::ReadyType::ShugartModifiedRDY) {
disable_basic_rom_ = true;
select_paged_item();
@ -57,9 +64,10 @@ void BD500::access(int address) {
case 0x0320: case 0x0321: case 0x0322: case 0x0323: case 0x0312:
return;
case 0x310: enable_overlay_ram_ = true; break;
case 0x311: disable_basic_rom_ = true; break;
case 0x313: enable_overlay_ram_ = false; break;
case 0x317: disable_basic_rom_ = false; break; // Could be 0x311.
case 0x314: enable_overlay_ram_ = true; break;
case 0x317: disable_basic_rom_ = false; break;
default:
// printf("Switch %04x???\n", address);
@ -69,60 +77,6 @@ void BD500::access(int address) {
select_paged_item();
}
/*
The following was used when trying to find appropriate soft switch locations. It is preserved
as the values I have above are unlikely to be wholly correct and further research might be
desirable.
void BD500::access(int address) {
// 0,1,4,5,10,11 -> 64kb Atmos
// 2,3,9 -> 56kb Atmos.
// Broken: 6, 7, 8
int order = 5;
int commands[4];
std::vector<int> available_commands = {0, 1, 2, 3};
const int modulos[] = {6, 2, 1, 1};
for(int c = 0; c < 4; ++c) {
const int index = order / modulos[c];
commands[c] = available_commands[size_t(index)];
available_commands.erase(available_commands.begin() + index);
order %= modulos[c];
}
// Determine whether to perform a command.
int index = -1;
switch(address) {
case 0x0320: case 0x0321: case 0x0322: case 0x0323: case 0x0312:
return;
case 0x310: index = 0; break;
case 0x313: index = 1; break;
case 0x314: index = 2; break;
case 0x317: index = 3; break;
default:
printf("Switch %04x???\n", address);
break;
}
select_paged_item();
if(index >= 0) {
switch(commands[index]) {
case 0: enable_overlay_ram_ = true; break; // +RAM
case 1: disable_basic_rom_ = false; break; // -rom
case 2: disable_basic_rom_ = true; break; // +rom
case 3: enable_overlay_ram_ = false; break; // -RAM
}
select_paged_item();
}
}
*/
void BD500::set_head_load_request(bool head_load) {
// Turn all motors on or off; if off then unload the head instantly.
is_loading_head_ |= head_load;