|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webcodepro.applecommander.compiler.ApplesoftCompiler
public class ApplesoftCompiler
Compile the given Applesoft file. The result will be an assembly program (ultimately assembled). This is not intended to be anything sophisticated.
Date created: Nov 2, 2002 10:04:10 PM
Field Summary |
---|
Fields inherited from interface com.webcodepro.applecommander.util.ApplesoftTokens |
---|
ABS, AMPERSAND, AND, ASC, AT, ATN, CALL, CHR$, CLEAR, COLOR, CONT, COS, DATA, DEF, DEL, DIM, DIVIDE, DRAW, END, EQUALS, EXP, FLASH, FN, FOR, FRE, GET, GOSUB, GOTO, GR, GREATERTHAN, HCOLOR, HGR, HGR2, HIMEM, HLIN, HOME, HPLOT, HTAB, IF, INnbr, INPUT, INT, INVERSE, LEFT$, LEN, LESSTHAN, LET, LIST, LOAD, LOG, LOMEM, MID$, MINUS, MULTIPLY, NEW, NEXT, NORMAL, NOT, NOTRACE, ON, ONERR, OR, PDL, PEEK, PLOT, PLUS, POKE, POP, POS, POWER, PRINT, PRnbr, READ, RECALL, REM, RESTORE, RESUME, RETURN, RIGHT$, RND, ROT, RUN, SAVE, SCALE, SCRN, SGN, SHLOAD, SIN, SPC, SPEED, SQR, STEP, STOP, STORE, STR$, TAB, TAN, TEXT, THEN, TO, TRACE, USR, VAL, VLIN, VTAB, WAIT, XDRAW |
Constructor Summary | |
---|---|
ApplesoftCompiler(FileEntry fileEntry)
Constructor for ApplesoftCompiler. |
Method Summary | |
---|---|
protected void |
addAssembly(java.lang.String label,
java.lang.String mnemonic,
java.lang.String parameter)
|
protected void |
addCopyFac(Variable variable)
|
protected void |
addLoadAddress(Variable variable,
char registerHi,
char registerLo)
|
protected void |
addLoadByteValue(Variable variable,
char register)
|
protected void |
addLoadFac(Variable variable)
|
protected void |
addLoadWordValue(Variable variable,
char registerHi,
char registerLo)
|
protected java.lang.StringBuffer |
buildUsedAddresses()
Build a list of ROM and Zero-page addresses that are used within this specific program. |
protected java.lang.StringBuffer |
buildVariableSection()
Build the variable section that is placed at the end of the assembly listing. |
protected void |
checkSyntax(byte tokenValue,
java.lang.String expectedToken)
|
protected void |
checkSyntax(java.lang.String stringValue,
java.lang.String expectedToken)
|
byte[] |
compile()
Compile the given FileEntry and return the assembly code. |
protected void |
evaluateCommand()
|
void |
evaluateEND()
|
protected Variable |
evaluateExpression()
|
void |
evaluateFLASH()
|
void |
evaluateFOR()
|
void |
evaluateGOTO()
|
void |
evaluateGR()
|
void |
evaluateHCOLOR()
|
void |
evaluateHGR()
|
void |
evaluateHGR2()
|
void |
evaluateHOME()
|
void |
evaluateHPLOT()
|
void |
evaluateHTAB()
|
void |
evaluateINVERSE()
|
void |
evaluateNEXT()
|
void |
evaluateNORMAL()
|
protected Variable |
evaluateNumber()
|
void |
evaluatePRINT()
|
void |
evaluateRETURN()
|
void |
evaluateTEXT()
|
void |
evaluateVTAB()
|
protected java.lang.String |
getLineNumberLabel()
Answer with the line number label. |
protected java.lang.reflect.Method |
getMethod(ApplesoftToken token)
|
protected boolean |
hasMoreTokens()
Answers true if there are more tokens to process. |
protected void |
initializeKnownAddresses()
Load known memory addresses from AppleMemoryAddresses.properties. |
protected boolean |
isIntegerNumber(java.lang.String value)
Indicates if this string is a number. |
boolean |
isIntegerOnlyMath()
Indicates integer math only. |
protected ApplesoftToken |
nextToken()
Get the next token. |
protected ApplesoftToken |
peekToken()
Take a peek at the next token. |
void |
setIntegerOnlyMath(boolean integerOnlyMath)
Sets integer only math. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ApplesoftCompiler(FileEntry fileEntry)
Method Detail |
---|
protected void initializeKnownAddresses()
protected boolean hasMoreTokens()
protected ApplesoftToken nextToken()
protected ApplesoftToken peekToken()
public byte[] compile() throws CompileException
CompileException
protected java.lang.StringBuffer buildUsedAddresses()
protected java.lang.StringBuffer buildVariableSection()
Warning: This method re-uses the global sourceAssembly variables since the addAssembly method is used to format the code.
protected void evaluateCommand()
protected java.lang.reflect.Method getMethod(ApplesoftToken token)
protected void addAssembly(java.lang.String label, java.lang.String mnemonic, java.lang.String parameter)
public void evaluateHOME()
public void evaluateTEXT()
public void evaluateRETURN()
public void evaluateEND()
public void evaluateHGR()
public void evaluateHGR2()
public void evaluateGR()
public void evaluateINVERSE()
public void evaluateNORMAL()
public void evaluateFLASH()
protected Variable evaluateExpression() throws CompileException
CompileException
protected Variable evaluateNumber() throws CompileException
CompileException
protected java.lang.String getLineNumberLabel() throws CompileException
CompileException
protected void addLoadByteValue(Variable variable, char register) throws CompileException
CompileException
protected void addLoadWordValue(Variable variable, char registerHi, char registerLo) throws CompileException
CompileException
protected void addLoadAddress(Variable variable, char registerHi, char registerLo)
protected void addLoadFac(Variable variable) throws CompileException
CompileException
protected void addCopyFac(Variable variable) throws CompileException
CompileException
public void evaluateHTAB() throws CompileException
CompileException
public void evaluateVTAB() throws CompileException
CompileException
public void evaluateHCOLOR() throws CompileException
CompileException
public void evaluatePRINT() throws CompileException
CompileException
public void evaluateGOTO() throws CompileException
CompileException
protected void checkSyntax(byte tokenValue, java.lang.String expectedToken) throws CompileException
CompileException
protected void checkSyntax(java.lang.String stringValue, java.lang.String expectedToken) throws CompileException
CompileException
public void evaluateFOR() throws CompileException
CompileException
public void evaluateHPLOT() throws CompileException
CompileException
public void evaluateNEXT() throws CompileException
CompileException
protected boolean isIntegerNumber(java.lang.String value)
public boolean isIntegerOnlyMath()
public void setIntegerOnlyMath(boolean integerOnlyMath)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |