Skip to content

Commit

Permalink
Merge pull request #3 from huey1116/main
Browse files Browse the repository at this point in the history
fix bug involving disk reads
  • Loading branch information
MESYETI authored Nov 15, 2023
2 parents c9094cc + 85a6983 commit 00ec53c
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions source/devices/disk.d
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,19 @@ class Disk : Device {
if (input.length < 3) {
return;
}

ushort sector = input[1];
ushort amount = input[2];

data ~= cast(ushort) 'R';

for (uint i = sector; i < sector + amount; ++ i) {
uint sectorStart = i * 512;
uint sectorEnd = sectorStart + 512;

for (uint j = sectorStart; j < sectorEnd; ++ j) {
data ~= diskData[j];
}
for (uint i = 512*sector; i < 512*(sector + amount); ++ i) {
data ~= diskData[i];
}
input = [];
waiting = false;
break;
}
case 'W': {
case 'W': { // todo: test writes
if (input.length < 514) {
return;
}
Expand Down

0 comments on commit 00ec53c

Please sign in to comment.