mirror of
https://github.com/irmen/prog8.git
synced 2025-02-19 11:31:07 +00:00
asm fixes
This commit is contained in:
parent
c90230d33a
commit
034973a9e6
@ -9,8 +9,8 @@
|
|||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="lib" level="project" />
|
|
||||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||||
<orderEntry type="library" name="lib1" level="project" />
|
<orderEntry type="library" name="antlr-4.7.1" level="project" />
|
||||||
|
<orderEntry type="library" name="testlibs" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -1,4 +1,4 @@
|
|||||||
|
%option enable_floats
|
||||||
%import mathlib
|
%import mathlib
|
||||||
%import c64lib
|
%import c64lib
|
||||||
%import c64utils
|
%import c64utils
|
||||||
@ -18,28 +18,29 @@ sub start() {
|
|||||||
|
|
||||||
;v1=foo()
|
;v1=foo()
|
||||||
|
|
||||||
address =c64.MEMBOT(1, 40000.w) ; ok!
|
;address =c64.MEMBOT(1, 40000.w) ; ok!
|
||||||
address =c64.MEMBOT(1, address) ; ok!
|
;address =c64.MEMBOT(1, address) ; ok!
|
||||||
address =c64.MEMBOT(1, memaddr) ; ok!i
|
;address =c64.MEMBOT(1, memaddr) ; ok!i
|
||||||
;address =c64.MEMBOT(1, wordarray[1]) ; @todo nice error about loading X register from stack
|
;address =c64.MEMBOT(1, wordarray[1]) ; @todo nice error about loading X register from stack
|
||||||
|
|
||||||
A, Y =c64.GETADR() ; ok!
|
;A, Y =c64.GETADR() ; ok!
|
||||||
Y, A =c64.GETADR() ; ok!
|
;Y, A =c64.GETADR() ; ok!
|
||||||
address = c64flt.GETADRAY() ; ok!
|
;address = c64flt.GETADRAY() ; ok!
|
||||||
memaddr = c64flt.GETADRAY() ; ok!
|
;memaddr = c64flt.GETADRAY() ; ok!
|
||||||
wordarray[1] = c64flt.GETADRAY() ; ok!
|
;wordarray[1] = c64flt.GETADRAY() ; ok!
|
||||||
v1, v2 =c64.GETADR() ; ok!
|
;v1, v2 =c64.GETADR() ; ok!
|
||||||
address =c64.IOBASE() ; ok!
|
;address =c64.IOBASE() ; ok!
|
||||||
A = c64.CHRIN() ; ok !
|
;A = c64.CHRIN() ; ok !
|
||||||
X = c64.CHRIN() ; ok !
|
;X = c64.CHRIN() ; ok !
|
||||||
v1 = c64.CHRIN() ; ok !
|
;Y = c64.CHRIN() ; ok!
|
||||||
|
;v1 = c64.CHRIN() ; ok !
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub foo() -> byte {
|
sub foo() -> float {
|
||||||
return 1 ; @todo fix error: '1' as byte literal (not ubyte)
|
return 1 ; @todo fix error: '1' as byte or float literal (not ubyte)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import prog8.functions.BuiltinFunctions
|
|||||||
* Checks the validity of all identifiers (no conflicts)
|
* Checks the validity of all identifiers (no conflicts)
|
||||||
* Also builds a list of all (scoped) symbol definitions
|
* Also builds a list of all (scoped) symbol definitions
|
||||||
* Also makes sure that subroutine's parameters also become local variable decls in the subroutine's scope.
|
* Also makes sure that subroutine's parameters also become local variable decls in the subroutine's scope.
|
||||||
* Finally, it also makes sure the datatype of all Var decls is set correctly.
|
* Finally, it also makes sure the datatype of all Var decls and sub Return values is set correctly.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun Module.checkIdentifiers(): MutableMap<String, IStatement> {
|
fun Module.checkIdentifiers(): MutableMap<String, IStatement> {
|
||||||
@ -151,4 +151,12 @@ class AstIdentifiersChecker : IAstProcessor {
|
|||||||
printWarning("writing to the X register is dangerous, because it's used as an internal pointer", assignTarget.position)
|
printWarning("writing to the X register is dangerous, because it's used as an internal pointer", assignTarget.position)
|
||||||
return super.process(assignTarget)
|
return super.process(assignTarget)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun process(returnStmt: Return): IStatement {
|
||||||
|
if(returnStmt.values.isNotEmpty()) {
|
||||||
|
println("CHECK $returnStmt") // TODO adjust return value literalvalue datatype to subroutine's definition
|
||||||
|
returnStmt.definingScope()
|
||||||
|
}
|
||||||
|
return super.process(returnStmt)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -794,8 +794,6 @@ private class StatementTranslator(private val prog: IntermediateProgram,
|
|||||||
|
|
||||||
private fun translateSubroutineCall(subroutine: Subroutine, arguments: List<IExpression>, callPosition: Position) {
|
private fun translateSubroutineCall(subroutine: Subroutine, arguments: List<IExpression>, callPosition: Position) {
|
||||||
// evaluate the arguments and assign them into the subroutine's argument variables.
|
// evaluate the arguments and assign them into the subroutine's argument variables.
|
||||||
prog.line(callPosition)
|
|
||||||
|
|
||||||
if(subroutine.asmParameterRegisters.isNotEmpty()) {
|
if(subroutine.asmParameterRegisters.isNotEmpty()) {
|
||||||
if(subroutine.parameters.size!=subroutine.asmParameterRegisters.size)
|
if(subroutine.parameters.size!=subroutine.asmParameterRegisters.size)
|
||||||
throw CompilerException("no support for mix of register and non-register subroutine arguments")
|
throw CompilerException("no support for mix of register and non-register subroutine arguments")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user