This commit is contained in:
Denis Molony 2021-01-05 13:53:28 +10:00
parent 6e70142f59
commit 4071baff77
2 changed files with 9 additions and 10 deletions

View File

@ -58,6 +58,7 @@ public interface ApplesoftConstants
static final byte TOKEN_PRINT = (byte) 0xBA;
static final byte TOKEN_FN = (byte) 0xC2;
static final byte TOKEN_THEN = (byte) 0xC4;
static final byte TOKEN_MINUS = (byte) 0xC9;
static final byte TOKEN_EQUALS = (byte) 0xD0;
int[] tokenAddresses =

View File

@ -41,7 +41,12 @@ public class SubLine
byte firstByte = buffer[startPtr];
if (Utility.isHighBitSet (firstByte))
{
doToken (firstByte);
if (is (ApplesoftConstants.TOKEN_REM) || is (ApplesoftConstants.TOKEN_DATA)
|| is (ApplesoftConstants.TOKEN_AMPERSAND))
return;
}
else if (Utility.isDigit (firstByte))
{
doDigit ();
@ -50,10 +55,6 @@ public class SubLine
else
doAlpha ();
if (is (ApplesoftConstants.TOKEN_REM) || is (ApplesoftConstants.TOKEN_DATA)
|| is (ApplesoftConstants.TOKEN_AMPERSAND))
return;
int ptr = startPtr;
String var = "";
boolean inQuote = false;
@ -61,17 +62,13 @@ public class SubLine
boolean inDefine = false;
int max = startPtr + length - 1;
// System.out.printf ("%02X%n", buffer[max]);
if (buffer[max] == 0)
--max;
// System.out.printf ("%02X%n", buffer[max]);
if (buffer[max] == Utility.ASCII_COLON)
--max;
// System.out.printf ("%02X%n", buffer[max]);
while (ptr <= max)
{
// System.out.printf ("%02X%n", buffer[ptr]);
byte b = buffer[ptr++];
if (b == ApplesoftConstants.TOKEN_DEF)
@ -118,6 +115,7 @@ public class SubLine
inQuote = !inQuote;
}
}
checkVar (var, (byte) 0);
}
@ -126,7 +124,7 @@ public class SubLine
// ---------------------------------------------------------------------------------//
{
assert terminator == Utility.ASCII_LEFT_BRACKET;
// System.out.printf ("checking function: %6d %s%n", parent.lineNumber, var);
if (!functions.contains (var))
functions.add (var);
}
@ -277,7 +275,7 @@ public class SubLine
case ApplesoftConstants.TOKEN_CALL:
byte[] lineBuffer = getBuffer ();
if (lineBuffer[0] == (byte) 0xC9) // negative
if (lineBuffer[0] == ApplesoftConstants.TOKEN_MINUS)
callTarget = "-" + new String (lineBuffer, 1, lineBuffer.length - 1);
else
callTarget = new String (lineBuffer, 0, lineBuffer.length);