mirror of
https://github.com/irmen/prog8.git
synced 2025-08-18 19:33:18 +00:00
fixed some compiler errors
This commit is contained in:
@@ -376,6 +376,8 @@ internal class AstChecker(private val program: Program,
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun visit(assignTarget: AssignTarget) {
|
override fun visit(assignTarget: AssignTarget) {
|
||||||
|
super.visit(assignTarget)
|
||||||
|
|
||||||
val memAddr = assignTarget.memoryAddress?.addressExpression?.constValue(program)?.number?.toInt()
|
val memAddr = assignTarget.memoryAddress?.addressExpression?.constValue(program)?.number?.toInt()
|
||||||
if (memAddr != null) {
|
if (memAddr != null) {
|
||||||
if (memAddr < 0 || memAddr >= 65536)
|
if (memAddr < 0 || memAddr >= 65536)
|
||||||
|
@@ -172,8 +172,6 @@ interface IAstModifyingVisitor {
|
|||||||
val ident = arrayIndexedExpression.identifier.accept(this)
|
val ident = arrayIndexedExpression.identifier.accept(this)
|
||||||
if(ident is IdentifierReference)
|
if(ident is IdentifierReference)
|
||||||
arrayIndexedExpression.identifier = ident
|
arrayIndexedExpression.identifier = ident
|
||||||
else
|
|
||||||
throw FatalAstException("can't change class of indexed identifier")
|
|
||||||
arrayIndexedExpression.arrayspec.accept(this)
|
arrayIndexedExpression.arrayspec.accept(this)
|
||||||
return arrayIndexedExpression
|
return arrayIndexedExpression
|
||||||
}
|
}
|
||||||
|
@@ -1436,7 +1436,12 @@ $endLabel""")
|
|||||||
if(incr)
|
if(incr)
|
||||||
out(" inc $what | bne + | inc $what+1 |+")
|
out(" inc $what | bne + | inc $what+1 |+")
|
||||||
else
|
else
|
||||||
out(" lda $what | bne + | dec $what+1 |+ | dec $what")
|
out("""
|
||||||
|
lda $what
|
||||||
|
bne +
|
||||||
|
dec $what+1
|
||||||
|
+ dec $what
|
||||||
|
""")
|
||||||
}
|
}
|
||||||
DataType.FLOAT -> {
|
DataType.FLOAT -> {
|
||||||
out(" lda #<$what | ldy #>$what")
|
out(" lda #<$what | ldy #>$what")
|
||||||
|
@@ -46,7 +46,7 @@ internal class BuiltinFunctionsAsmGen(private val program: Program,
|
|||||||
if(arg is NumericLiteralValue)
|
if(arg is NumericLiteralValue)
|
||||||
throw AssemblyError("should have been const-folded")
|
throw AssemblyError("should have been const-folded")
|
||||||
if(arg is IdentifierReference) {
|
if(arg is IdentifierReference) {
|
||||||
val sourceName = arg.nameInSource.joinToString(".")
|
val sourceName = asmgen.asmIdentifierName(arg)
|
||||||
asmgen.out(" lda $sourceName+1 | sta $ESTACK_LO_HEX,x | dex")
|
asmgen.out(" lda $sourceName+1 | sta $ESTACK_LO_HEX,x | dex")
|
||||||
} else {
|
} else {
|
||||||
asmgen.translateExpression(arg)
|
asmgen.translateExpression(arg)
|
||||||
|
@@ -234,8 +234,6 @@ class ConstantFolding(private val program: Program) : IAstModifyingVisitor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
throw FatalAstException("can't find function ${functionCall.target}")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@ main {
|
|||||||
Y=100
|
Y=100
|
||||||
Y++
|
Y++
|
||||||
check_ub(Y, 101)
|
check_ub(Y, 101)
|
||||||
check_fl(fl, 100.99) ; @todo CLOBBERS OTHER VARS
|
check_fl(fl, 100.99)
|
||||||
check_b(bb, -99)
|
check_b(bb, -99)
|
||||||
check_uw(uw, 2001)
|
check_uw(uw, 2001)
|
||||||
check_w(ww, -999)
|
check_w(ww, -999)
|
||||||
@@ -40,13 +40,12 @@ main {
|
|||||||
Y=100
|
Y=100
|
||||||
Y--
|
Y--
|
||||||
check_ub(Y, 99)
|
check_ub(Y, 99)
|
||||||
check_fl(fl, 99.99) ; @todo CLOBBERS OTHER VARS
|
check_fl(fl, 99.99)
|
||||||
check_b(bb, -100)
|
check_b(bb, -100)
|
||||||
check_uw(uw, 2000)
|
check_uw(uw, 2000)
|
||||||
check_w(ww, -1000)
|
check_w(ww, -1000)
|
||||||
|
|
||||||
@($0400+39) = X
|
@($0400+39) = X
|
||||||
;c64.Screen[39] = X ; @todo compiler error
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_ub(ubyte value, ubyte expected) {
|
sub check_ub(ubyte value, ubyte expected) {
|
||||||
|
Reference in New Issue
Block a user