1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Made an attempt to write the proper address mark.

This commit is contained in:
Thomas Harte 2016-12-25 20:15:07 -05:00
parent beaa868079
commit e2b829f68e
2 changed files with 21 additions and 0 deletions

View File

@ -624,6 +624,18 @@ void WD1770::posit_event(Event new_event_type)
{ {
write_byte(0); 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); WAIT_FOR_EVENT(Event::DataWritten);
distance_into_section_ = 0; 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); 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));
}
}

View File

@ -124,6 +124,7 @@ class WD1770: public Storage::Disk::Controller {
int last_bit_; int last_bit_;
void write_bit(int bit); void write_bit(int bit);
void write_byte(uint8_t byte); void write_byte(uint8_t byte);
void write_raw_short(uint16_t value);
// ID buffer // ID buffer
uint8_t header_[6]; uint8_t header_[6];