diff --git a/Components/1770/1770.cpp b/Components/1770/1770.cpp index c0e2a1bca..72956a8b9 100644 --- a/Components/1770/1770.cpp +++ b/Components/1770/1770.cpp @@ -624,6 +624,18 @@ void WD1770::posit_event(Event new_event_type) { write_byte(0); } + WAIT_FOR_EVENT(Event::DataWritten); + + if(is_double_density_) + { + write_raw_short(Storage::Encodings::MFM::MFMAddressMark); + write_byte(command_&1 ? Storage::Encodings::MFM::MFMDataAddressByte : Storage::Encodings::MFM::MFMDeletedDataAddressByte); + } + else + { + write_raw_short(command_&1 ? Storage::Encodings::MFM::FMDeletedDataAddressMark : Storage::Encodings::MFM::FMDataAddressMark); + } + WAIT_FOR_EVENT(Event::DataWritten); distance_into_section_ = 0; @@ -716,3 +728,11 @@ void WD1770::write_byte(uint8_t byte) { for(int c = 0; c < 8; c++) write_bit((byte << c)&0x80); } + +void WD1770::write_raw_short(uint16_t value) +{ + for(int c = 0; c < 16; c++) + { + Controller::write_bit(!!((value << c)&0x8000)); + } +} diff --git a/Components/1770/1770.hpp b/Components/1770/1770.hpp index 3aaefef88..a91796828 100644 --- a/Components/1770/1770.hpp +++ b/Components/1770/1770.hpp @@ -124,6 +124,7 @@ class WD1770: public Storage::Disk::Controller { int last_bit_; void write_bit(int bit); void write_byte(uint8_t byte); + void write_raw_short(uint16_t value); // ID buffer uint8_t header_[6];