mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-27 00:30:26 +00:00
Adds notes on intended meaning of status register.
This commit is contained in:
parent
b49cc407c6
commit
117f9a9794
@ -17,12 +17,30 @@ EXDos::EXDos() : WD1770(P1770) {
|
|||||||
|
|
||||||
void EXDos::set_disk(std::shared_ptr<Storage::Disk::Disk> disk, size_t drive) {
|
void EXDos::set_disk(std::shared_ptr<Storage::Disk::Disk> disk, size_t drive) {
|
||||||
get_drive(drive).set_disk(disk);
|
get_drive(drive).set_disk(disk);
|
||||||
|
disk_did_change_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXDos::set_control_register(uint8_t control) {
|
// Documentation for the control register:
|
||||||
printf("Control: %02x\n", control);
|
//
|
||||||
|
// Write:
|
||||||
|
// b7 in use (???)
|
||||||
|
// b6 disk change reset
|
||||||
|
// b5 0 = double density, 1 = single density
|
||||||
|
// b4 side 1 select
|
||||||
|
// b3, b3, b1, b0 select drive 3, 2, 1, 0
|
||||||
|
//
|
||||||
|
// Read:
|
||||||
|
// b7 data request from WD1770
|
||||||
|
// b6 disk change
|
||||||
|
// b5, b4, b3, b2: not used
|
||||||
|
// b1 interrupt request from WD1770
|
||||||
|
// b0 drive ready
|
||||||
|
|
||||||
last_control_ = control;
|
void EXDos::set_control_register(uint8_t control) {
|
||||||
|
printf("Set control: %02x\n", control);
|
||||||
|
|
||||||
|
if(control & 0x40) disk_did_change_ = false;
|
||||||
|
set_is_double_density(!(control & 0x20));
|
||||||
|
|
||||||
// Set side.
|
// Set side.
|
||||||
const int head = (control >> 4) & 1;
|
const int head = (control >> 4) & 1;
|
||||||
@ -38,16 +56,19 @@ void EXDos::set_control_register(uint8_t control) {
|
|||||||
set_drive(c);
|
set_drive(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: seems like bit 6 might be connected to the drive's RDY line?
|
|
||||||
|
|
||||||
// TODO: does part of this register select double/single density mode?
|
|
||||||
// Probably either bit 5 or bit 7 of the control register?
|
|
||||||
set_is_double_density(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t EXDos::get_control_register() {
|
uint8_t EXDos::get_control_register() {
|
||||||
return last_control_ | (get_drive().get_is_ready() ? 0x40 : 0x00);
|
// TODO: how does disk_did_change_ really work? Presumably
|
||||||
|
// it latches RDY?
|
||||||
|
const uint8_t status =
|
||||||
|
(get_data_request_line() ? 0x80 : 0x00) |
|
||||||
|
(disk_did_change_ ? 0x40 : 0x00) |
|
||||||
|
(get_interrupt_request_line() ? 0x02 : 0x00) |
|
||||||
|
(get_drive().get_is_ready() ? 0x01 : 0x00);
|
||||||
|
|
||||||
|
printf("Get status: %02x\n", status);
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXDos::set_motor_on(bool on) {
|
void EXDos::set_motor_on(bool on) {
|
||||||
|
@ -24,7 +24,7 @@ class EXDos final : public WD::WD1770 {
|
|||||||
uint8_t get_control_register();
|
uint8_t get_control_register();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t last_control_ = 0;
|
bool disk_did_change_ = false;
|
||||||
|
|
||||||
void set_motor_on(bool on) override;
|
void set_motor_on(bool on) override;
|
||||||
};
|
};
|
||||||
|
@ -287,7 +287,7 @@ template <bool has_disk_controller> class ConcreteMachine:
|
|||||||
case 0xa4: case 0xa5: case 0xa6: case 0xa7:
|
case 0xa4: case 0xa5: case 0xa6: case 0xa7:
|
||||||
case 0xa8: case 0xa9: case 0xaa: case 0xab:
|
case 0xa8: case 0xa9: case 0xaa: case 0xab:
|
||||||
case 0xac: case 0xad: case 0xae: case 0xaf:
|
case 0xac: case 0xad: case 0xae: case 0xaf:
|
||||||
printf("TODO: audio adjust %04x <- %02x\n", address, *cycle.value);
|
// printf("TODO: audio adjust %04x <- %02x\n", address, *cycle.value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0xb4:
|
case 0xb4:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user