slight improvement

This commit is contained in:
Denis Molony 2015-12-14 07:19:57 +11:00
parent 4a36fa395c
commit 037a0519a0

View File

@ -24,22 +24,24 @@ public class BootSector extends AbstractSector
// The first byte in the buffer is the number of sectors to read in (minus 1)
int sectors = buffer[0] & 0xFF;
System.out.printf ("Sectors to read : %d%n", (sectors + 1));
if (false) // probably not what I think it is
if (sectors == 1 || sectors == 2) // probably not what I think it is
{
int bufferSize = buffer.length * (sectors + 1);
byte[] newBuffer = new byte[bufferSize];
System.arraycopy (buffer, 0, newBuffer, 0, buffer.length);
for (int i = 0; i < sectors; i++)
for (int i = 1; i <= sectors; i++) // skip the buffer we already have
{
byte[] buf = disk.readSector (i + 1);
byte[] buf = disk.readSector (i);
// System.out.printf ("%d %d %d%n", buf.length, buffer.length, newBuffer.length);
System.arraycopy (buf, 0, newBuffer, i * buf.length, buf.length);
}
buffer = newBuffer;
}
assembler = new AssemblerProgram (name + " Boot Loader", buffer, 0x800, 1);
}
else
assembler = new AssemblerProgram (name + " Boot Loader", buffer, 0x00, 0);
}
text.append (assembler.getText ());