Skip to content

Commit

Permalink
Fix SSD loading (#429)
Browse files Browse the repository at this point in the history
Don't stop "formatting" tracks beyond the end of the SSD; else
we leave unformatted blank space into which we can't save or
do anything useful. Closes #428
  • Loading branch information
mattgodbolt authored Aug 16, 2024
1 parent 971eca7 commit c5a4690
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions disc.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,6 @@ export function loadSsd(disc, data, isDsd, onChange) {

let offset = 0;
for (let track = 0; track < SsdFormat.tracksPerDisc; ++track) {
if (offset >= data.length) break;

for (let side = 0; side < numSides; ++side) {
const trackBuilder = disc.buildTrack(side === 1, track);
// Sync pattern at start of track, as the index pulse starts, aka GAP 5.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test-disc.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe("SSD loader tests", function () {
it("should load Elite", () => {
const disc = new Disc(true, new DiscConfig(), "test.ssd");
loadSsd(disc, data, false);
assert.equal(disc.tracksUsed, 46);
assert.equal(disc.tracksUsed, 80);
});
it("should roundtrip Elite", () => {
const disc = new Disc(true, new DiscConfig(), "test.ssd");
Expand Down

0 comments on commit c5a4690

Please sign in to comment.