For some reason, the merge broke the Write Cbl Data - CART functionality in the dbg menu.
The main problem is that writing a whole sector of data and erasing a sector is too slow to do in an IRQ handler.
Fix: Move the actual flash writing process to the main loop by creating a function called handleCartIO().
The IRQ handler writes to global_memory_buffer, and the handleCartIO() copies that
data to a local write buffer while the IRQ may still add more to global_memory_buffer.
Then it modifies the IRQ handlers' offset and moves the data that was appended in between to the start of the buffer all while
the IRQ handler is still appending new bytes.
If we end up at a sector boundary, we also do the erase_sector() call.
This was tested with and without the print link and print packets debug options.
Without the print options enabled, we end up occupying about 20KB on the cartridge save. (for 1st stage only!)
Man, this bug sucked. I rate it 1 star!