todo strcmp

This commit is contained in:
Irmen de Jong 2020-10-14 01:22:43 +02:00
parent 439761cb67
commit 5595564a1f
2 changed files with 8 additions and 0 deletions

View File

@ -90,6 +90,7 @@ internal class ExpressionsAsmGen(private val program: Program, private val asmge
in ByteDatatypes -> translateByteEquals(left, right, leftConstVal, rightConstVal, jumpIfFalseLabel)
in WordDatatypes -> translateWordEquals(left, right, leftConstVal, rightConstVal, jumpIfFalseLabel)
DataType.FLOAT -> translateFloatEquals(left, right, leftConstVal, rightConstVal, jumpIfFalseLabel)
DataType.STR -> throw AssemblyError("can't perform string comparison here")
else -> throw AssemblyError("weird operand datatype")
}
}
@ -131,6 +132,7 @@ internal class ExpressionsAsmGen(private val program: Program, private val asmge
in ByteDatatypes -> translateByteNotEquals(left, right, leftConstVal, rightConstVal, jumpIfFalseLabel)
in WordDatatypes -> translateWordNotEquals(left, right, leftConstVal, rightConstVal, jumpIfFalseLabel)
DataType.FLOAT -> translateFloatNotEquals(left, right, leftConstVal, rightConstVal, jumpIfFalseLabel)
DataType.STR -> throw AssemblyError("can't perform string comparison here")
else -> throw AssemblyError("weird operand datatype")
}
}
@ -145,6 +147,7 @@ internal class ExpressionsAsmGen(private val program: Program, private val asmge
translateExpression(right)
asmgen.out(" jsr floats.less_f | inx | lda P8ESTACK_LO,x | beq $jumpIfFalseLabel")
}
DataType.STR -> throw AssemblyError("can't perform string lt")
else -> throw AssemblyError("weird operand datatype")
}
}
@ -159,6 +162,7 @@ internal class ExpressionsAsmGen(private val program: Program, private val asmge
translateExpression(right)
asmgen.out(" jsr floats.lesseq_f | inx | lda P8ESTACK_LO,x | beq $jumpIfFalseLabel")
}
DataType.STR -> throw AssemblyError("can't perform string le")
else -> throw AssemblyError("weird operand datatype")
}
}
@ -173,6 +177,7 @@ internal class ExpressionsAsmGen(private val program: Program, private val asmge
translateExpression(right)
asmgen.out(" jsr floats.greater_f | inx | lda P8ESTACK_LO,x | beq $jumpIfFalseLabel")
}
DataType.STR -> throw AssemblyError("can't perform string gt")
else -> throw AssemblyError("weird operand datatype")
}
}
@ -187,6 +192,7 @@ internal class ExpressionsAsmGen(private val program: Program, private val asmge
translateExpression(right)
asmgen.out(" jsr floats.greatereq_f | inx | lda P8ESTACK_LO,x | beq $jumpIfFalseLabel")
}
DataType.STR -> throw AssemblyError("can't perform string ge")
else -> throw AssemblyError("weird operand datatype")
}
}

View File

@ -3,6 +3,8 @@ TODO
====
- get rid of all other TODO's in the code ;-)
- introduce strcmp()
- modify string comparsion expressions to use strcmp() automatically
- implement @stack for asmsub parameters
- make it possible to use cpu opcodes such as 'nop' as variable names by prefixing all asm vars with something such as '_'
- option to load the built-in library files from a directory instead of the embedded ones (for easier library development/debugging)