mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2024-10-31 16:04:51 +00:00
Added generic ability the write boot code to track 0, sector 0.
This commit is contained in:
parent
010ee8e488
commit
e10e00eb41
@ -19,6 +19,8 @@
|
||||
*/
|
||||
package com.webcodepro.applecommander.storage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@ -296,4 +298,28 @@ public abstract class FormattedDisk extends Disk {
|
||||
}
|
||||
return theFileEntry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the disk. Make sure that this is what is intended -
|
||||
* there is no backing out!
|
||||
*/
|
||||
public abstract void format();
|
||||
|
||||
/**
|
||||
* Write the AppleCommander boot code to track 0 sector 0 of
|
||||
* the disk. This will work for a floppy, but may cause problems
|
||||
* for other devices.
|
||||
*/
|
||||
protected void writeBootCode() {
|
||||
InputStream inputStream = getClass().
|
||||
getResourceAsStream("AppleCommander-boot.dump");
|
||||
if (inputStream != null) {
|
||||
byte[] bootCode = new byte[SECTOR_SIZE];
|
||||
try {
|
||||
inputStream.read(bootCode, 0, bootCode.length);
|
||||
writeSector(0, 0, bootCode);
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user