1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-13 07:30:21 +00:00

Fiddles further with the tachometer.

This commit is contained in:
Thomas Harte 2019-06-06 21:36:19 -04:00
parent 7591906777
commit e9d0676e75
3 changed files with 33 additions and 6 deletions

View File

@ -122,8 +122,8 @@ uint8_t IWM::read(int address) {
break;
case CA1|CA0|SEL: // Tachometer (?)
printf("tachometer)\n");
sense = drives_[active_drive_] && drives_[active_drive_]->get_tachometer() ? 0x00 : 0x80;
printf("tachometer [%02x])\n", sense);
break;
// case CA2: // Read data, lower head.
@ -221,10 +221,34 @@ void IWM::access(int address) {
}
// printf("-> %c%c%c%c] ", (state_ & CA2) ? '2' : '-', (state_ & CA1) ? '1' : '-', (state_ & CA0) ? '0' : '-', (state_ & SEL) ? 'S' : '-');
// React appropriately to motor requests.
// React appropriately to motor requests and to LSTRB register writes.
switch(address >> 1) {
default: break;
case 3:
if(address & 1) {
switch(state_ & (CA1 | CA0 | SEL)) {
default: break;
case 0:
printf("LSTRB Set stepping direction: %d\n", state_ & CA2);
break;
case CA0:
printf("LSTRB Step\n");
break;
case CA1:
printf("LSTRB Motor on\n");
break;
case CA1|CA0:
printf("LSTRB Eject disk\n");
break;
}
}
break;
case 4:
if(address & 1) {
drive_motor_on_ = true;
@ -308,7 +332,7 @@ void IWM::propose_shift(uint8_t bit) {
// TODO: synchronous mode.
shift_register_ = uint8_t((shift_register_ << 1) | bit);
if(shift_register_ & 0x80) {
printf("%02x -> data\n", shift_register_);
// printf("%02x -> data\n", shift_register_);
data_register_ = shift_register_;
shift_register_ = 0;
}

View File

@ -284,7 +284,7 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
}
#ifdef LOG_TRACE
should_log |= (program_counter_.full - 4) == 0x004006F4;
should_log |= (program_counter_.full - 4) == 0x4181FA;//18A7A;//18AEE;
// should_log = ((program_counter_.full - 4) >= 0x417D9E) && ((program_counter_.full - 4) <= 0x419D96);
#endif

View File

@ -113,8 +113,11 @@ int Drive::get_head_count() {
}
bool Drive::get_tachometer() {
// First guess: the tachometer ticks once per rotation.
return get_rotation() > 0.5f;
// I have made a guess here that the tachometer is a symmetric square wave;
// if that is correct then around 60 beats per rotation appears to be correct
// to proceed beyond the speed checks I've so far uncovered.
const float ticks_per_rotation = 60.0f; // 56 was too low; 64 too high.
return int(get_rotation() * 2.0f * ticks_per_rotation) & 1;
}
float Drive::get_rotation() {