mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-26 08:49:49 +00:00
align text records
This commit is contained in:
parent
030121f12c
commit
d97ba0393b
@ -248,7 +248,7 @@ public class IntegerBasicProgram extends AbstractFile
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* To find integer basic in memory:
|
* To find integer basic in memory:
|
||||||
* $CA $CB contain the starting address
|
* $CA $CB contain the starting address ($9464)
|
||||||
* http://www.easy68k.com/paulrsm/6502/INTLST.TXT
|
* http://www.easy68k.com/paulrsm/6502/INTLST.TXT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -26,6 +26,11 @@ public class TextBuffer
|
|||||||
// step
|
// step
|
||||||
buffer = new byte[totalRecords * reclen];
|
buffer = new byte[totalRecords * reclen];
|
||||||
int copyBytes = Math.min (availableBytes, buffer.length);
|
int copyBytes = Math.min (availableBytes, buffer.length);
|
||||||
|
|
||||||
|
if (copyBytes < 0)
|
||||||
|
System.out.printf ("offset %d len %d copy %d%n", offset, buffer.length,
|
||||||
|
copyBytes);
|
||||||
|
else
|
||||||
System.arraycopy (tempBuffer, offset, buffer, 0, copyBytes);
|
System.arraycopy (tempBuffer, offset, buffer, 0, copyBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ public class TextFile extends AbstractFile
|
|||||||
for (TextBuffer tb : buffers)
|
for (TextBuffer tb : buffers)
|
||||||
{
|
{
|
||||||
buffer = tb.buffer;
|
buffer = tb.buffer;
|
||||||
knownLength (text, tb.firstRecNo);
|
text = knownLength (text, tb.firstRecNo);
|
||||||
}
|
}
|
||||||
return text.toString ();
|
return text.toString ();
|
||||||
}
|
}
|
||||||
@ -102,6 +102,7 @@ public class TextFile extends AbstractFile
|
|||||||
recNo++;
|
recNo++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = buffer.length - ptr;
|
int len = buffer.length - ptr;
|
||||||
int bytes = len < recordLength ? len : recordLength;
|
int bytes = len < recordLength ? len : recordLength;
|
||||||
|
|
||||||
@ -111,9 +112,12 @@ public class TextFile extends AbstractFile
|
|||||||
if ((buffer[ptr + bytes - 1] & 0x7F) == 0x0D) // ignore CR
|
if ((buffer[ptr + bytes - 1] & 0x7F) == 0x0D) // ignore CR
|
||||||
bytes--;
|
bytes--;
|
||||||
|
|
||||||
text.append (String.format ("%,10d %,8d %s%n", recNo * recordLength, recNo++,
|
String line = HexFormatter.getString (buffer, ptr, bytes);
|
||||||
HexFormatter.getString (buffer, ptr, bytes)));
|
line = line.replaceAll ("\\n", "\n ");
|
||||||
|
text.append (
|
||||||
|
String.format ("%,10d %,8d %s%n", recNo * recordLength, recNo++, line));
|
||||||
}
|
}
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user