mirror of
https://github.com/irmen/prog8.git
synced 2025-04-15 08:39:19 +00:00
errormessage for non romable extsub bank declaration
This commit is contained in:
parent
a28b265197
commit
1075ee8fc3
@ -386,6 +386,12 @@ internal class AstChecker(private val program: Program,
|
||||
}
|
||||
val varbank = subroutine.asmAddress?.varbank
|
||||
if(varbank!=null) {
|
||||
if(compilerOptions.romable) {
|
||||
// the jsrfar bank argument byte needs to be set via self-modifying code, which is non-romable
|
||||
// maybe one day a jsrfar copy/trampoline could be placed in system ram somwhere in the future.
|
||||
err("variable bank extsub has no romable code-generation for the required jsrfar call, stick to constant bank, or create a system-ram trampoline")
|
||||
}
|
||||
|
||||
if(varbank.targetVarDecl(program)?.datatype?.isUnsignedByte!=true)
|
||||
err("bank variable must be ubyte")
|
||||
}
|
||||
@ -742,8 +748,10 @@ internal class AstChecker(private val program: Program,
|
||||
|
||||
// ARRAY without size specifier MUST have an iterable initializer value
|
||||
if(decl.isArray && decl.arraysize==null) {
|
||||
if(decl.type== VarDeclType.MEMORY)
|
||||
if(decl.type== VarDeclType.MEMORY) {
|
||||
err("memory mapped array must have a size specification")
|
||||
return
|
||||
}
|
||||
if(decl.value==null || decl.value is NumericLiteral) {
|
||||
err("array variable is missing a size specification")
|
||||
return
|
||||
@ -833,12 +841,9 @@ internal class AstChecker(private val program: Program,
|
||||
err("string var must be initialized with a string literal")
|
||||
}
|
||||
|
||||
if(decl.value !is StringLiteral) {
|
||||
if(decl.type==VarDeclType.MEMORY)
|
||||
err("strings can't be memory mapped")
|
||||
else
|
||||
valueerr("string var must be initialized with a string literal")
|
||||
}
|
||||
if(decl.value !is StringLiteral && decl.type!=VarDeclType.MEMORY)
|
||||
valueerr("string var must be initialized with a string literal")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -6,26 +6,14 @@
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
uword[] array = [1111,2222,3333,4444]
|
||||
|
||||
cx16.r5 = 1000
|
||||
cx16.r6 = 1010
|
||||
ubyte @shared bankno = 10
|
||||
|
||||
test_stack.test()
|
||||
for cx16.r2 in cx16.r5 to cx16.r6 {
|
||||
txt.print_uw(cx16.r2)
|
||||
txt.spc()
|
||||
}
|
||||
txt.nl()
|
||||
extsub @bank bankno $a000 = routine1()
|
||||
extsub @bank 11 $a000 = routine2()
|
||||
|
||||
test_stack.test()
|
||||
for cx16.r0 in array {
|
||||
txt.print_uw(cx16.r0)
|
||||
txt.spc()
|
||||
}
|
||||
txt.nl()
|
||||
routine1()
|
||||
routine2()
|
||||
|
||||
test_stack.test()
|
||||
cx16.r0L++
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user