1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-18 01:30:56 +00:00

Reduces CheckingWriteProtect costs, negligibly.

This commit is contained in:
Thomas Harte 2019-07-15 22:39:55 -04:00
parent ca37fd8f4c
commit 67055d8b56

View File

@ -86,7 +86,7 @@ uint8_t IWM::read(int address) {
return uint8_t( return uint8_t(
(mode_&0x1f) | (mode_&0x1f) |
((state_ & ENABLE) ? 0x20 : 0x00) | ((state_ & ENABLE) ? 0x20 : 0x00) |
sense() (sense() & 0x80)
); );
} break; } break;
@ -292,8 +292,10 @@ void IWM::run_for(const Cycles cycles) {
break; break;
case ShiftMode::CheckingWriteProtect: case ShiftMode::CheckingWriteProtect:
while(--integer_cycles) { if(integer_cycles < 8) {
shift_register_ = (shift_register_ >> 1) | sense(); shift_register_ = (shift_register_ >> integer_cycles) | (sense() & (0xff << (8 - integer_cycles)));
} else {
shift_register_ = sense();
} }
/* Deliberate fallthrough. */ /* Deliberate fallthrough. */
@ -330,7 +332,7 @@ void IWM::select_shift_mode() {
} }
uint8_t IWM::sense() { uint8_t IWM::sense() {
return drives_[active_drive_] ? (drives_[active_drive_]->read() ? 0x80 : 0x00) : 0x80; return drives_[active_drive_] ? (drives_[active_drive_]->read() ? 0xff : 0x00) : 0xff;
} }
void IWM::process_event(const Storage::Disk::Drive::Event &event) { void IWM::process_event(const Storage::Disk::Drive::Event &event) {