Complete block encoding function now works, with lots of sanity checks.
The code is capable of correctly filling any arbitrary gap size using the gap streams, proportionally to the original filler areas (i.e. if one pattern was using more space, it would do the same regardless of whether the area has been shrunk or enlarged) as long as altering the gap size is allowed.
For the record, the new core now is exactly 1777 lines...
MFM fixup now implemented.