added sys.push() and sys.pop() to put values on cpu stack. Added missing builtin functions to syntax-files.

This commit is contained in:
Irmen de Jong
2021-11-27 18:09:15 +01:00
parent 62485b6851
commit e8e25c6fd6
8 changed files with 117 additions and 20 deletions
@@ -67,6 +67,8 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
"peek" -> throw AssemblyError("peek() should have been replaced by @()")
"pokew" -> funcPokeW(fcall)
"poke" -> throw AssemblyError("poke() should have been replaced by @()")
// "push", "pushw" -> funcPush(fcall, func)
// "pop", "popw" -> funcPop(func)
"cmp" -> funcCmp(fcall)
"callfar" -> funcCallFar(fcall)
"callrom" -> funcCallRom(fcall)
@@ -74,6 +76,30 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
}
}
// private fun funcPop(func: FSignature) {
// if(func.name=="pop") {
// asmgen.out(" pla")
// } else {
// if (asmgen.isTargetCpu(CpuType.CPU65c02))
// asmgen.out(" ply | pla")
// else
// asmgen.out(" pla | tay | pla")
// }
// }
//
// private fun funcPush(fcall: IFunctionCall, func: FSignature) {
// if(func.name=="push") {
// asmgen.assignExpressionToRegister(fcall.args[0], RegisterOrPair.A)
// asmgen.out(" pha")
// } else {
// asmgen.assignExpressionToRegister(fcall.args[0], RegisterOrPair.AY)
// if (asmgen.isTargetCpu(CpuType.CPU65c02))
// asmgen.out(" pha | phy")
// else
// asmgen.out(" pha | tya | pha")
// }
// }
private fun funcCallFar(fcall: IFunctionCall) {
if(asmgen.options.compTarget !is Cx16Target)
throw AssemblyError("callfar only works on cx16 target at this time")