improve %zpreserved error messages

This commit is contained in:
Irmen de Jong 2022-01-15 13:03:55 +01:00
parent 7dd2517f67
commit fba98d03a5
2 changed files with 3 additions and 0 deletions

View File

@ -235,6 +235,7 @@ fun determineCompilationOptions(program: Program, compTarget: ICompilationTarget
.asSequence()
.filter { it is Directive && it.directive == "%zpreserved" }
.map { (it as Directive).args }
.filter { it.size==2 && it[0].int!=null && it[1].int!=null }
.map { it[0].int!!..it[1].int!! }
.toList()

View File

@ -676,6 +676,8 @@ internal class AstChecker(private val program: Program,
err("this directive may only occur at module level")
if(directive.args.size!=2 || directive.args[0].int==null || directive.args[1].int==null)
err("requires two addresses (start, end)")
if(directive.args[0].int!! > 255u || directive.args[1].int!! > 255u)
err("start and end addresss must be in Zeropage so 0..255")
}
"%address" -> {
if(directive.parent !is Module)