mirror of
https://github.com/irmen/prog8.git
synced 2025-02-19 11:31:07 +00:00
fix assembly error for uword[3] @zp @split word_addrs
This commit is contained in:
parent
f68b46fc60
commit
98d2c64d5d
@ -497,7 +497,15 @@ internal class ProgramAndVarsGen(
|
|||||||
for ((scopedName, zpvar) in zpVariables) {
|
for ((scopedName, zpvar) in zpVariables) {
|
||||||
if (scopedName.startsWith("cx16.r"))
|
if (scopedName.startsWith("cx16.r"))
|
||||||
continue // The 16 virtual registers of the cx16 are not actual variables in zp, they're memory mapped
|
continue // The 16 virtual registers of the cx16 are not actual variables in zp, they're memory mapped
|
||||||
asmgen.out("${scopedName.substringAfterLast('.')} \t= ${zpvar.address} \t; zp ${zpvar.dt}")
|
val variable = symboltable.flat.getValue(scopedName) as StStaticVariable
|
||||||
|
if(variable.dt in SplitWordArrayTypes) {
|
||||||
|
val lsbAddr = zpvar.address
|
||||||
|
val msbAddr = zpvar.address + (zpvar.size/2).toUInt()
|
||||||
|
asmgen.out("${scopedName.substringAfterLast('.')}_lsb \t= $lsbAddr \t; zp ${zpvar.dt} (lsbs)")
|
||||||
|
asmgen.out("${scopedName.substringAfterLast('.')}_msb \t= $msbAddr \t; zp ${zpvar.dt} (msbs)")
|
||||||
|
} else {
|
||||||
|
asmgen.out("${scopedName.substringAfterLast('.')} \t= ${zpvar.address} \t; zp ${zpvar.dt}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import prog8.code.target.C64Target
|
|||||||
import prog8.code.target.VMTarget
|
import prog8.code.target.VMTarget
|
||||||
import prog8tests.helpers.ErrorReporterForTests
|
import prog8tests.helpers.ErrorReporterForTests
|
||||||
import prog8tests.helpers.compileText
|
import prog8tests.helpers.compileText
|
||||||
|
import kotlin.io.path.readText
|
||||||
|
|
||||||
class TestArrayThings: FunSpec({
|
class TestArrayThings: FunSpec({
|
||||||
test("assign prefix var to array should compile fine and is not split into inplace array modification") {
|
test("assign prefix var to array should compile fine and is not split into inplace array modification") {
|
||||||
@ -160,5 +161,19 @@ main {
|
|||||||
compileText(VMTarget(), false, text, writeAssembly = true) shouldNotBe null
|
compileText(VMTarget(), false, text, writeAssembly = true) shouldNotBe null
|
||||||
compileText(C64Target(), false, text, writeAssembly = true) shouldNotBe null
|
compileText(C64Target(), false, text, writeAssembly = true) shouldNotBe null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test("split array in zeropage is okay") {
|
||||||
|
val text = """
|
||||||
|
main {
|
||||||
|
sub start() {
|
||||||
|
uword[3] @zp @split @shared thearray
|
||||||
|
}
|
||||||
|
}"""
|
||||||
|
val result = compileText(C64Target(), false, text, writeAssembly = true)!!
|
||||||
|
val assemblyFile = result.compilationOptions.outputDir.resolve(result.compilerAst.name + ".asm")
|
||||||
|
val assembly = assemblyFile.readText()
|
||||||
|
assembly shouldContain "thearray_lsb"
|
||||||
|
assembly shouldContain "thearray_msb"
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
- fix assembly error for uword[3] @zp @split word_addrs (not defined symbol 'p8_word_addrs_lsb')
|
|
||||||
- fix fill() to not access pixels outside of the screen (use virtual testmongfx first?)
|
- fix fill() to not access pixels outside of the screen (use virtual testmongfx first?)
|
||||||
- change fill() to use unsigned types for optimization, and re-check previous problem.
|
- change fill() to use unsigned types for optimization, and re-check previous problem.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user