dmolony-DiskBrowser/src/com/bytezone/diskbrowser/prodos/ProdosExtendedKeySector.java

45 lines
1.2 KiB
Java
Raw Normal View History

2015-06-01 09:35:51 +00:00
package com.bytezone.diskbrowser.prodos;
import com.bytezone.diskbrowser.disk.AbstractSector;
import com.bytezone.diskbrowser.disk.Disk;
import com.bytezone.diskbrowser.disk.DiskAddress;
2015-06-01 09:35:51 +00:00
class ProdosExtendedKeySector extends AbstractSector
{
public ProdosExtendedKeySector (Disk disk, byte[] buffer, DiskAddress diskAddress)
2015-06-01 09:35:51 +00:00
{
super (disk, buffer, diskAddress);
2015-06-01 09:35:51 +00:00
}
@Override
public String createText ()
{
StringBuilder text = getHeader ("Prodos Extended Key Block");
for (int i = 0; i < 512; i += 256)
{
addText (text, buffer, i, 1, "Storage type (" + getType (buffer[i]) + ")");
addTextAndDecimal (text, buffer, i + 1, 2, "Key block");
addTextAndDecimal (text, buffer, i + 3, 2, "Blocks used");
addTextAndDecimal (text, buffer, i + 5, 3, "EOF");
text.append ("\n");
}
return text.toString ();
}
private String getType (byte flag)
{
switch ((flag & 0x0F))
{
case ProdosConstants.TYPE_SEEDLING:
return "Seedling";
case ProdosConstants.TYPE_SAPLING:
return "Sapling";
case ProdosConstants.TYPE_TREE:
return "Tree";
default:
return "???";
}
}
}