This commit is contained in:
Denis Molony 2015-12-16 13:14:05 +11:00
parent fc59851dfc
commit 2b17dd3b15

View File

@ -21,26 +21,20 @@ public class BootSector extends AbstractSector
if (assembler == null)
{
// 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 (sectors == 1 || sectors == 2) // probably not what I think it is
int flag = buffer[0] & 0xFF;
if (flag == 1) // apple II
assembler = new AssemblerProgram (name + " Boot Loader", buffer, 0x00, 1);
else // apple III (SOS)
{
int bufferSize = buffer.length * (sectors + 1);
byte[] newBuffer = new byte[bufferSize];
byte[] newBuffer = new byte[buffer.length * 2];
System.arraycopy (buffer, 0, newBuffer, 0, buffer.length);
for (int i = 1; i <= sectors; i++) // skip the buffer we already have
{
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);
}
byte[] buf = disk.readSector (1);
System.arraycopy (buf, 0, newBuffer, 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 ());