MEGA65 / mega65-core

MEGA65 FPGA core
Other
237 stars 84 forks source link

FREEZER: Reduce VIC IV Freeze Range; Save Errata Byte Separately #755

Closed johnwayner closed 6 months ago

johnwayner commented 6 months ago

Fixes: https://github.com/MEGA65/mega65-core/issues/753

The freeze_mem_list entry for $FFD3000 ($D000) was extended to include memory locations up to $D100 in an effort to include the new errata byte at $D08F (and, I think, to freeze additional, useful state). Unfortunately, this area includes at least one location that should not be written to when unfreezing: $D081. Writing to this location can cause changes to the sector buffers that contain the freezer data. The result of writing there is almost always fatal as the machine is unfrozen with huge parts of the memory basically empty -- including the ROMs. So that freeze_mem_list entry was reduced back down to only include locations up to $D07F.

To save the errata byte at $D08F, it was added to the freeze_scratch_area which is saved in the first sector of the freeze. However, we can not blindly overwrite $D08F if an older freeze is being unfrozen, so I've added a versioning system to ensure that only values that were supported when the freeze was made are restored.