| 111 | |
| 112 | public: |
| 113 | std::unique_ptr<Fluxmap> encode(const LogicalTrackLayout& ltl, |
| 114 | const std::vector<std::shared_ptr<const Sector>>& sectors, |
| 115 | const Image& image) override |
| 116 | { |
| 117 | /* Number of bits for one nominal revolution of a real 200ms Amiga disk. |
| 118 | */ |
| 119 | int bitsPerRevolution = 200e3 / _config.clock_rate_us(); |
| 120 | std::vector<bool> bits(bitsPerRevolution); |
| 121 | unsigned cursor = 0; |
| 122 | |
| 123 | fillBitmapTo(bits, |
| 124 | cursor, |
| 125 | _config.post_index_gap_ms() * 1000 / _config.clock_rate_us(), |
| 126 | {true, false}); |
| 127 | lastBit = false; |
| 128 | |
| 129 | for (const auto& sector : sectors) |
| 130 | write_sector(bits, cursor, sector); |
| 131 | |
| 132 | if (cursor >= bits.size()) |
| 133 | error("track data overrun"); |
| 134 | fillBitmapTo(bits, cursor, bits.size(), {true, false}); |
| 135 | |
| 136 | auto fluxmap = std::make_unique<Fluxmap>(); |
| 137 | fluxmap->appendBits(bits, |
| 138 | calculatePhysicalClockPeriod(_config.clock_rate_us() * 1e3, 200e6)); |
| 139 | return fluxmap; |
| 140 | } |
| 141 | |
| 142 | private: |
| 143 | const AmigaEncoderProto& _config; |
nothing calls this directly
no test coverage detected