allow empty pascal files

This commit is contained in:
Denis Molony 2020-10-28 15:42:48 +10:00
parent d8e2914258
commit 1b57001315
3 changed files with 30 additions and 0 deletions

View File

@ -31,6 +31,8 @@ public class ExoBuffer
private int tableLo[] = new int[100];
private int tableHi[] = new int[100];
private static boolean debug = false;
// ---------------------------------------------------------------------------------//
public ExoBuffer (byte[] inBuffer)
// ---------------------------------------------------------------------------------//
@ -43,12 +45,21 @@ public class ExoBuffer
case 0x6000:
outBuffer = new byte[0x2000]; // HGR
break;
case 0x8000:
outBuffer = new byte[0x4000]; // DHGR
break;
case 0xA000:
outBuffer = new byte[0x8000]; // SHR
break;
case 0x5FF8: // this is not working correctly - see CLODE019
return;
default:
System.out.printf ("Invalid buffer size: %04X%n",
Utility.getShortBigEndian (inBuffer, 0));
}
decrunch ();
@ -67,12 +78,20 @@ public class ExoBuffer
// ---------------------------------------------------------------------------------//
{
if (auxType != 0x1FF8 && auxType != 0x3FF8)
{
if (debug)
System.out.println ("wrong auxType");
return false;
}
int address = Utility.unsignedShort (buffer, buffer.length - 2);
if (address != 0x6000 && address != 0x8000 && address != 0xA000)
{
if (debug)
System.out.printf ("wrong address: %04X%n", address);
return false;
}
return true;
}

View File

@ -65,6 +65,11 @@ public class FileEntry extends CatalogEntry
return file;
byte[] buffer = getExactBuffer ();
if (buffer.length == 0)
{
file = new AssemblerProgram (name, buffer, 0); // see DC16.dsk
return file;
}
switch (fileType)
{

View File

@ -167,6 +167,12 @@ public class HexFormatter
{
StringBuilder text = new StringBuilder ();
// if (buffer.length == 0)
// {
// System.out.println ("empty buffer");
// return text.toString ();
// }
for (int i = offset; i < offset + length; i++)
{
int c = buffer[i] & 0xFF;