start address of blocks without explicit memory address, is now word-aligned in memory

This commit is contained in:
Irmen de Jong 2021-02-20 03:06:00 +01:00
parent 6319269976
commit 15695a304e
3 changed files with 19 additions and 3 deletions

View File

@ -181,6 +181,8 @@ internal class AsmGen(private val program: Program,
out("\n\n; ---- block: '${block.name}' ----")
if(block.address!=null)
out("* = ${block.address!!.toHex()}")
else
out("\t.align 2")
out("${block.name}\t" + (if("force_output" in block.options()) ".block\n" else ".proc\n"))
outputSourceLine(block)

View File

@ -2,8 +2,6 @@
TODO
====
- make blocks without explicit memory address, word-aligned in the assembly.
- add sound to the cx16 tehtriz
- hoist all variable declarations up to the subroutine scope *before* even the constant folding takes place (to avoid undefined symbol errors when referring to a variable from another nested scope in the subroutine)

View File

@ -5,6 +5,22 @@
main {
sub start() {
txt.print("Foo_bar\n")
uword xx = &b2.zz
xx=&b3.zz
txt.print_uwhex(&main, true)
txt.nl()
txt.print_uwhex(&b2, true)
txt.nl()
txt.print_uwhex(&b3, true)
txt.nl()
}
}
b2 {
str zz="hello"
}
b3 $4001 {
str zz="bye"
}