mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-16 19:08:49 +00:00
35 lines
985 B
Java
35 lines
985 B
Java
|
package com.bytezone.diskbrowser.prodos;
|
||
|
|
||
|
import com.bytezone.diskbrowser.HexFormatter;
|
||
|
import com.bytezone.diskbrowser.disk.AbstractSector;
|
||
|
import com.bytezone.diskbrowser.disk.Disk;
|
||
|
|
||
|
class ProdosIndexSector extends AbstractSector
|
||
|
{
|
||
|
String name;
|
||
|
|
||
|
ProdosIndexSector (String name, Disk disk, byte[] buffer)
|
||
|
{
|
||
|
super (disk, buffer);
|
||
|
this.name = name;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public String createText ()
|
||
|
{
|
||
|
StringBuilder text = getHeader ("Prodos Index Sector : " + name);
|
||
|
|
||
|
for (int i = 0; i < 256; i++)
|
||
|
{
|
||
|
text.append (String.format ("%02X %02X %02X", i, buffer[i], buffer[i + 256]));
|
||
|
if (buffer[i] != 0 || buffer[i + 256] != 0)
|
||
|
text.append (String.format (" %s%n",
|
||
|
"block " + HexFormatter.intValue (buffer[i], buffer[i + 256])));
|
||
|
else
|
||
|
text.append ("\n");
|
||
|
}
|
||
|
if (text.length () > 0)
|
||
|
text.deleteCharAt (text.length () - 1);
|
||
|
return text.toString ();
|
||
|
}
|
||
|
}
|